right MS Access is balls compared to other DB's i know but im working on a project which already uses an Access DB. Now after writing the following eclipse gives me a lovely error which im yet to figure out. Googling has thrown up people with similiar problems but no fix for me. can anyone help?

Error thrown...

Exception  : [Microsoft][ODBC Driver Manager] Invalid cursor state
Stack trace: [Ljava.lang.StackTraceElement;@e09713
Cause      : null

My Code...

try {
				Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
				con = DriverManager.getConnection(Settings.mysqlDetails());

				if (!con.isClosed()) {
					System.out.println("Connected to database '"
							+ Settings.mysqlDetails() + "'");
				}

				Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

				ResultSet rs = stmt.executeQuery("SELECT * FROM `AppProjects` WHERE `appID` = " + id);

				Application app = new Application();
// FAILS FROM HERE ONWARDS
				app.appID = rs.getInt("appID");
				System.out.print("1");
				app.staffID = Integer.parseInt(rs.getString("staffID"));
				System.out.print("2");
				app.customerID = Integer.parseInt(rs.getString("customerID"));
				System.out.print("3");
				app.datePaid = Convert.readDate(rs.getString("datePaid"));
				
				app.print();
				rs.close();

				return true;

			} catch (Exception e) {
				Convert.exceptionToMessage(e);
				okFlag = Prompt
						.yesNo("Would you like to attempt this action again ?");
			} finally {
				try {
					if (con != null) {
						con.close();
					}
				} catch (SQLException e) {
					Convert.exceptionToMessage(e);
				}
			}

i tried adding a rs.first() to point to the first result but nothing ? help please

You forgot to do:

if(rs.next())
{
//your code which uses rs
}

You got to realize that unless you do a next on the recordset, it isn't actually pointing to anything, this is because the implicit cursor in any kind of database always points to the nothingness.

school boy error. sorry

so how to show in jTable

????whuuh????

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.