数据库连接
请问在数据库连接过程中,sql server设置用户名,怎么登录不进去啊还有我用access时,总是出现异常啊,不知道怎么回事
我的代码如下
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>登陆</title>
</head>
<body>
<%
Connection con;
Statement sql;
ResultSet rs;
try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e){out.print("asdf1"); }
try{
con=DriverManager.getConnection("jdbc:odbc:txl");
sql=con.createStatement();
rs=sql.executeQuery("SELECT *FROM txl");
out.print("<Table Brder>");
out.print(rs.getInt(1));
out.print("123");
while(rs.next())
{out.print("<TD>"+rs.getInt("age")+"</TD>");}
}
catch(SQLException e1){out.print("asdf2");}%>
<p>sadlf
</body>
</html>
请指教一下,我是新手,很多不熟练
[此贴子已经被作者于2007-8-30 9:13:06编辑过]