我正在使用Hibernate 3.2.1和数据库SQLServer2000
当我尝试使用我的dao插入一些数据时,会出现一些警告:
java.sql.SQLWarning: [Microsoft][SQLServer 2000 Driver for JDBC]Database changed to BTN_SPP_DB
at com.microsoft.jdbc.base.BaseWarnings.createSQLWarning(Unknown Source)
at com.microsoft.jdbc.base.BaseWarnings.get(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getWarnings(Unknown Source)
at org.hibernate.util.JDBCExceptionReporter.logAndClearWarnings(JDBCExceptionReporter.java:22)
at org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:443)
at org.hibernate.jdbc.ConnectionManager.aggressiveRelease(ConnectionManager.java:400)
at org.hibernate.jdbc.ConnectionManager.afterTransaction(ConnectionManager.java:287)
at org.hibernate.jdbc.JDBCContext.afterTransactionCompletion(JDBCContext.java:221)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:119)
at co.id.hanoman.btnmw.spp.dao.TagihanDao.save(TagihanDao.java:43)
at co.id.hanoman.btnmw.spp.dao.TagihanDao.save(TagihanDao.java:1)
at co.id.hanoman.btnmw.spp.dao.test.TagihanDaoTest.testSave(TagihanDaoTest.java:81)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
我的hibernate初始化日志是:
2010-04-26 22:54:05,203 INFO [Version] Hibernate Annotations 3.3.0.GA
2010-04-26 22:54:05,234 INFO [Environment] Hibernate 3.2.1
2010-04-26 22:54:05,234 INFO [Environment] hibernate.properties not found
2010-04-26 22:54:05,234 INFO [Environment] Bytecode provider name : cglib
2010-04-26 22:54:05,234 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
2010-04-26 22:54:05,343 INFO [Configuration] configuring from resource: /hibernate.cfg.xml
2010-04-26 22:54:05,343 INFO [Configuration] Configuration resource: /hibernate.cfg.xml
2010-04-26 22:54:05,406 DEBUG [DTDEntityResolver] trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
2010-04-26 22:54:05,406 DEBUG [DTDEntityResolver] recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
2010-04-26 22:54:05,406 DEBUG [DTDEntityResolver] located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
2010-04-26 22:54:05,453 DEBUG [Configuration] hibernate.dialect=org.hibernate.dialect.SQLServerDialect
2010-04-26 22:54:05,453 DEBUG [Configuration] hibernate.connection.driver_class=com.microsoft.jdbc.sqlserver.SQLServerDriver
2010-04-26 22:54:05,453 DEBUG [Configuration] hibernate.connection.url=jdbc:microsoft:sqlserver://12.56.11.65:1433;databaseName=BTN_SPP_DB
2010-04-26 22:54:05,453 DEBUG [Configuration] hibernate.connection.username=spp
2010-04-26 22:54:05,453 DEBUG [Configuration] hibernate.connection.password=spp
答案 0 :(得分:1)
This说:
当您用于JM的数据库不是用于访问数据库的sql server帐户的默认数据库时,这是来自MS jdbc驱动程序的正常消息。几乎无视它 - 它完全无害。