JDBC Oracle
2018-01-09 19:11 更新
JDBC教程 - JDBC Oracle
例子...
例子
import java.sql.Connection;
import java.sql.DriverManager;
/*w ww.j a va2 s . c om*/
public class Main {
public static void main(String[] argv) throws Exception {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection connection = DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:databaseName", "username",
"password");
if (connection != null) {
System.out.println("Connected");
} else {
System.out.println("Failed to make connection!");
}
}
}
以上内容是否对您有帮助:

免费 AI IDE


更多建议: