日期:2014-05-20  浏览次数:20730 次

java.sql.SQLWarning: [Microsoft][SQLServer 2000 Driver for JDBC]Database changed to master这是什么警告?
java.sql.SQLWarning: [Microsoft][SQLServer 2000 Driver for JDBC]Database changed to master
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:325)
at org.hibernate.jdbc.ConnectionManager.cleanup(ConnectionManager.java:262)
at org.hibernate.jdbc.ConnectionManager.close(ConnectionManager.java:194)
at org.hibernate.impl.SessionImpl.close(SessionImpl.java:289)
at org.springframework.orm.hibernate3.SessionFactoryUtils.doClose(SessionFactoryUtils.java:787)
at org.springframework.orm.hibernate3.SessionFactoryUtils.closeSessionOrRegisterDeferredClose(SessionFactoryUtils.java:775)
at org.springframework.orm.hibernate3.SessionFactoryUtils.releaseSession(SessionFactoryUtils.java:748)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCleanupAfterCompletion(HibernateTransactionManager.java:662)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:919)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:712)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:632)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:314)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:117)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:630)
at xxx.xxx.model.ModelDaoImp$$EnhancerByCGLIB$$5797790b.save(<generated>)
at xxx.xxx.service.NewsServiceImp.save(NewsServiceImp.java:23)
at xxx.xxx.demo.Test.main(Test.java:27)
这是机子报的异常请问是怎么回事?

------解决方案--------------------
http://blog.csdn.net/nearsun/archive/2005/02/23/298492.aspx

把连接数据库的用户的默认数据库改成你的数据库就可以了,在建立数据源(好像是计算机管理那里)的时候可以改的
------解决方案--------------------
当你在数据库中创建用户的时候,下面有个默认数据库设置,如果这里没有设置成你要访问的数据库,而在你的程序中用该用户访问了该数据库

就出现提示,只是有个提示,不会有影响
------解决方案--------------------
不清楚,你的数据库连接一块的代码是什么?
------解决方案--------------------
]Database changed to master 

你连接的是master数据库?再贴一下你的hibernate.cfg.xml代码
------解决方案--------------------
hibernate.cfg.xml代码<hibernate-configuration>

<session-factory>
<property name="connection.username">sa</property>
<property name="connection.url">
jdbc:microsoft:sqlserver://127.0.0.1:1433
</property>
<property name="dialect">
org.hibernate.dialect.SQLServerDialect
</property>
<property name="myeclipse.connection.profile">ssdw</property>
<property name="hibernate.show_sql">true</property>
<property name="connection.password">sa</property>
<property name="connection.driver_class">
com.microsoft.jdbc.sqlserver.SQLServerDriver