aspose file tools*
The moose likes JDBC 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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JdbcOdbcDriver/Stored procedures. Please help" Watch "JdbcOdbcDriver/Stored procedures. Please help" New topic
Author

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.
chandran..

chandran..
Ambrose R Tati
Greenhorn

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);
cs.executeUpdate();
String msg = cs.getString(1);
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
...
What am I doing wrong?
Thanks
Ambrose
Ganapathi Srinivasan
Ranch Hand

Joined: Apr 18, 2001
Posts: 41
Hi,
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.
Regards,
Ganp.
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.
BestWishes.,
chandran
raja sunil
Greenhorn

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");
while(rs.next())
{
...
}
what is the ResultSet value if there is a redundant row in the table?
can u tell with an example code.
many thanks
sunil
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JdbcOdbcDriver/Stored procedures. Please help