This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
My application builds its own database schema by executing sql ddl commands and works fine with Oracle and mySQl databases. However whatever I try it does not seem to work with mssql (2000 or 2005). I have tried jdbc driver versions 1 through 1.2 and even the beta of version 2.
Basically my "create table" commands seem to be ignored and don't even create an exception.
I am connecting via sql authentication and not using the dll.
Has anyone managed to do this and if so could they be kind enough to post a code example.
My classpath includes sqljdbc4.jar or sqljdbc.jar depending on the version of the Microsoft jdbc driver I'm playing with, but the results are the same. I've tried their versions, 1.1, 1.2 and Preview 2.0.
The executeUpdate executes with no exception, but the table is not created. I've noticed that I cannot refresh the list of tables in SQL Management Studion until I cancel the debug session in Eclipse, it returns a lock timeout message !
I have connected to the database as the same user as the jdbc session is using (SQL authentication) and I can manually create a table fine.
The same code runs against mysql and oracle databases and creates tables ok (albeit with slightly different syntax in the sql ddl statement).
If you have a small snippet of code from your system that works I would love to have a look.
Unfortunately the snippet of code would be Hibernate code, not JDBC code! But what its doing is the same: DDL via JDBC.
Just a thought, is DDL transactional in SQL Server? Its not in other databases, but it does almost sound like your process is blocking for some reason - possible a commit or rollback? If you call execute sp_who2 what state is your JDBC process in?