Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Call stored procedure from jsp pages

843854Nov 1 2002 — edited Nov 6 2002
hi all,

I have some problems on calling the procedure in oracle from jsp.. I am new to stored procedure so now i had created a simple stored procedure(function) and based on this website http://www.enterprisedt.com/publications/oracle/result_set.html
i try to run it in the sqlplus it works fine but when i want to run it in my jsp page. Errors occurred.. The codes run like this :

//previously had connected to the database
String query = "begin ? := sp_get_stocks(?); end;";

CallableStatement stmt = conn.prepareCall(query);

// register the type of the out param - an Oracle specific type
stmt.registerOutParameter(1, OracleTypes.CURSOR);

// set the in param
stmt.setFloat(2, price);

// execute and retrieve the result set
stmt.execute();
ResultSet rs = (ResultSet)stmt.getObject(1);

// print the results
while (rs.next()) {
System.out.println(rs.getString(1) + "\t" +
rs.getFloat(2) + "\t" +
rs.getDate(3).toString());
}

i run exactly the same as this codes but when it states that the oracleTypes is a undefined variable or class. What should i do?? Do i need to import anything or declare anything?? Please give me some advice. I appreciated it. Thanks alot.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 4 2002
Added on Nov 1 2002
3 comments
402 views