Oracle8/8i/9i/10g数据库(thin模式)
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@localhost:1521:orcl";
String user="test";
String password="test";
Connection conn= DriverManager.getConnection(url,user,password);
Sql Server7.0/2000数据库
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb";
String user="sa";
String password="";
Connection conn= DriverManager.getConnection(url,user,password);
Sql Server2005数据库
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
String url="jdbc:sqlserver://localhost:1433;DatabaseName=mydb";
String user="sa";
String password="";
Connection conn= DriverManager.getConnection(url,user,password);
MySQL数据库
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
String url ="jdbc:mysql://localhost/myDB?user=soft&password=soft1234&useUnicode=true&characterEncoding=8859_1"
Connection conn= DriverManager.getConnection(url);