Hi,

I've got this simple stored proc:

CREATE DBPROC protocole_get_date_invent(IN protocole INTEGER, OUT 
dateinvent DATE) AS

SELECT MAX(dateinvent) FROM DUMMY.inventaire where protocole=:protocole;
FETCH INTO :dateinvent;


And this method in java:

     public Date getDateInvent() throws RemoteException {
        try {
            makeConnection();
        } catch (Exception ex) {
            throw new EJBException("Unable to connect to database. " + 
ex.getMessage());
        }
        try {
            CallableStatement cs = con.prepareCall("CALL 
protocole_get_date_invent(?, ?)");
            cs.registerOutParameter(2, Types.DATE);
            cs.setInt(1, id.intValue());
            System.out.println("Running get_date_invent...");
            cs.execute();
            System.out.println("[OK]");
            con.commit();
            // get return value from stored proc
            return cs.getDate(2);
        } catch (Exception e) {
            throw new RemoteException(e.toString());
        } finally {
            try { con.close(); } catch (Exception e) { }
        }
     }


I get the following exeception:
Exception in thread "main" java.rmi.ServerException: RemoteException 
occurred in server thread; nested exception is:
        javax.transaction.TransactionRolledbackException: 
com.sap.dbtech.jdbc.translators.ConversionExceptionSapDB: Cannot convert 
'20020210' to Date; nested exception is:
        java.rmi.RemoteException: 
com.sap.dbtech.jdbc.translators.ConversionExceptionSapDB: Cannot convert 
'20020210' to Date


20020210 is the value I'm expecting. dateinvent is an sql date in the 
inventaire table.

Thanks in advance,
Tom.

_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to