Thank you very much for your helpful answer. The problem was the STOP (0)!!! I'll have to rewrite some code, but that seems to be the way for solving all my problems.
Thanks again. No exception was thrown and "Schroeder, Alexander" wrote: > Hi Jose, > > indeed the STOP(x) command was not originally meant for the way you did use > it, and thus produced some problematic behaviour both in kernel and JDBC > driver. > > ------------------------------------------------------------------------------------ > >From the documentation of STOP: > > The database procedure is interrupted immediately when the STOP function is invoked. > The value of the first parameter of the STOP function is the return or error message > that the application receives as the result of the database procedure > call. An error text can also be returned. > ------------------------------------------------------------------------------------ > > Shortly speaking, no data to output parameters is returned when STOP is used, and the > code and the optional message are implemented as error code and error message. > So don't use it if you want something to be returned from your DBPROC. > > Our problem is that STOP(0) is inconsistently handled, as 0 is the error code that > signals that actually no error happened. Thanks for reporting that issue. > > Regards > Alexander Schr�der > SAP Labs Berlin > > BTW: Don't close the statement while you still want to access some data from it. > You should close a statement/resultset/connection *after* you accessed it > the last time, not earlier. > > > -----Original Message----- > > From: Jose Ignacio Carretero Guarde [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, February 19, 2003 12:57 PM > > To: sapdb_general > > Subject: BUG in JDBC? > > > > > > Hello: > > > > I don't know if this is a bug or any other problem.... > > > > I've downloaded the last jdbc driver from ftp.sap.com. (Before I tried > > with the sapdbc.jar jdbc driver which is installed with the > > distribution > > with the same result). > > > > I'm using SAPDB 7.3.0.32 (The last suitable version for Solaris 7 in a > > Ultra 5 computer). > > > > I have this stored procedure: > > > > CREATE DBPROC prueba (OUT p_res VARCHAR(50) ) AS > > BEGIN > > SET p_res = 'I am trying'; > > STOP(0); > > END; > > > > I have this code in Java: > > ..... > > CallableStatement st = null; > > String res = null; > > try { > > st = _con.prepareCall("{call carre.prueba(?)}"); > > st.registerOutParameter(1, Types.VARCHAR); > > st.execute(); > > st.close(); > > res = st.getString(1); > > } catch (SQLException e) { > > _error = e.getErrorCode(); > > System.out.println("Error. " + e.getMessage() + " :" + > > e.getErrorCode()); > > return null; > > } > > > > ..... > > > > And everything is ok until the CallableStatement.getString method is > > invoked. This is the exceptions I get. This exception is > > independent of > > the OUT parameter (I mean. I'be tried with getInteger, > > getFloat, etc... > > Obviusly whith different stored procedures): > > > > Exception in thread "main" java.lang.NullPointerException > > at > > com.sap.dbtech.jdbc.translators.DBTechTranslator.isNull(DBTech > > Translator.java:790) > > > > at > > com.sap.dbtech.jdbc.translators.StringTranslator.getString(Str > > ingTranslator.java:235) > > > > at > > com.sap.dbtech.jdbc.CallableStatementSapDB.getString(CallableS > > tatementSapDB.java:1176) > > > > at ClaseConsultasSAPDB.prueba(ClaseConsultasSAPDB.java:26) > > at ClasePrincipal.main(ClasePrincipal.java:18) > > > > Thanks. > > > > _______________________________________________ > > sapdb.general mailing list > > [EMAIL PROTECTED] > > http://listserv.sap.com/mailman/listinfo/sapdb.general > > _______________________________________________ sapdb.general mailing list [EMAIL PROTECTED] http://listserv.sap.com/mailman/listinfo/sapdb.general
