|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Error on stored procedure call from jsp
I'm trying to call a stored procedure from a jsp page using the code below,
but I am currently getting th efollowing error message: "java.sql.SQLException: [BEA][Oracle JDBC Driver]The requested output parameter data is not available." I am running weblogic 8.1 on my local machine and connecting to an Oracle 8i database. Can someone tell me why I am getting this error? Thanks in advance for your help! CallableStatement = conn.prepareCall("{ call ? := Func_Noodle_oqr_one(?,?)}"); st.registerOutParameter(1, OracleTypes.CURSOR); st.setString(2,""); st.setInt(3,neuId); ResultSet rs = (ResultSet)st.getObject(1); // <- The error appears to be occuring at this point rs = st.executeQuery(); while (rs.next()) { System.out.println(rs.getString(1) + "\t" + rs.getFloat(2) + "\t" + rs.getDate(3).toString()); } |
|
#2
|
||||
|
||||
|
You're giving the ResultSet rs a value, twice.
ResultSet rs = (ResultSet)st.getObject(1); // <- The error appears to be occuring at this point rs = st.executeQuery(); In my code, I write the following : StringBuffer zoekString = new StringBuffer(); zoekString.append ("select * from gebruiker "); zoekString.append("where naam=? and wachtwoord=? "); Connection con = getConnection(); PreparedStatement ps = con.prepareStatement(zoekString.toString()); ps.setString(1,_naam); ps.setString(2,_wachtwoord); ResultSet rs = ps.executeQuery(); if (rs.next() ) { Gebruiker gebruiker = new Gebruiker(rs); rs.close(); ps.close(); con.close(); return gebruiker; } In short, I use PreparedStatements and the ResultSet is given by the method executeQuery() of the PreparedStatement. I've read that PreparedStatements are said to be more performant than Statements. Try this one |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Java Development > Error on stored procedure call from jsp |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|