如何修复:“在使用池时找不到JDBC:mysql:/localhost/dbName”错误?
No suitable driver found for jdbc:mysql://localhost/dbname.
import java.sql.Connection;import java.sql.DriverManager;import java.sql.SQLException;import org.apache.tomcat.dbcp.dbcp.ConnectionFactory;import org.apache.tomcat.dbcp.dbcp.DriverManagerConnectionFactory;import org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory;import org.apache.tomcat.dbcp.dbcp.PoolingDriver;import org.apache.tomcat.dbcp.pool.impl.GenericObjectPool;public class DatabaseConnector { public static String DB_URI = "jdbc:mysql://localhost/dbname"; public static String DB_USER = "test"; public static String DB_PASS = "password"; // Singleton instance protected static DatabaseConnector _instance; protected String _uri; protected String _username; protected String _password;
Apr 5, 2011 9:49:14 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [Login] in context with path [/Project] threw exception java.lang.RuntimeException: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/dbname
catspeake
相关分类