• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Stored Procedure Problem

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);}



}
}
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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....
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thats it...


Thankyou Thomas...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic