连接数据库Oracle,MySQL

oracle

Class.forName("oracle.jdbc.driver.OracleDriver");

String url="jdbc:oracle:thin:@127.0.0.1:1521:orcl";

String user="scott";

String password="tiger";

con= DriverManager.getConnection(url,user,password);

st=con.createStatement();

  

 

 

 

mysql:

Class.forName("com.mysql.jdbc.Driver");

String url="jdbc:mysql://127.0.0.1:3306/test";

String user="root";

String pwd="root";

你可能感兴趣的:(oracle,数据库,mysql,String,jdbc,user)