JAVA连接SQL2008Microsoft SQL Server JDBC Driver 2.0.sqljdbc2.0驱动
很小大概就4M,解压后里面有2个Jar包,sqljdbc4.jar和sqljdbc.jar,这两个都一样,只是针对你的JDK的版本的不同,如果你是JDK6.0直接导入sqljdbc4.jar,以下版本的导入sqljdbc.jar,如果怕麻烦的,两个都导进去也行。
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-01-14 15:12 Microsoft SQL Server JDBC Driver 2.0
目录 0 2013-01-14 15:12 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0
目录 0 2013-01-14 15:12 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chs
目录 0 2013-01-14 15:12 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chsauth
目录 0 2013-01-14 15:12 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chsauthIA64
文件 172368 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chsauthIA64sqljdbc_auth.dll
目录 0 2013-01-14 15:12 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chsauthx64
文件 86336 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chsauthx64sqljdbc_auth.dll
目录 0 2013-01-14 15:12 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chsauthx86
文件 68928 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chsauthx86sqljdbc_auth.dll
目录 0 2013-01-14 15:12 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelp
文件 547 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelpdefault.htm
目录 0 2013-01-14 15:12 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml
文件 7131 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 041f9e1-09b6-4487-b052-afd636c8e89a.htm
文件 11289 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 0f9e25a-088e-4ac6-aa75-43eacace8f03.htm
文件 3935 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 18cd71b-4b58-49a7-990e-d28dbb12da70.htm
文件 3746 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 23a238b-37f2-4966-bc91-ef2b22aebc46.htm
文件 3074 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 27edab7-9b5c-4f5f-9469-fe00cf7798b6.htm
文件 3839 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 28b8d61-9557-4c9f-b732-29e87a962de8.htm
文件 3908 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 2c2443d-44e1-4f16-a0d5-08d197838214.htm
文件 3517 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 30ad599-0431-4242-9428-e9ead7b75b1d.htm
文件 3744 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 330ca1d-5e24-4ce3-9d2a-b931f20a0fcf.htm
文件 2492 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 3649d56-3319-4867-bef1-559dfd221b8b.htm
文件 22042 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 4178645-915f-4569-8907-d45e299bbe7d.htm
文件 3956 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 48fe245-157f-4fd8-be75-ce54b83e02b3.htm
文件 6661 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 4cf56ad-11a8-4ae5-a612-39f3f8680501.htm
文件 4445 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 4d36a25-7f95-4675-9690-4462671b3d67.htm
文件 3346 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 4ea83b2-db5e-4b46-b016-9e496363827e.htm
文件 3145 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 4eebd6a-016f-4462-82f5-ab34b945eec4.htm
文件 6559 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 50548ca-c708-4224-8014-8b7830a860dd.htm
文件 3597 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 53549ee-2018-47ab-9538-789dac2b150a.htm
............此处省略1181个文件信息
/*=====================================================================
File: executeStoredProcedure.java
Summary: This Microsoft SQL Server JDBC Driver sample application
demonstrates how to retrieve a large OUT parameter from
a stored procedure and how to get the adaptive buffering mode.
---------------------------------------------------------------------
This file is part of the Microsoft SQL Server JDBC Driver Code Samples.
Copyright (C) Microsoft Corporation. All rights reserved.
This source code is intended only as a supplement to Microsoft
Development Tools and/or on-line documentation. See these other
materials for detailed information regarding Microsoft code samples.
THIS CODE AND INFORMATION ARE PROVIDED “AS IS“ WITHOUT WARRANTY OF
ANY KIND EITHER EXPRESSED OR IMPLIED INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
=====================================================================*/
import java.sql.*;
import java.io.*;
import com.microsoft.sqlserver.jdbc.SQLServerCallableStatement;
public class executeStoredProcedure {
public static void main(String[] args) {
// Create a variable for the connection string.
String connectionUrl =
“jdbc:sqlserver://localhost:1433;“ +
“databaseName=AdventureWorks;integratedSecurity=true;“;
// Declare the JDBC objects.
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try {
// Establish the connection.
Class.forName(“com.microsoft.sqlserver.jdbc.SQLServerDriver“);
con = DriverManager.getConnection(connectionUrl);
// Create test data as an example.
StringBuffer buffer = new StringBuffer(4000);
for (int i = 0; i < 4000; i++)
buffer.append( (char) (‘A‘));
PreparedStatement pstmt = con.prepareStatement(
“UPDATE Production.Document “ +
“SET DocumentSummary = ? WHERE (DocumentID = 1)“);
pstmt.setString(1 buffer.toString());
pstmt.executeUpdate();
pstmt.close();
// Query test data by using a stored procedure.
CallableStatement cstmt =
con.prepareCall(“{call dbo.GetLargeDataValue(? ? ? ?)}“);
cstmt.setInt(1 1);
cstmt.registerOutParameter(2 java.sql.Types.INTEGER);
cstmt.registerOutParameter(3 java.sql.Types.CHAR);
cstmt.registerOutParameter(4 java.sql.Types.LONGVARCHAR);
// Display the response buffering mode.
SQLServerCallableStatement SQLcstmt = (SQLServerCallableStatement) cstmt;
System.out.println(“Response buffering mode is: “ +
SQLcstmt.getResponseBuffering());
SQLcstmt.execute();
System.ou
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-01-14 15:12 Microsoft SQL Server JDBC Driver 2.0
目录 0 2013-01-14 15:12 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0
目录 0 2013-01-14 15:12 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chs
目录 0 2013-01-14 15:12 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chsauth
目录 0 2013-01-14 15:12 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chsauthIA64
文件 172368 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chsauthIA64sqljdbc_auth.dll
目录 0 2013-01-14 15:12 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chsauthx64
文件 86336 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chsauthx64sqljdbc_auth.dll
目录 0 2013-01-14 15:12 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chsauthx86
文件 68928 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chsauthx86sqljdbc_auth.dll
目录 0 2013-01-14 15:12 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelp
文件 547 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelpdefault.htm
目录 0 2013-01-14 15:12 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml
文件 7131 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 041f9e1-09b6-4487-b052-afd636c8e89a.htm
文件 11289 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 0f9e25a-088e-4ac6-aa75-43eacace8f03.htm
文件 3935 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 18cd71b-4b58-49a7-990e-d28dbb12da70.htm
文件 3746 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 23a238b-37f2-4966-bc91-ef2b22aebc46.htm
文件 3074 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 27edab7-9b5c-4f5f-9469-fe00cf7798b6.htm
文件 3839 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 28b8d61-9557-4c9f-b732-29e87a962de8.htm
文件 3908 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 2c2443d-44e1-4f16-a0d5-08d197838214.htm
文件 3517 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 30ad599-0431-4242-9428-e9ead7b75b1d.htm
文件 3744 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 330ca1d-5e24-4ce3-9d2a-b931f20a0fcf.htm
文件 2492 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 3649d56-3319-4867-bef1-559dfd221b8b.htm
文件 22042 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 4178645-915f-4569-8907-d45e299bbe7d.htm
文件 3956 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 48fe245-157f-4fd8-be75-ce54b83e02b3.htm
文件 6661 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 4cf56ad-11a8-4ae5-a612-39f3f8680501.htm
文件 4445 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 4d36a25-7f95-4675-9690-4462671b3d67.htm
文件 3346 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 4ea83b2-db5e-4b46-b016-9e496363827e.htm
文件 3145 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 4eebd6a-016f-4462-82f5-ab34b945eec4.htm
文件 6559 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 50548ca-c708-4224-8014-8b7830a860dd.htm
文件 3597 2009-03-09 18:16 Microsoft SQL Server JDBC Driver 2.0sqljdbc_2.0chshelphtml 53549ee-2018-47ab-9538-789dac2b150a.htm
............此处省略1181个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)