数据库 连接代码
MySQL Class.for.Name("com.mysql.jdbc.Driver");
Connection conn=DriverManager.getConnection(
"jdbc:mysql://dbServerIP:3306/dbName",user,password);
PostgreSQL Class.for.Name("org.postgresql.Driver");
Connection conn=DriverManager.getConnection(
"jdbc:postgresql://dbServerIP/dbName",user,password);
Oracle Class.for.Name("oracle.jdbc.driver.OracleDriver");
Connection conn=DriverManager.getConnection(
"jdbc:oracle:thin:@dbServerIP:1521:ORCL",user,password);
SQL Server Class.for.Name("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection conn=DriverManager.getConnection(
"jdbc:microsoft:sqlserver://dbServerIP:1433;databaseName=master,user,p assword");
ODBC Class.for.Name("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection(
"jdbc:odbc:DSNname",user,password);
DB2 Class.for.Name("com.ibm.db2.jdbc.net.DB2Driver");
Connection conn=DriverManager.getConnection(
"jdbc:db2://dbServerIP:6789/dbName",user,password);
Sybase Class.for.Name("com.sybase.jdbc2.jdbc.SybDriver");
Connection conn=DriverManager.getConnection(
"jdbc:sybase:Tds:dbServerIP:2638",user,password);
MySQL Class.for.Name("com.mysql.jdbc.Driver");
Connection conn=DriverManager.getConnection(
"jdbc:mysql://dbServerIP:3306/dbName",user,password);
PostgreSQL Class.for.Name("org.postgresql.Driver");
Connection conn=DriverManager.getConnection(
"jdbc:postgresql://dbServerIP/dbName",user,password);
Oracle Class.for.Name("oracle.jdbc.driver.OracleDriver");
Connection conn=DriverManager.getConnection(
"jdbc:oracle:thin:@dbServerIP:1521:ORCL",user,password);
SQL Server Class.for.Name("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection conn=DriverManager.getConnection(
"jdbc:microsoft:sqlserver://dbServerIP:1433;databaseName=master,user,p assword");
ODBC Class.for.Name("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection(
"jdbc:odbc:DSNname",user,password);
DB2 Class.for.Name("com.ibm.db2.jdbc.net.DB2Driver");
Connection conn=DriverManager.getConnection(
"jdbc:db2://dbServerIP:6789/dbName",user,password);
Sybase Class.for.Name("com.sybase.jdbc2.jdbc.SybDriver");
Connection conn=DriverManager.getConnection(
"jdbc:sybase:Tds:dbServerIP:2638",user,password);