简单的问题,大家帮我看看哈 信息太少,给出源代码和完整报错。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 下面是代码:import java.net.URL;import java.sql.*;public class Select { /** Creates a new instance of Select */ public Select() { } /** * @param args the command line arguments */ public static void main(String[] args) { try{ String jdbcDriver = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; String dbURL="jdbc:microsoft:sqlserver://localhost;DatabaseName=TEST"; try { Class.forName(jdbcDriver);//加载驱动程序 } catch(java.lang.ClassNotFoundException e) { System.err.print("ClassNotFoundException:"); System.err.println(e.getMessage()); } Connection con=DriverManager.getConnection(dbURL,"", "");//建立连接 Statement stmt=con.createStatement();//创建sql语句 ResultSet rs=stmt.executeQuery("Select * from USER1");//执行查询并把结果集返回 while(rs.next()) { for(int i=1;i<=4;i++) System.out.println(rs.getString(i)); } } catch (SQLException ex) { while(ex!=null) { System.out.println("shu ju ku yi chang bei bu huo le"); System.out.println(ex.getSQLState()); System.out.println(ex.getMessage()); System.out.println(ex.getErrorCode()); ex=ex.getNextException(); } } } }大家帮我看看是哪里出了问题,好吗?告诉我是驱动没有装,我又装了SQLserver驱动,可是还是不行,测试驱动程序连接数据库告诉我告诉我 null 未与信任的SQLSERVER进行连接, 其中我的SQLSERVER是用WINDOWS身份验证的 主要是环境变量怎么设呀?? 急!!!!求使用过SVN【分支功能】的大大进来 瞅一眼!!!!!!!!!!! 在eclipse下编写的jsp文件 《工作流技术探讨》--支持浏览器上,图形化自定义流程。 这样能实现吗? JSP的隐含属性是什么?作用是什么? 关于request请求域 请问我要在javaBean中取得相对路径怎么写?? 求一个SPRINGMVC与websocket集成的例子! 得分套餐(26分):2.在jbuilder3.5中如何加入JAVAX.NET.*;这个新类? junit4.7与SPRING MVC 结合不能注入 大家怎么处理js常量?是不是单独放在一个文件中? resin 中文问题
import java.net.URL;
import java.sql.*;
public class Select {
/** Creates a new instance of Select */
public Select() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try{
String jdbcDriver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
String dbURL="jdbc:microsoft:sqlserver://localhost;DatabaseName=TEST";
try
{
Class.forName(jdbcDriver);//加载驱动程序
}
catch(java.lang.ClassNotFoundException e)
{
System.err.print("ClassNotFoundException:");
System.err.println(e.getMessage());
}
Connection con=DriverManager.getConnection(dbURL,"", "");//建立连接
Statement stmt=con.createStatement();//创建sql语句
ResultSet rs=stmt.executeQuery("Select * from USER1");//执行查询并把结果集返回
while(rs.next())
{
for(int i=1;i<=4;i++)
System.out.println(rs.getString(i));
}
}
catch (SQLException ex)
{
while(ex!=null)
{
System.out.println("shu ju ku yi chang bei bu huo le");
System.out.println(ex.getSQLState());
System.out.println(ex.getMessage());
System.out.println(ex.getErrorCode());
ex=ex.getNextException();
}
}
}
}
大家帮我看看是哪里出了问题,好吗?
告诉我是驱动没有装,我又装了SQLserver驱动,可是还是不行,测试驱动程序连接数据库告诉我告诉我 null 未与信任的SQLSERVER进行连接, 其中我的SQLSERVER是用WINDOWS身份验证的