我们使用jtds的SQL Server的驱动替代原来的SQL Server的驱动。后来出现在log中输出了这样的信息:
2005-06-30 09:42:10 [org.hibernate.util.JDBCExceptionReporter] [http-8080-Processor24] [WARN] - SQL Warning: 5701, SQLState: 01000
2005-06-30 09:42:10 [org.hibernate.util.JDBCExceptionReporter] [http-8080-Processor24] [WARN] - 已将数据库上下文改为 'logistics'。
2005-06-30 09:42:10 [org.hibernate.util.JDBCExceptionReporter] [http-8080-Processor24] [WARN] - SQL Warning: 5703, SQLState: 01000
2005-06-30 09:42:10 [org.hibernate.util.JDBCExceptionReporter] [http-8080-Processor24] [WARN] - 已将语言设置改为 简体中文。
经过使用Debug级别的log输出,发现是在
SQLDiagnostic.java
/**
* Create a dianostic SQLException or SQLWarning.
*
* @param number SQL Server error number.
* @param state SQL Server state code.
* @param serverity SQL Server serverity > 10 = error.
* @param message SQL Server error message text.
* @param server SQL Server name.
* @param procName SQL Server stored procedure name.
* @param line SQL Server error line number in SQL source.
*/
void addDiagnostic(int number,
int state,
int serverity,
String message,
String server,
String procName,
int line)
这里捕获了 SQL Server error number的,
后经过MSDN找到如下资料:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/trblsql/tr_reslsyserr_2_9dtd.asp
Error 5701
Severity Level 10
Message Text
Changed database context to '%.*ls'.
Explanation
This is an informational message indicating that the database context has changed. This message is returned anytime a USE database statement is executed.
Action
None needed.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbcsql/od_6_010_34oj.asp
5701
Indicates that SQL Server put the user's context into the default database defined in the data source, or into the default database defined for the login ID used in the connection if the data source did not have a default database.
5703
Indicates the language being used on the server.