jsp查询数据库错误
<%Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();;String...
<%
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
;
String url= "jdbc:sqlserver://localhost:1433;DatabaseName=jsp;user=sa;password=123456";
Connection conn = DriverManager.getConnection(url);
Statement smt = conn.createStatement();
ResultSet rs = smt.executeQuery("select * from user");
while(rs.next()){
out.println(rs.getString(1));
out.print("database is open,ok!");
}
smt.close();
conn.close();
%>
运行错误com.microsoft.sqlserver.jdbc.SQLServerException: 关键字 'user' 附近有语法错误。
到底怎么错了 展开
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
;
String url= "jdbc:sqlserver://localhost:1433;DatabaseName=jsp;user=sa;password=123456";
Connection conn = DriverManager.getConnection(url);
Statement smt = conn.createStatement();
ResultSet rs = smt.executeQuery("select * from user");
while(rs.next()){
out.println(rs.getString(1));
out.print("database is open,ok!");
}
smt.close();
conn.close();
%>
运行错误com.microsoft.sqlserver.jdbc.SQLServerException: 关键字 'user' 附近有语法错误。
到底怎么错了 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询