Skip site navigation (1) Skip section navigation (2)

BUG #1163: cursor "jdbc_curs_1" does not exist

From: "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1163: cursor "jdbc_curs_1" does not exist
Date: 2004-06-14 16:25:47
Message-ID: 20040614162547.AB1FACF4B30@www.postgresql.com (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      1163
Logged by:          Timo Nentwig

Email address:      tmp(at)nitwit(dot)de

PostgreSQL version: 7.4

Operating system:   Linux

Description:        cursor "jdbc_curs_1" does not exist

Details: 

Hi!

I read about 4000 html pages (i.e. Strings) from one table, compress them 
with GZip and insert them as bytea into another table. Work fine for the 
first 100 then this happens: 

org.postgresql.util.PSQLException: ERROR: cursor "jdbc_curs_1" does not 
exist 

	at 
org.postgresql.util.PSQLException.parseServerError(PSQLException.java:139) 
	at org.postgresql.core.QueryExecutor.executeV3(QueryExecutor.java:152)
	at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:100)
	at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:67)
org.postgresql.jdbc1.AbstractJdbc1ResultSet.next(AbstractJdbc1ResultSet.jav
	at a:157) 
	at f4t.obsolete.migration.CompressHtml.compress(CompressHtml.java:40)
	at f4t.obsolete.migration.CompressHtml.main(CompressHtml.java:70)



My JDBC driver is 74.213. This is my convertion code:

	PreparedStatement insertHtml = f4t.prepareStatement("INSERT INTO 
legacy.zhtml (id, zhtml) VALUES (?, ?)"); 
		PreparedStatement selectHtml = f4t.prepareStatement("SELECT urlid, html 
FROM html"); 

		f4t.setAutoCommit(false);
		
		selectHtml.setFetchSize(100);
		
		ResultSet row = selectHtml.executeQuery();

		for (int j = 1; row.next(); j++)
		{
			String id = row.getString("urlid");
			String html = row.getString("html");

			ByteArrayOutputStream bos =  new ByteArrayOutputStream();
			DataOutputStream dos =  new DataOutputStream(bos);
			WritableUtils.writeCompressedString(dos, html);

			insertHtml.setString(1, id);
			insertHtml.setBytes(2, bos.toByteArray());
			insertHtml.execute();

			System.out.print('.');
			
			if(j%100==0)
			{
				System.out.println();
				f4t.commit();
			}
		}
		
		f4t.commit();
		f4t.setAutoCommit(true);


pgsql-bugs by date

Next:From: Markus BertheauDate: 2004-06-14 16:36:49
Subject: Re: \w doesn't match non-ASCII letters
Previous:From: Bruno Wolff IIIDate: 2004-06-14 15:49:03
Subject: Re: inserting lots of values into a column that has "unique" property

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group