Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JdbcOdbcDriver/Stored procedures. Please help

 
Ambrose Tati
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ambrose!!
what U use to fetch the Oracle Stored Procedure in Java.Let see U'r code.
chandran..
 
Ambrose R Tati
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic