Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

[Microsoft][ODBC Driver Manager] Invalid cursor state -- Help Please!

843859Dec 13 2005 — edited Dec 13 2005
Hi!

I'm trying to access a Microsoft access database.
The code is (JSP) :
<%@ page language="java" contentType="text/html" import="java.sql.*" %>

<%

   Object rsValue = null;
// Load MSDE JDBC driver
  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

// Open up Access database
	String DSNName = "Intranet_exam.dsn";
	String dbURL = "jdbc:odbc:" + DSNName;
	Connection Conn = DriverManager.getConnection(dbURL);

	// Create statement object for sending SQL Queries
	Statement Stmt  = Conn.createStatement();
	// Place results in ResultSet object

	String searchTerm = request.getParameter("searchTerm");
	ResultSet rs = Stmt.executeQuery("SELECT count(*) from examTimes");
	
	 // Clean up objects:



%>
<% if(rs != null){%>
<%= rs.getInt(1) %>
<%
}else{%>

RS is null
<%}%>
However this produces the exception:

[Microsoft][ODBC Driver Manager] Invalid cursor state

Is this trying to say that the result set is empty?
I've tried moving the cursor to 'before first', but the table is locked to 'forward movement only'

Any help would be great!
Thanks
Alastair
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 10 2006
Added on Dec 13 2005
1 comment
214 views