🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.lang.java
Article #11937

Re: 请教怎么配置jdbc的驱动?

#11937
From: mark zhong
Date: Mon, 23 Aug 2004 02:57
48 lines
2919 bytes
������÷���ʹ��mssql
�Ұ�Java wrote:

> ���ھ����������Ҳ�����������£�����ֻ�÷�����̴���ˡ�
> 
> ������ݿ����ӵ�ʱ��������ʾ��ClassNotFoundException:com.microsoft.sqlserver.
>                                                       SQLServerDriver
> ����Ӧ������Ϊû�����ú����ԭ��ģ��ҵ�Դ����ֻ��һ���ܼ򵥵IJ��Գ���
> import java.sql.*;
> import java.text.DateFormat;
> 
> 
> public class Connectbase {
>     public static void main(String[] args ) {
>         String jdbcDriver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
>         String dbURL = 
> "jdbc:microsoft:sqlserver://127.0.0.1:1433;DataBaseName = warehouse";
>         Connection dbConn = null;
>         try {
>             Class.forName(jdbcDriver).newInstance();
>             dbConn = DriverManager.getConnection(dbURL);
>             Statement stmt = dbConn.createStatement();
>             
>             ResultSet rs = stmt.executeQuery("select * from Product"); 
>             
>             while(rs.next()) {
>                 System.out.println(rs.getString(1));
>             }
>         } catch (Exception e) {
>             e.printStackTrace();
>         } finally {
>             try {               
>                 if (dbConn != null) {
>                     dbConn.close();
>                 }
>             } catch (Exception e1) {
>                 e1.printStackTrace();
>             }
>         }
>     }
> }
> 
> �Dz���������⣿�������ô��ģ��һ��Dz����ף�
> 
> Thx
>      
> --
> �� ��Դ:����ˮ˼Դ bbs.sjtu.edu.cn��[FROM: 202.192.159.41]
Technical Details
Message-ID: <cgbmg0$6vp$2@news.yaako.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!cyclone.bc.net!sjc1.usenetserver.com!news.usenetserver.com!news.bylinux.net!news.cn99.com!news.yaako.com!not-for-mail
References: <4DibRS$9yT@bbs.sjtu.edu.cn>

Show Full Headers
Complete Article Headers
X-Google-Thread: f6cb0,f8788beb234b20b0
X-Google-Attributes: gidf6cb0,public
X-Google-Language: Chinese,GB
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!cyclone.bc.net!sjc1.usenetserver.com!news.usenetserver.com!news.bylinux.net!news.cn99.com!news.yaako.com!not-for-mail
From: mark zhong <sodawater@spymac.com>
Newsgroups: cn.bbs.comp.lang.java
Subject: Re: 请教怎么配置jdbc的驱动?
Date: Mon, 23 Aug 2004 02:57:17 +0000
Organization: Bentium Ltd. (CN99)
Lines: 48
Message-ID: <cgbmg0$6vp$2@news.yaako.com>
References: <4DibRS$9yT@bbs.sjtu.edu.cn>
NNTP-Posting-Host: 218.88.36.182
Mime-Version: 1.0
Content-Type: text/plain; charset=GB2312
Content-Transfer-Encoding: 8bit
X-Trace: news.yaako.com 1093229888 7161 218.88.36.182 (23 Aug 2004 02:58:08 GMT)
X-Complaints-To: usenet@news.yaako.com
NNTP-Posting-Date: Mon, 23 Aug 2004 02:58:08 +0000 (UTC)
User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502)
X-Accept-Language: en
In-Reply-To: <4DibRS$9yT@bbs.sjtu.edu.cn>