Java 错误:在AWS RDS上找不到适合数据库的驱动程序
我的代码如下,我在AWS RDS上有一个MySQL数据库。我已经在构建路径中包含了mysql-connector-java-5.1.31-bin.jar。 我的代码如下:Java 错误:在AWS RDS上找不到适合数据库的驱动程序,java,mysql,jdbc,connection,amazon-rds,Java,Mysql,Jdbc,Connection,Amazon Rds,我的代码如下,我在AWS RDS上有一个MySQL数据库。我已经在构建路径中包含了mysql-connector-java-5.1.31-bin.jar。 我的代码如下: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional/
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="java.sql.*"%>
<%@ page import="java.util.Scanner "%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Welcome Customer to Online Mall</title>
</head>
<body>
<%
final String host = "jdbc:mysql://mySqlPath/ShopSystem";
final String uName = "myusername";
final String uPass = "mypassword";
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
//@SuppressWarnings("resource")
Scanner sc = new Scanner(System.in);
String Cust_address, Cust_email, Cust_contact;
Connection con = DriverManager.getConnection( host, uName, uPass );
//View all shops
Statement stmt5 = con.createStatement();
ResultSet rs2 = stmt5.executeQuery("SELECT * FROM ShopSystem.Shop");
while(rs2.next())
{
System.out.print("s_id = "+rs2.getInt(1)+"\t");
System.out.print("s_name = "+rs2.getString(4)+"\t");
System.out.print("s_location = "+rs2.getString(3)+"\t");
System.out.println();
}
sc.close();
}
catch(SQLException err)
{
System.out.println(err.getMessage());
}
%>
</body>
</html>
请帮忙
提前谢谢。您的这一行似乎不正确
final String host = "jdbc:mysql://mySqlPath/ShopSystem";
应该是这样的:
jdbc:mysql://localhost/ShopSystem
或
你的这一行似乎不正确
final String host = "jdbc:mysql://mySqlPath/ShopSystem";
应该是这样的:
jdbc:mysql://localhost/ShopSystem
或