找不到合适的驱动程序- Spring mvc
Suitable driver not found- Spring mvc
事先我是 java spring mvc 的初学者。
try{
Connection connection =
DriverManager.getConnection
("jdbc:mysql://localhost/emidwify?user=root&password=root");
Statement statement = connection.createStatement() ;
resultset =statement.executeQuery("SELECT FirstName, LastName FROM childdetails") ;
%>
<div class="div_box">
<select>
<% while(resultset.next()){ %>
<option><%= resultset.getString(2)%></option>
<% } %>
</select>
<div align ="justify">
<button type="button" class="btn btn-success active">View Details</button>
</div>
</div>
<%
}
catch(Exception e)
{
out.println("wrong entry "+e);
}
%>
我试图从名为 emidwify 的数据库中获取下拉选项的数据。但是当我 运行 我在本地主机上的 jsp 文件时,它显示了异常。
wrong entry java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/emidwify?user=root&password=root
谁能帮我解决一下。我无法触发任何东西。
注意:我正在研究 Linux mint。我正在使用 spring java mvc。
我认为 mysql jar 文件未加载...
尝试将驱动程序 jar 放在服务器 lib 文件夹中
在pom.xml
中添加以下依赖
<!-- MySQL database driver -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.9</version> <!-- set your version -->
</dependency>
事先我是 java spring mvc 的初学者。
try{
Connection connection =
DriverManager.getConnection
("jdbc:mysql://localhost/emidwify?user=root&password=root");
Statement statement = connection.createStatement() ;
resultset =statement.executeQuery("SELECT FirstName, LastName FROM childdetails") ;
%>
<div class="div_box">
<select>
<% while(resultset.next()){ %>
<option><%= resultset.getString(2)%></option>
<% } %>
</select>
<div align ="justify">
<button type="button" class="btn btn-success active">View Details</button>
</div>
</div>
<%
}
catch(Exception e)
{
out.println("wrong entry "+e);
}
%>
我试图从名为 emidwify 的数据库中获取下拉选项的数据。但是当我 运行 我在本地主机上的 jsp 文件时,它显示了异常。
wrong entry java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/emidwify?user=root&password=root
谁能帮我解决一下。我无法触发任何东西。
注意:我正在研究 Linux mint。我正在使用 spring java mvc。
我认为 mysql jar 文件未加载...
尝试将驱动程序 jar 放在服务器 lib 文件夹中
在pom.xml
中添加以下依赖 <!-- MySQL database driver -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.9</version> <!-- set your version -->
</dependency>