java连接oracle

try{
        Class.forName("oracle.jdbc.driver.OracleDriver");
      }
      catch(java.lang.ClassNotFoundException e)
      {
        System.err.print(e.getMessage());
      }
      try{
      String url="jdbc:oracle:thin:@"+getip+":1521:"+getname;
      Connection conn=DriverManager.getConnection(url,"nmbmjj","bmjj");
      System.out.println("连接成功");
   }
   catch(SQLException f){f.getMessage();}

你可能感兴趣的:(java,oracle,String,jdbc,url)