異常:

Class.forName(DBDRIVER);
conn = DriverManager.getConnection(DBURL,DBUSERNAME,DBPASSWORD);
stmt = conn.createStatement();
sql = "SELECT name FROM userInformation WHERE id='"+username+"' and password='"+password+"'";
rs = stmt.executeQuery(sql);
if(rs.next())
{
flag = true;
}
rs.close();
stmt.close();
conn.close();

代碼出現類似”[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]對象名 'userInformation’無效。”異常
解決方法:控制臺根目錄\Microsoft SQL Server\SQL Server 組\(local)(Windows NT)\安全性\登陸修改sa賬戶默認數據庫為你使用的數據庫.還可西新建數據庫,選擇默認數據庫為你使用的數據庫


異常:
SQLServer2000默認連接端口為1434端口,有時連接異常時可能是端口被占用的緣故,可以通過修改端口解決,
解決方法:服務器網絡實用工具\常規\啟用協議,選擇TCP/IP屬性修改端口即可,服務器需要重啟.

異常:

jsp頁面中表單提交的中文數據編碼格式要轉換成gb2312后,再插入到數據庫。 String after=new String(before.getBytes("iso-8859-1"),"gb2312"); before為原始中文數據,after是經過轉換后要提交到數據庫里的數據。
異常:
SQLServer 2000中如何設置向Access一樣的ID自動編號
出現異常:SQLServer 缺少列數,列數不匹配
選中ID列,設置數據類項為(int/number)列屬性里設置標識為是,標識種子為1,表示增量為1

異常:
[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]將截斷字符串或二進制數據。
多半是由于段長度大小的問題,你插入的內容的長度大于該字段定義的長度

異常
[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
檢查你的數據庫服務器有沒有開啟,端口是否占用,配置是否正確,其次看看下面的異常處理
"Error establishing socket" exception while connecting to the database
Symptom: while running a windows application that includes massive opening and closing of a connections to database server, "Error establishing socket" exception appears after a short time of execution.
Cause: This problem is caused by a lack of a reusable sockets on client machine, since each TCP/IP connection stays in the TIME_WAIT state when the connection is being closed. While a connection is in this state, the socket cannot be reused.
Resolution: do one of the following:
Increase the port range that is used for anonymous ports to approximately 20,000 ports (for example) by modifying the MaxUserPort registry key (this parameter controls the maximum port number that is used when an application requests any available user port from the system). Windows uses the conventional BSD range of 1024 to 5000 for its anonymous (ephemeral) port range. You can set only the upper bound of the ephemeral port range. To modify the MaxUserPort registry key, follow these steps:
Start Registry Editor (Regedt32.exe). Please note that you should backup your registry and any important files on your computer before editing the registry.
Locate the MaxUserPort key in the registry: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
On the Edit menu, click Add Value, and then add the following registry value:
Value Name: MaxUserPort
Data Type: REG_DWORD
Value: 65534 (for example)
Valid Range: 5000-65534 (decimal)
Default: 0x1388 (5000 decimal)
Quit Registry Editor.
Change the timeout on the connections from 240 seconds (the default) to any length from 30 seconds to 300 seconds. Use the TcpTimedWaitDelay registry parameter to change this value. To do this, start Registry Editor (Regedt32.exe), locate the following key in the registry, and then modify the value HKEY_LOCAL_MACHINE\System\CurrectControlSet\services\Tcpip\Parameters (this parameter determines the length of time that a connection stays in the TIME_WAIT state when the connection is being closed. While a connection is in the TIME_WAIT state, the socket pair cannot be reused. For more information, see RFC 793):
Value Name:TcpTimedWaitDelay
Value Type: REG_DWORD-time in seconds
Valid Range: 30-300 (decimal)
Default: 0xF0 (240 decimal)

異常:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid parameter binding(s).

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]將截斷字符串或二進制數據。

posted on 2007-11-28 18:26
凌晨風 閱讀(1757)
評論(0) 編輯 收藏 所屬分類:
Java學習筆記