|
楼主 |
发表于 2004-12-17 19:07:12
|
显示全部楼层
代码贴上
import java.sql.*;
import java.lang.*;
public class TestMysql {
public TestMysql() {
}
public static void main(String[] args) throws Exception{
Connection conn=null;
Statement stmt;
ResultSet rs;
javax.sql.ConnectionEvent cn;
String sql="select * from user";
//Class.forName("com.mysql.jdbc.Driver").newInstance();
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
conn=DriverManager.getConnection(
"jdbc:mysql://nsc:3306/mysql",
"root",
"771023");
stmt=conn.createStatement();
rs=stmt.executeQuery(sql);
rs.close();
stmt.close();
conn.close();
}
} |
|