JDBC连接Oracle

Class.forName("oracle.jdbc.driver.OracleDriver").newInstance(); //此处的Class可以理解为类装载器

//new oracle.jdbc.driver.OracleDriver();

String url = "jdbc:oracle:thin:192.168.1.102:1521";

String user = "scott"; String password = "a1234";

Connection conn = DriverManager.getConnection(url, user, password);

System.out.println(conn.isClosed());

需要开启的服务------ OracleServiceORCL OracleOraDb10g_home1TNSListener OracleOraDb10g_home1iSQL*Plus OracleJobSchedulerORCL OracleDBConsoleorcl

需要注意的是:String url = "jdbc:oracle:thin:192.168.1.102:1521"; 在地址前面是没有@的

你可能感兴趣的:(oracle)