Class.forName( " org.gjt.mm.mysql.Driver "
);
Connection conn = DriverManager.getConnection( " jdbc:mysql://MyDbComputerNameOrIP:3306/myDatabaseName " , sUsr, sPwd );
Connection conn = DriverManager.getConnection( " jdbc:mysql://MyDbComputerNameOrIP:3306/myDatabaseName " , sUsr, sPwd );
2.Microsoft SQLServer
Class.forName( " com.microsoft.jdbc.sqlserver.SQLServerDriver "
);
Connection conn = DriverManager.getConnection( " jdbc:microsoft:sqlserver://MyDbComputerNameOrIP:1433;databaseName=master " , sUsr, sPwd );
Connection conn = DriverManager.getConnection( " jdbc:microsoft:sqlserver://MyDbComputerNameOrIP:1433;databaseName=master " , sUsr, sPwd );
3.Oracle
Class.forName( " oracle.jdbc.driver.OracleDriver "
);
Connection conn = DriverManager.getConnection( " jdbc:oracle:thin:@MyDbComputerNameOrIP:1521:ORCL " , sUsr, sPwd );
Connection conn = DriverManager.getConnection( " jdbc:oracle:thin:@MyDbComputerNameOrIP:1521:ORCL " , sUsr, sPwd );
4.DB2
Class.forName( " com.ibm.db2.jdbc.net.DB2Driver "
);
String url = " jdbc:db2://192.9.200.108:6789/SAMPLE "
Connection conn = DriverManager.getConnection( url, sUsr, sPwd );
String url = " jdbc:db2://192.9.200.108:6789/SAMPLE "
Connection conn = DriverManager.getConnection( url, sUsr, sPwd );
5.ODBC
Class.forName( " sun.jdbc.odbc.JdbcOdbcDriver "
);
Connection conn = DriverManager.getConnection( " jdbc:odbc: " + sDsn, sUsr, sPwd );
Connection conn = DriverManager.getConnection( " jdbc:odbc: " + sDsn, sUsr, sPwd );
6.PostgreSQL
Class.forName( " org.postgresql.Driver "
);
Connection conn = DriverManager.getConnection( " jdbc:postgresql://MyDbComputerNameOrIP/myDatabaseName " , sUsr, sPwd );
Connection conn = DriverManager.getConnection( " jdbc:postgresql://MyDbComputerNameOrIP/myDatabaseName " , sUsr, sPwd );