G
gbchen
Unregistered / Unconfirmed
GUEST, unregistred user!
以下是我的一段程序,要提取SQL Server 7.0系统表中的信息,但出现不能得到正确结果,不知道为什么?
import java.sql.*;
import java.jbcl.*;
class servername{
public static void main(String[] args){
String sn = "Unkonwn Server Name";
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
try{
Connection conn = DiverManager.getConnection("jdbcdbc:gbchen","sa","");
Statement stmt = conn.createStatement();
ResultSet rSet = stmt.executeQuery("select user");
sn = rSet.getString(1);
}catch(SQLException excp){
System.err.println("ERROR:"+excp.getMessage());
}
}catch(ClassNotFoundException excp){
System.err.println("Errors:"+excp.getMessage());
}
System.out.println(sn);
}
运行出现如下错误:
ERROR:[Microsoft][ODBC Driver Manager] Invalid cursor state
Unkonwn Server Name
前端开发环境为JBuilder 2.0 数据库为SQL Server 7.0,请教是什么原因,如何解决?谢谢!
import java.sql.*;
import java.jbcl.*;
class servername{
public static void main(String[] args){
String sn = "Unkonwn Server Name";
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
try{
Connection conn = DiverManager.getConnection("jdbcdbc:gbchen","sa","");
Statement stmt = conn.createStatement();
ResultSet rSet = stmt.executeQuery("select user");
sn = rSet.getString(1);
}catch(SQLException excp){
System.err.println("ERROR:"+excp.getMessage());
}
}catch(ClassNotFoundException excp){
System.err.println("Errors:"+excp.getMessage());
}
System.out.println(sn);
}
运行出现如下错误:
ERROR:[Microsoft][ODBC Driver Manager] Invalid cursor state
Unkonwn Server Name
前端开发环境为JBuilder 2.0 数据库为SQL Server 7.0,请教是什么原因,如何解决?谢谢!