Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stored Procedure Problem

 
Gil Li
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
I have added a stored procedure in mySQL database. that stored funstion just gets the input integer and gives with adding number 10.When I execute in mySQL promt that works fine. I tried Java code to get the output. Here is the code. Here i got Exception like 'CallableStatements not Supported' . I dont know what is the problme here. Help me..


import java.sql.*;
import java.io.*;

public class proc
{
public static void main(String a[])
{
try
{

Class.forName("org.gjt.mm.mysql.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/jobsearch?user=root&password=");
CallableStatement cs = con.prepareCall("{? = call pr(?)}");


cs.registerOutParameter(1,Types.INTEGER);
cs.setInt(1,5);

cs.execute();

System.out.println(cs.getInt(1));


} catch(Exception e){ System.out.println(e);}



}
}
 
Jyothi Lature
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Which version of MySQL are u using? Bcoz, MySQL 3.x lacks support of callable statements via the JDBC API. I guess, using the older version is the problem...
 
Gil Li
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jyothi...

I am using the latest version mySQL 5.0 which supports stored procedure. But I am not able to invoke the stored procedure via JDBC...I dont know where is the problem....
 
Thomas Risberg
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like the JDBC driver you are using does not support this new feature. You need to download the latest development driver (3.1.4-beta)
 
Gil Li
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats it...


Thankyou Thomas...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic