本文介绍了[Microsoft] [ODBC驱动程序管理器]无效的光标状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我正在尝试访问Microsoft Acess数据库,但出现以下错误:

Hello

I am trying to access a Microsoft acess database and i get the following error:

[Microsoft][ODBC Driver Manager] Invalid cursor state



我的代码如下



My code is as following

import java.sql.*;


class Test
{
 public static void main(String[] args)
 {
 try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con = DriverManager.getConnection("jdbc:odbc:Cont","","");
Statement s = con.createStatement();
ResultSet rset = s.executeQuery("SELECT * FROM Customer");
//ResultSet rset = s.getResultSet();

while(rset.next());
{
	System.out.exp.printStackTrace(rset.getString("ID") +" " + rset.getString("Name") +" " +
			rset.getString("Email") + " " +
			rset.getInt("Comments")); 
}

 }
 catch (ClassNotFoundException exp) {
System.err.println(exp);

 }
 catch(SQLException exp)
 {
	 System.err.println(exp);
 }
 }
}



任何帮助将不胜感激

谢谢



Any help would be appreciated

Thanks

推荐答案


这篇关于[Microsoft] [ODBC驱动程序管理器]无效的光标状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 08:37