I use MS SQL Server 2000 as database.
My Tomcat5.0 deployment is as below:
Data Source URL:
jdbc:microsoft:sqlserver://127.0.0.1:1433;databaseName=Hibernate (This is the database name which i want to specify)
JDBC Driver Class:
com.microsoft.jdbc.sqlserver.SQLServerDriver
But when i run my hibernate examples,it shows:net.sf.hibernate.JDBCException: Could not save object
I try to copy the tables into the MS SQL Server 2000 default database:Northwind.
Then i run the examples anain,this time,the objects are saved into the tables in the Northwind correctly.
How strange,I have never specified the datasource to Northwind,however,i have specified the datasource to Hibernate,why the operations are all pointing to the Northwind?
Who can tell me how and when can i specify the database?
If i specify it in the Tomcat Datasource deployment,it seems not flexible,bucause i can't change in my application.
So i want to specify it in my application code.
How can i do?
_________________ Confidence,Persistence & Endurance lead to Success!
|