错误:org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'jdbc:mysql://localhost:3306/MySQL
context.xml:
<Context reloadable="true">
<Resource name="jdbc/TextDB" auth="Container" type="javax.sql.DataSource"
drivername="com.sql.jdbc.Driver" url="jdbc:mysql://localhost:3306/MySQL"
username="root" password="294224"
maxActive="100" maxIdle="30" maxWait="10000"/>
</Context>
连接:
public UserDao()
{
Context ctx;
try
{
ctx=new InitialContext();
dataSource=(DataSource)ctx.lookup("java:comp/env/jdbc/TextDB");
}
catch(NamingException e)
{
e.printStackTrace();
}
}
context.xml:
<Context reloadable="true">
<Resource name="jdbc/TextDB" auth="Container" type="javax.sql.DataSource"
drivername="com.sql.jdbc.Driver" url="jdbc:mysql://localhost:3306/MySQL"
username="root" password="294224"
maxActive="100" maxIdle="30" maxWait="10000"/>
</Context>
连接:
public UserDao()
{
Context ctx;
try
{
ctx=new InitialContext();
dataSource=(DataSource)ctx.lookup("java:comp/env/jdbc/TextDB");
}
catch(NamingException e)
{
e.printStackTrace();
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货