易截截图软件、单文件、免安装、纯绿色、仅160KB

SQL Server 2005 Driver for JDBC


Load the SQL Server 2005 Driver for JDBC before you load the SQL Server 2000 Driver for JDBC. To do this, use the DriverManager class as in the following code example.
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); // 2005 version
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); // 2000 version
Use a SQL Server 2005 Driver for JDBC connection URL to establish a connection. To do this, use code that resembles the following code example.
Connection con = DriverManager.getConnection("jdbc:sqlserver://<ServerName>;user=<UserName>;password=<Password>");
For more information about how to connect with data sources and how to use a connection URL, visit the following Microsoft Developer Network (MSDN) Web sites:
Building the connection URL
http://msdn2.microsoft.com/en-us/library/ms378428.aspx (http://msdn2.microsoft.com/en-us/library/ms378428.aspx)
Setting the connection properties
http://msdn2.microsoft.com/en-us/library/ms378988.aspx (http://msdn2.microsoft.com/en-us/library/ms378988.aspx)
The SQL Server 2000 JDBC driver accepts connection URLs from the SQL Server 2005 JDBC Driver. The SQL Server 2005 JDBC Driver connection string URLs start with the following string:
jdbc:sqlserver://ConnectionString
The SQL Server 2000 Driver for JDBC should only accept connection string URLs that start with the following string:
jdbc:microsoft:sqlserver://ConnectionString
However, the SQL Server 2000 Driver for JDBC also accepts connections that have the following format:
jdbc:sqlserver://ConnectionString
The exception occurs because the SQL Server 2000 Driver for JDBC is not designed to connect to a SQL Server 2005 database.


相关文档:

SQL 2000和2005 树形递归法小汇总 收藏

--测试数据
if OBJECT_ID('tb') is not null
drop table tb
go
CREATE TABLE tb(ID char(3),PID char(3),Name nvarchar(10))
INSERT tb SELECT '001',NULL ,'山东省'
UNION ALL SELECT '002','001','烟台市'
UNION ALL SELECT '004','002','招远市'
UNION ALL SELECT '003','001','青岛市'
UNION ALL SELECT '00 ......

SQL*PLUS中函数

创建函数
CREATE OR REPLACE FUNCTION ntfuc(inp IN NUMBER)
RETURN NUMBER
IS
ntmp NUMBER;
BEGIN
ntmp := inp;
RETURN ntmp;
END ntfuc;
/
执行该函数时
DECLARE
rcn NUMBER;
BEGIN
rcn := ntfunc(1);
END;
/ ......

sql附加数据库只读问题

在SQL Server 2005 Express 上附加从另外一台电脑Copy过来的数据库后,数据库为“只读”。 
解决办法:
打开 SQL Server Configuration Manager, 打开SQL Server SQLEXPRESS 的属性
在内置帐号处,把“网络服务”改成“本地系统”,重新启动SQL Server 2005 Express 后,再附加数据 ......

VC++的ADO连接SQL Server步骤

 1:SQL  Server数据库配置
 
 
 
开启服务器
 
 
托盘显示服务器启动
 
 
 
2:在StaAfx.h 中添加如下代码
#import "C:\\Program Files\\Common Files\\System\\ado\\msado15.dll" no_namespace      rename("EOF","adoEOF")rena ......

SQL语言基础

SQL:Structured Query Language,1974年Boyce和Chamberlin提出.
数据定义 :CREATE,DROP
数据库查询:SELECT
数据操纵 :INSERT,UPDATE,DELETE
数据控制 :GRANT,REVOKE
一.数据的定义和修改:
1.定义基表
CREATE TABLE 表名 (<列名1 类型[NOT NULL][,列名2 类型[NOT NULL]>…[其他参数]);
关于类型:
INTEGE ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号