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

Re: JDBC compressed stream

From: John R Pierce <pierce(at)hogranch(dot)com>
To: Javier <jgagis(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: JDBC compressed stream
Date: 2005-06-17 19:12:45
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Javier wrote:
>    Hi, I'm developing a java client application that uses JDBC to access 
> a PostGIS/PostgreSQL database. I'm working with PostgreSQL JDBC driver 
> Type 4 ( and I need to compress the output 
> streamdata from database queries.
>    The problem can't be resolved making a better WHERE clause, because I 
> have to received a great amount of GIS information, and this info can be 
> highly compressed. Moreover, this data can't be stored compressed in the 
> database, so, an external compressor is needed.
>   Anybody can explain me if it is possible to compress a JDBC datastream 
> ??? Is this a PostgreSQL JDBC driver issue??? or a new function must be 
> added to PostgreSQL???
>    Last question --> Anyone knows any other way to achieve compression 
> with other kind of solution???

you could add a C function to the Postgres server engine which provides the 
compression on a field by field basis, then have a corresponding Java function 
to decompress the results after you recieve them.

You would use this function on a select statement something like...

	SELECT field1, fieldcompress(field2) AS field2,
		fieldcompress(field3) AS field3 FROM tablename
		WHERE ...;

These sorts of user C functions can be added to the database server at runtime, 
you compile the C to a .so shared object file (.DLL on Windows), and load it 
into the database server with a CREATE FUNCTION statement.
See for how you develop, 
install, and use these sorts of functions.

otherwise, AFAIK, you'd have to design a new compressed data protocol for 
pgsql, implement it in the postgres postmaster, and implement it in the jdbc 
client library (as well as for the client applications that aren't 
written in Java).

In response to

pgsql-jdbc by date

Next:From: Kevin GrittnerDate: 2005-06-17 19:41:24
Subject: Re: JDBC compressed stream
Previous:From: JavierDate: 2005-06-17 16:26:31
Subject: JDBC compressed stream

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