JDBC - Date problem with Oracle

JDBC - Date problem with Oracle

Post by Giovanni Azu » Thu, 17 Jan 2002 23:45:09



Hi all,

I created an application that executes SQL commands
and Stored Procedures over an Oracle Database. The
Date type on the Server hold time information but when
returned as output SP parameters or SQL query field the
time part is discarded... I would like to know if this is normal
or is that I am missing something...

I have been doing i.e:

CallableStatement cstatOrderIns = null;
cstatOrderIns = connection.prepareCall("{call TEST(?)}");
cstatOrderIns.registerOutParameter (1, Types.TIMESTAMP);
// have tried this bellow as well...
// cstatOrderIns.registerOutParameter (1, Types.DATE);

cstatOrderIns.execute();
GregorianCalendar insertDate = new GregorianCalendar();
insertDate.setTime(cstatOrderIns.getDate(1));
System.out.println(cstatOrderIns.getDate(1).toString());
System.out.println(insertDate.get(Calendar.HOUR) + ":" +
insertDate.get(Calendar.MINUTE));

The output is always "0:0"...

Clling a TEST Stored Procedure which does something like this:
SELECT SYSTEMTIME FROM DUAL INTO OUTPARAM

Thanks in advance,
Best Regards,
Giovanni

 
 
 

1. JDBC - Date problem with Oracle

Hi all,

I created an application that executes SQL commands
and Stored Procedures over an Oracle Database. The
Date type on the Server hold time information but when
returned as output SP parameters or SQL query field the
time part is discarded... I would like to know if this is normal
or is that I am missing something...

I have been doing i.e:

CallableStatement cstatOrderIns = null;
cstatOrderIns = connection.prepareCall("{call TEST(?)}");
cstatOrderIns.registerOutParameter (1, Types.TIMESTAMP);
// have tried this bellow as well...
// cstatOrderIns.registerOutParameter (1, Types.DATE);

cstatOrderIns.execute();
GregorianCalendar insertDate = new GregorianCalendar();
insertDate.setTime(cstatOrderIns.getDate(1));
System.out.println(cstatOrderIns.getDate(1).toString());
System.out.println(insertDate.get(Calendar.HOUR) + ":" +
insertDate.get(Calendar.MINUTE));

The output is always "0:0"...

calling a TEST Stored Procedure which does something like this:
SELECT SYSTEMTIME INTO OUTPARAM

Thanks in advance,
Best Regards,
Giovanni

2. Wierd!

3. Date problem in select statement for ORACLE with JDBC

4. sql-7, Master Detals Relation ship - Delete

5. Y2K problem using JDBC to extract dates from Oracle

6. Output values of type Object are not allowed in result sets

7. problem querying on date fields using Oracle Jdbc thin dirver

8. Query limit ?

9. Y2K problem using JDBC to extract dates from Oracle

10. (JDBC, Oracle) Connection problem with JDBC - sqlplus no problem

11. Problems searching date field using like (jdbc problem)

12. Problems with java.sql.Date and the DATE type of Oracle database

13. problem comparing date in JDBC