Article View: cn.bbs.comp.lang.java
Article #11803�ʸ�mysql��jdbc���⣡
From: Joe
Date: Thu, 26 Aug 2004 11:58
Date: Thu, 26 Aug 2004 11:58
37 lines
1798 bytes
1798 bytes
��д��һ��������ݿ�ij���:
import java.sql.*;
public class conn{
public static void main(String agrs[]){
String drive="org.gjt.mm.mysql.Driver";
String url="jdbc:mysql://202.118.13.128:3306/jxgl";
String user="wanzy";
String password="wanzy";
try{
Class.forName(drive);
}
catch(Exception e){
System.out.println("�����������:"+drive);
}
try{
Connection con=DriverManager.getConnection(url,user,password);
if(!con.isClosed()){
System.out.println("��ݿ����ӳɹ�!");
con.close();
}
else
System.out.println("close!");
}
catch(SQLException e){
System.out.println("��ݿ�����ʧ��!");
e.printStackTrace();
}
}
}
���е�ʱ���Ĵ�����ʾ�ǣ�
java.sql.SQLException:can not load connect class
��ʾ��ݿ����Ӳ��ɹ���
��ô�İ���������ָ�㣬лл����
--
[m[32m�� ��Դ:����ɽ��ˮվ http://bbs.neu.edu.cn��[FROM: 202.118.13.128][m
Technical Details
Message-ID:
<4DlgY7$Dbp@bbs.neu.edu.cn>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsfeed.media.kyoto-u.ac.jp!news.neu.edu.cn!NEUShow Full Headers
Complete Article Headers
X-Google-Thread: f6cb0,975d9b497e40e0d4,start X-Google-Attributes: gidf6cb0,public X-Google-Language: ENGLISH,GB Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsfeed.media.kyoto-u.ac.jp!news.neu.edu.cn!NEU From: eboy24@bbs.neu.edu.cn (Joe) Newsgroups: cn.bbs.comp.lang.java Subject: �ʸ�mysql��jdbc���⣡ Date: 26 Aug 2004 11:58:32 GMT Organization: ��ɽ��ˮ Message-ID: <4DlgY7$Dbp@bbs.neu.edu.cn> Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 8bit X-Filename: java/M.1093521511.40 Lines: 37