`
- 浏览:
90899 次
- 性别:
- 来自:
北京
-
异常:

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]将截断字符串或二进制数据。
分享到:
Global site tag (gtag.js) - Google Analytics
相关推荐
### C#与SQL连接方法总结 #### 一、引言 在现代软件开发中,C#作为一种广泛使用的编程语言,经常被用来开发各种类型的应用程序,包括但不限于桌面应用、Web应用以及服务端应用等。而在这些应用中,与数据库进行...
【在Eclipse中使用JDBC连接SQL Server 2005的步骤详解】 要使用Java的JDBC(Java Database Connectivity)在Eclipse中...这只是一个简单的示例,实际应用中还需要考虑异常处理、连接池管理、SQL语句的执行等更多细节。
JDBC(Java Database Connectivity)是Java编程语言中用于...在实际开发中,可能还需要处理异常,使用连接池优化性能,以及实现事务管理等高级特性。理解并熟练掌握这些知识,将使你在Java数据库编程方面更加得心应手。
总结起来,解决WinCC flexible 2008与SQL服务器连接问题的关键在于确认SQL Server的状态、更新软件和修复损坏的数据。在进行任何操作之前,确保备份重要的数据,并遵循正确的顺序进行,以避免进一步的故障。同时,...
### SQL Server 数据库连接与ADO应用详解 #### 一、引言 在现代软件开发过程中,数据处理是一项至关重要的任务。Microsoft SQL Server作为一款广泛使用的数据库管理系统,在企业级应用中扮演着重要角色。ADO...
### 如何使用C语言连接SQL数据库 在计算机编程领域中,使用C语言连接SQL数据库是一项基本而重要的技能,尤其对于初级和中级学习者而言。本文将详细介绍如何利用C语言进行数据库连接与简单查询操作,帮助读者更好地...
本文将深入探讨如何使用Java语言连接到SQL Server数据库,总结关键知识点,并提供详细说明。 首先,要建立Java与SQL Server之间的连接,我们需要使用JDBC(Java Database Connectivity),这是Java平台的一个标准...
根据给定的文件信息,我们可以总结出以下关于“VC连接SQL Server”的相关知识点: ### 1. 使用VC++连接SQL Server的基本步骤 在VC++环境下连接SQL Server通常涉及到以下几个主要步骤: - **初始化COM库**:通过...
根据提供的文件信息,我们可以总结出以下关于使用 C++ 连接 SQL Server 数据库的相关知识点: ### 1. 引入必要的头文件 在程序开头,作者引入了几个关键的头文件,包括 `icrsint.h`(可能是某种特定于系统的头文件...
总结,SQL Server连接字符串构造及测试工具是VS2010开发环境中实用的辅助工具,能有效提升开发效率,确保数据库连接的稳定性和安全性。正确理解和使用连接字符串是每个SQL Server开发者必须掌握的基础技能。
根据提供的文件信息,本文将详细解释如何在Delphi中测试连接到SQL Server数据库,并解析代码中的关键步骤与概念。 ### Delphi 连接 SQL Server 数据库 #### 一、Delphi简介 Delphi 是一种基于 Object Pascal 的...
总结来说,这个JSP程序展示了如何使用JSP和JDBC API连接到SQL Server 2000数据库,执行SQL查询并显示结果。在实际开发中,为了提高性能和安全性,应考虑使用PreparedStatement代替Statement,以及关闭数据库连接和...
根据提供的文件信息,本文将详细解释Java连接SQL Server数据库的过程及相关的知识点,包括代码解析、异常处理、数据库连接原理等内容。 ### Java连接SQL Server数据库详解 #### 一、概述 在进行Java应用开发时,...
### VS2008与SQL Server的连接方法详解 在软件开发过程中,经常需要将Visual Studio(以下简称VS)与数据库进行连接,以便于数据的读取、写入等操作。本文将详细介绍如何在VS2008环境中实现与SQL Server数据库的...
总结起来,Java连接SQL Server 2005主要涉及两个步骤:一是确保`sqljdbc.jar`驱动在类路径中,二是构建正确的连接字符串并使用`DriverManager.getConnection()`方法创建连接。理解这些基础,将有助于你成功地在Java...
### Java连接SQL Server 2005的知识点详解 #### 一、概述 在Java开发中,经常需要与各种数据库进行交互,其中SQL Server作为一款广泛使用的数据库管理系统,其与Java程序的集成变得尤为重要。本篇文章将基于一个...
### JDBC 连接 SQL Server 数据库详解 #### 一、引言 在现代软件开发过程中,Java 应用程序与数据库之间的交互是非常常见的场景之一。Java Database Connectivity (JDBC) 是 Java 中一种用于执行 SQL 语句的标准 ...
### VC++连接SQL Server 2008:深入解析与实践指南 在IT领域,特别是软件开发中,数据库操作是一项核心技能。对于使用VC++进行应用程序开发的技术人员而言,掌握如何连接并操作SQL Server数据库至关重要。本文将...
总结来说,Java连接SQL Server需要JDBC驱动,如压缩包中的msbase.jar、mssqlserver.jar和msutil.jar,它们提供了与SQL Server交互的必要功能。通过正确配置和使用这些驱动,开发者可以在Java应用程序中高效地执行SQL...