File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes JdbcOdbcDriver/Stored procedures. Please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JdbcOdbcDriver/Stored procedures. Please help" Watch "JdbcOdbcDriver/Stored procedures. Please help" New topic

JdbcOdbcDriver/Stored procedures. Please help

Ambrose Tati
Ranch Hand

Joined: Oct 03, 2000
Posts: 55
Dear all,
I'm using Personal Oracle 7 with jdbc-odbc bridge and JDK 1.3 on
Win98. Everything works fine but not able to call Oracle stored procedures from within Java.
Does not sun.jdbc.odbc.JdbcOdbcDriver support calls to stored procedures?
Many thanks
Ambrose Tati
Raajesh Chandran
Ranch Hand

Joined: May 04, 2001
Posts: 103
Hi Ambrose!!
what U use to fetch the Oracle Stored Procedure in Java.Let see U'r code.

Ambrose R Tati

Joined: Nov 06, 2000
Posts: 21
Hi chandran,
I have a Oracle stored procedure with the following prototype:
procedure get_message(msg out varchar2)
In my Java program after successfull connection to my Personal Oracle7 I do:
try {
CallableStatement cs = con.prepareCall("{call message(?)}");
cs.registerOutParameter(1, Types.VARCHAR);
String msg = cs.getString(1);
} catch (Exception ex) {
What am I doing wrong?
Ganapathi Srinivasan
Ranch Hand

Joined: Apr 18, 2001
Posts: 41
Basically it would be helpful if u also give ur stored procedure.
try this...
instead of ur calling ur stored procedure as
"{call message(?)}"
call it as
"{?=call message()}"
if u are returning a variable from ur stored procedure. Might work..but still depends on how u have written ur stored procedure.
Reply as to whether this was helpful.
Raajesh Chandran
Ranch Hand

Joined: May 04, 2001
Posts: 103
Hi Ambrose!!
U'r codings are correct.No problem.Only Version is Problem.I think U R using Oracle7.It doesn't support JDK1.3.I mean U can't retrive OUT parameter by using Oracle7 or Oracle8.
Try with this by using Oracle8i.Surely it will work fine.I got it.
raja sunil

Joined: Feb 07, 2004
Posts: 1
dear all,
i have one doubt in the query retreiving process.
Statement stmt;
Resultset rs;
rs=stmt.executeQuery("select distinct(some_field) from some_table");
what is the ResultSet value if there is a redundant row in the table?
can u tell with an example code.
many thanks
I agree. Here's the link:
subject: JdbcOdbcDriver/Stored procedures. Please help
jQuery in Action, 3rd edition