我这样为什么不能连接sql server 数据库阿!急

q3643 q3643 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
<%@page import="java.sql.*"%>

<html>
<head>
<title>TestPage</title>
</head>

<%Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:test","sa","");

Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(" SELECT * FROM S ");
while(rs.next()){
%>
<h1>Hello <%=rs.getString("name")%>!<br></h1>
<h1>your no is <%=rs.getString("no")%><br></h1>
<% }

if (rs!=null) rs.close();
if (stmt!=null) stmt.close();
if (con!=null) con.close();
%>

</html>
...全文

相关推荐

评论 9
收藏 已收藏
分享
返回顶部
q3643
Web 开发 81,108 成员 341,721 内容