我們使用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.