找到点,谁试试,请回个信。1、It uses the JDBC THIN driver: import java.sql.*; DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@dlsun511:1721:dbms733", "scott", "tiger");例如: Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@angel:1521:ang", "w", "wq5464"); 2、It uses jdbc-oci8 driver: import java.sql.*; DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); String url = "jdbc:oracle:oci8:@"; try { String url1 = System.getProperty("JDBC_URL"); if (url1 != null) url = url1; } catch (Exception e) { // If there is any security exception, ignore it and use the default } Connection conn = DriverManager.getConnection (url, "scott", "tiger"); 注意:All the drivers(thin, jdbc-oci and jdbc-kprb) could be used with thin driver just by changing the connect string.
import java.sql.*;
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn =
DriverManager.getConnection ("jdbc:oracle:thin:@dlsun511:1721:dbms733", "scott", "tiger");例如:
Connection conn =
DriverManager.getConnection ("jdbc:oracle:thin:@angel:1521:ang", "w", "wq5464");
2、It uses jdbc-oci8 driver:
import java.sql.*;
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
String url = "jdbc:oracle:oci8:@";
try {
String url1 = System.getProperty("JDBC_URL");
if (url1 != null)
url = url1;
} catch (Exception e) { // If there is any security exception, ignore it and use the default
}
Connection conn =
DriverManager.getConnection (url, "scott", "tiger");
注意:All the drivers(thin, jdbc-oci and jdbc-kprb) could be used with thin driver just by changing the connect string.