sql server 2000 连接问题
try{
Connection con = DriverManager.getConnection( "jdbc:microsoft:sqlserver://localHost:1433; DatabaseName=army ", "sa ", "123456 ");
Statement sql = con.createStatement();
out.println( "success ");
ResultSet rs = sql.excuteQuery( "select * from table1 ");
} catch(
SQLException e) { out.println( "Sql error. "); }
运行结果是success Sql error
怎么回事啊?
------解决方案--------------------{ out.println( "Sql error. "); }
你这样写是欺骗自己啊! 用ex.printStack..或者其他的来获得真正的Exception 你的表肯定不在那个数据库中吧!
------解决方案--------------------localHost 改为localhost