有人可以告诉我给定mySql语句的等效oracle语句:
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/city?user=root&password=root");
答案 0 :(得分:3)
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection connection =
DriverManager.getConnection
("jdbc:oracle:thin:@localhost:1521:MySID","username","password");
如果您使用:
(jdbc:oracle:thin:@localhost:1521:MySID
) - 之后,则需要SID名称。
如果您使用/
(jdbc:oracle:thin:@localhost:1521/MySERVICE
) - 预计服务名称