These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: 3.1 JDBC error: Unsupported method: Connection.prepareStatem
PostPosted: Mon Jan 03, 2011 11:45 am 
Beginner
Beginner

Joined: Fri Jul 20, 2007 10:38 am
Posts: 49
Hello,

I'm connecting to a SQLServer 2000 and SQLServer 2005 database and I ran into this issue:

Code:
util.JDBCExceptionReporter  - [BEA][SQLServer JDBC Driver]Unsupported method: Connection.prepareStatement
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not insert: [(removed)]; uncategorized SQLException for SQL [insert into (removed) values (?)]; SQL state [HY000]; error code [0]; [BEA][SQLServer JDBC Driver]Unsupported method: Connection.prepareStatement; nested exception is java.sql.SQLException: [BEA][SQLServer JDBC Driver]Unsupported method: Connection.prepareStatement
java.sql.SQLException: [BEA][SQLServer JDBC Driver]Unsupported method: Connection.prepareStatement


I've managed to solve it following the advice in this forum:
http://forums.datadirect.com/ddforums/message.jspa?messageID=3976

It says:
Quote:
Against SQL Server 2000, the driver can not implement this method correctly in the general case because SQL Server 2000 does not allow you to return the value of an arbitrary column from an insert, update or delete statement. At least not with out making an extra round trip to the server, which negates the purpose of this method.

I have seen implementations of this method by other drivers where the value returned will be the value of the identity column regardless of which column was actually asked for. I believe that implementation is bad. I feel it is much worse for a driver to return incorrect information than it is to not be able to return the information. Assuming the id column in the statement is an identity column, then Hibernate may have just gotten lucky that it worked in the testing that they did.

We will look into this further.

and
Quote:
To temporarily work around this issue set the hibernate.jdbc.use_get_generated_keys option to false in the hibernate.properties file.

hibernate.jdbc.use_get_generated_keys false

We are working to update the drivers so this workaround will not be necessary.


My question is: has the issue been resolved? If so, in what version?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.