String serverName = "127.0.0.1";
String portNumber = "1521";
String sid = "database";
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
String username = "scott";
String password = "tiger";
connection = DriverManager.getConnection(url, username, password);
无法连接到数据库
答案 0 :(得分:2)
所有连接字符串网站的母亲:http://www.connectionstrings.com/oracle
答案 1 :(得分:0)
假设你的问题是“这张图片有什么问题”,你可能忽略了在类路径中包含JDBC JAR Driver吗?