物理两朵乌云:jsp连接access数据库发生错误?

来源:百度文库 编辑:高校问答 时间:2024/04/29 04:01:48
java.sql.SQLException: [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>注册</title>
</head>

<body>
your username is:<%=request.getParameter("username")%>

<br><br>

your password is:<%=request.getParameter("pw")%>

<br><br>

<%

String name=request.getParameter("username");

String pw=request.getParameter("pw");

String email=request.getParameter("email");

String tel=request.getParameter("tel");

try

{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection dbcon=DriverManager.getConnection("jdbc:odbc:efis","sa","");

PreparedStatement stat=dbcon.prepareStatement(

"insert register values(?,?,?,?)");

stat.setString(1,name);

stat.setString(2,pw);

stat.setString(3,email);

stat.setString(4,tel);

stat.executeUpdate();

out.println("<br><B>Insert successful</B>");

}

catch(Exception e)

{

out.println(e);

}

%>

</body>
</html>

在管理工具 -> 数据源-> 配置的efis