aspose file tools*
The moose likes JDBC and the fly likes Date format and SQL Server stored procedure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Date format and SQL Server stored procedure" Watch "Date format and SQL Server stored procedure" New topic
Author

Date format and SQL Server stored procedure

Jayashree Varahan
Greenhorn

Joined: Sep 17, 2000
Posts: 9
I'm calling a SQL Server stored procedure using the following statement. This procedure returns an output parameter which is of type DateTime.
CallableStatement statement = databaseConnection. prepareCall("{call test(?)}");
statement.registerOutParameter(1, java.sql.Types.DATE);
I'm getting
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver] Optional feature not implemented

Peter Tran
Bartender

Joined: Jan 02, 2001
Posts: 783
Jayashree,
You're just lucky I ran into this problem before. The exception returned from the driver isn't very clear what it means "Optional feature not implemented."
The problem is SQL Server doesn't not support java.sql.Types.DATE. You'll have to use java.sql.Types.TIMESTAMP.
It took me a long time to figure this out. JDBC doesn't standardize the exception message. For awhile I thought it was a bug in the driver implementation. I even sent a bug report to the company who wrote the driver. They told me the error message meant and what to do. Unfortunately for us, if you move to ORACLE you may have to modify your code back to java.sql.Types.DATE. So much for being platform independent...
Cheers,
-Peter
Jayashree Varahan
Greenhorn

Joined: Sep 17, 2000
Posts: 9
Thank you very much!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Date format and SQL Server stored procedure
 
Similar Threads
VARBINARY in sp -how-to
Statement & PreparedStatement
identity
how to call a stored procedure which do not return a resultSet
executeUpdate() returning unexpected results