This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes New to JDBC Callable Satement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "New to JDBC Callable Satement" Watch "New to JDBC Callable Satement" New topic
Author

New to JDBC Callable Satement

hari ann
Greenhorn

Joined: Dec 09, 2007
Posts: 11
Hi

I am learning Callable statement. Just I have the following questions. please help me .

public class Example1{
public static void main(String[] args) {
Connection conn=null;
try {
Class.forName("com.mysql.jdbc.Driver");
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/Movie","root","root");
CallableStatement cast= conn.prepareCall("{call movieproc(?,?)}");
cast.setString(1,"Raja Hindhustani");
cast.setInt(2,1995);
int records= cast.exceuteUpdate();
system.out.println(records+"has been inserted");
}
catch(Exception e){
e.printStackTrace();
}
finally{
conn.close();
}

In this example do we need to define the procedure movieproc seperately?
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2491
    
    8

In this example do we need to define the procedure movieproc seperately?
Yes. You have to create that procedure in your database. It is called a stored procedure.


OCUP UML fundamental and ITIL foundation
youtube channel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: New to JDBC Callable Satement
 
Similar Threads
Single tone Vs Static
Array Index Out Of Bounds Exception: 0 ( Mistake with My MySQL "count"?)
Need Expert Advice
Multiple Database Connection. Best practice?
Performance issue while uploading 10000 or more records