No suitable driver

xiaoji_86 2010-10-10 03:41:12
急求jsp连接数据库出错(sql server 2000)!!已经把jar包导入到lib目录下!还是提示:
No suitable driver.求老鸟解答
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%@ page import="java.sql.*" %>
<html>
<head>
<title>My JSP 'conn.jsp' starting page</title>
</head>
<body>
<%
Connection con;
Statement sql;
ResultSet rs;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e)
{}
try
{
con=DriverManager.getConnection("jbbc:odbc:mymoon","","");
sql=con.createStatement();
rs=sql.executeQuery("select * from employee");
out.print("<table border=2>");
out.print("<tr>");
out.print("<th width=100>"+"雇佣号");
out.print("<th width=100>"+"姓名");
out.print("<th width=50>"+"出生日期");
out.print("<th width=50>"+"薪水");
out.print("</tr>");
while(rs.next())
{
out.print("<tr>");
out.print("<td>"+rs.getString(1)+"</td>");
out.print("<td>"+rs.getString(2)+"</td>");
out.print("<td>"+rs.getDate("birthday")+"</td>");
out.print("<td>"+rs.getFloat("salary")+"</td>");
out.print("</tr>");
}
out.print("</table>");
con.close();
}catch(SQLException e)
{
out.print(e);
}
%>
</body>
</html>
...全文
33 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
xiaoji_86 2010-10-10
(北冰洋之风)
con=DriverManager.getConnection("jbbc:odbc:mymoon","","");错了
应该是
con=DriverManager.getConnection("jdbc:odbc:mymoon","","");
回复
zn85600301 2010-10-10
con=DriverManager.getConnection("jbbc:odbc:mymoon","","");
jbbc 是什么?
回复
xiaohuanjie 2010-10-10
不知道LZ用是什么驱动

很可能是这里有问题Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
回复
xiaohuanjie 2010-10-10
先占个座再看
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2010-10-10 03:41
社区公告
暂无公告