主题:关于sql的奇怪的问题
我用jsp连接sql时出现了一个有趣的问题,ODBC测试通过了,运行也不报错,就是没结果,更怪的是,上午还是正确的,下午就不行了,帮帮我啊,我都弄了一天了!!
<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="java.sql.*" %>
<HTML>
<BODY>
<% Connection con;
Statement sql;
ResultSet rs;
try{Class.forName("luntan.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e){}
try { con=DriverManager.getConnection("jdbc:odbc:luntan","","");
sql=con.createStatement();
rs=sql.executeQuery("SELECT * FROM cust");
out.print("<Table Border>");
out.print("<TR>");
out.print("<TH width=100>"+"帐号");
out.print("<TH width=100>"+"密码");
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("</TR>") ;
}
out.print("</Table>");
con.close();
}
catch(SQLException e1) {}
%>
</BODY>
</HTML>
本来结果应该是一个表
但现在却是一片空白
怎么会这样啊
<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="java.sql.*" %>
<HTML>
<BODY>
<% Connection con;
Statement sql;
ResultSet rs;
try{Class.forName("luntan.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e){}
try { con=DriverManager.getConnection("jdbc:odbc:luntan","","");
sql=con.createStatement();
rs=sql.executeQuery("SELECT * FROM cust");
out.print("<Table Border>");
out.print("<TR>");
out.print("<TH width=100>"+"帐号");
out.print("<TH width=100>"+"密码");
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("</TR>") ;
}
out.print("</Table>");
con.close();
}
catch(SQLException e1) {}
%>
</BODY>
</HTML>
本来结果应该是一个表
但现在却是一片空白
怎么会这样啊