Skip to Main Content

New to Java

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!

Invalid operation for the current cursor position

807598Sep 12 2006 — edited Sep 12 2006
hi ,
i am always getting the error like
[Microsoft][SQLServer 2000 Driver for JDBC]Invalid operation for the current cursor position.
What could be the problem?
here is my code. i tried my level best. i couldn't bear with thie error
	public dash[] getContentBatches() throws VRContentDashBoardException 
	{
		DBOperation dbConn = null;
		dash batches[] = null;
		int count = 0;
		Connection c = null;
		ResultSet rs = null;
		ResultSet r = null;
		Statement stmt = null;
		Statement s = null;
		String sqlStmt = "SELECT * FROM ContentBatches WHERE status <> 'RETIRED' ORDER BY BATCHID DESC" ;
		PreparedStatement ps = null;
		
		System.out.println("Entering getContentDashBoard()");
		try
		{
			dbConn = new DBOperation();
			c = dbConn.getDatabaseConnection();
			if (c != null)
			{
				s = c.createStatement();
				r = s.executeQuery("SELECT COUNT(*) FROM CONTENTBATCHES");
				if(r.next())
				{
					count = r.getInt(1);
					System.out.println("count - ContentBatchesOperation:"+count);
				}



				if(count != 0)
				{
					batches = new dash[count];
					stmt = c.createStatement();
					rs = stmt.executeQuery(sqlStmt);
					rs.next();
					for(int i=0; i<count; i++,rs.next())
					{
						batches[i] = new dash();
						batches.setContentProvider(rs.getString("ContentProvider"));
batches[i].setBatchId(rs.getString("BatchID"));
}

}
else
{
System.out.println("No data available in the data base - ContentBatchesOperation");
}
}
else
{
System.out.println("*** Connection object is null ***");
}
}
catch(SQLException es)
{
System.out.println("**** SQLException Error Code: " + es.getErrorCode());
System.out.println("**** SQLException Error Message: " + es.getMessage());
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 10 2006
Added on Sep 12 2006
2 comments
546 views