oracle装好以后,自带连接代码和jdbc包,可以在oracle安装目录找一下

解决方案 »

  1.   

    给你一个比较先进的连接方法:import java.sql.*;
    import javax.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.jdbc.pool.*;class CCache1
    {
      public static void main (String args [])
           throws SQLException
      {
        OracleConnectionCacheImpl ods = new OracleConnectionCacheImpl();
        ods.setURL("jdbc:oracle:oci8:@");
        ods.setUser("scott");
        ods.setPassword("tiger");     // Set the Max Limit
        ods.setMaxLimit (3);    Connection conn1 = null;
        conn1 = ods.getConnection();
        if (conn1 != null)
          System.out.println("Connection 1 " + " Succeeded!");
        else
          System.out.println("Connection 1 " + " Failed !!!");
         conn1.close();
        ods.close();
      }
    }