ojdbc 驱动正常加载测试

1.确保自己的oracle服务正常运行
2.保证class12.jar,oracle的驱动是否正常加载(放在路径下)
Class.forName ("oracle.jdbc.driver.OracleDriver");//确保该驱动正确加载
Connection conn = DriverManager.getConnection
      ("jdbc:oracle:thin:@ip address:1521:ORA1", "scott", "tiger");
      Statement stmt = conn.createStatement();
      ResultSet rset = stmt.executeQuery (
      "select BANNER from SYS.V_$VERSION"
      );
如果驱动包没有问题,能正常访问。

 

你可能感兴趣的:(jdbc)