head	1.14;
access;
symbols
	REL7_4_29:1.13
	REL7_4_28:1.13
	REL7_4_27:1.13
	REL7_4_26:1.13
	REL7_4_25:1.13
	REL7_4_24:1.13
	REL7_4_23:1.13
	REL7_4_22:1.13
	REL7_4_21:1.13
	REL7_4_20:1.13
	REL7_3_21:1.12
	REL7_4_19:1.13
	REL7_3_20:1.12
	REL7_4_18:1.13
	REL7_3_19:1.12
	REL7_4_17:1.13
	REL7_3_18:1.12
	REL7_4_16:1.13
	REL7_4_15:1.13
	REL7_3_17:1.12
	REL7_4_14:1.13
	REL7_3_16:1.12
	REL7_3_15:1.12
	REL7_4_13:1.13
	REL7_3_14:1.12
	REL7_4_12:1.13
	REL7_3_13:1.12
	REL7_4_11:1.13
	REL7_3_12:1.12
	REL7_4_10:1.13
	REL7_3_11:1.12
	REL7_4_9:1.13
	REL7_2_8:1.11
	REL7_3_10:1.12
	REL7_4_8:1.13
	REL7_2_7:1.11
	REL7_3_9:1.12
	REL7_4_7:1.13
	REL7_4_6:1.13
	REL7_3_8:1.12
	REL7_2_6:1.11
	REL7_2_5:1.11
	REL7_4_5:1.13
	REL7_3_7:1.12
	REL7_4_4:1.13
	REL7_4_3:1.13
	REL7_4_2:1.13
	REL7_3_6:1.12
	REL7_4_1:1.13
	REL7_3_5:1.12
	REL7_4:1.13
	REL7_4_RC2:1.13
	REL7_4_STABLE:1.13.0.4
	REL7_4_RC1:1.13
	REL7_4_BETA5:1.13
	REL7_4_BETA4:1.13
	REL7_4_BETA3:1.13
	REL7_4_BETA2:1.13
	WIN32_DEV:1.13.0.2
	REL7_4_BETA1:1.13
	REL7_3_4:1.12
	REL7_3_2:1.12
	REL7_2_4:1.11
	REL7_3_STABLE:1.12.0.2
	REL7_2_3:1.11
	REL7_2_STABLE:1.11.0.2
	REL7_2:1.11
	REL7_2_RC2:1.11
	REL7_2_RC1:1.11
	REL7_2_BETA5:1.11
	REL7_2_BETA4:1.11
	REL7_2_BETA3:1.11
	REL7_2_BETA2:1.11
	REL7_2_BETA1:1.11
	REL7_1_2:1.10
	REL7_1_STABLE:1.10.0.2
	REL7_1_BETA:1.7
	REL7_1_BETA3:1.7
	REL7_1_BETA2:1.7
	REL7_1:1.10
	REL7_0_PATCHES:1.7.0.2
	REL7_0:1.7
	REL6_5_PATCHES:1.6.0.2
	REL6_5:1.6
	REL6_4:1.5.0.2
	release-6-3:1.5;
locks; strict;
comment	@# @;


1.14
date	2004.01.19.20.07.05;	author pgsql;	state dead;
branches;
next	1.13;

1.13
date	2002.12.11.12.29.13;	author davec;	state Exp;
branches;
next	1.12;

1.12
date	2002.10.20.00.10.55;	author barry;	state Exp;
branches;
next	1.11;

1.11
date	2001.05.09.15.51.37;	author momjian;	state Exp;
branches;
next	1.10;

1.10
date	2001.03.19.21.57.09;	author momjian;	state Exp;
branches;
next	1.9;

1.9
date	2001.03.14.20.44.40;	author petere;	state Exp;
branches;
next	1.8;

1.8
date	2001.01.18.14.50.14;	author peter;	state Exp;
branches;
next	1.7;

1.7
date	2000.05.03.15.58.08;	author peter;	state Exp;
branches;
next	1.6;

1.6
date	99.01.17.04.51.49;	author momjian;	state Exp;
branches;
next	1.5;

1.5
date	98.01.11.21.14.31;	author scrappy;	state Exp;
branches;
next	1.4;

1.4
date	97.11.07.21.07.39;	author momjian;	state Exp;
branches;
next	1.3;

1.3
date	97.10.30.18.24.36;	author momjian;	state Exp;
branches;
next	1.2;

1.2
date	97.09.29.20.11.43;	author scrappy;	state Exp;
branches;
next	1.1;

1.1
date	97.09.26.08.22.21;	author scrappy;	state Exp;
branches;
next	;


desc
@@


1.14
log
@
JDBC is now on GBorg
@
text
@This is a simple readme describing how to compile and use the jdbc driver.

---------------------------------------------------------------------------

This isn't a guide on how to use JDBC - for that refer to sun's web site:

	http://java.sun.com/

For problems with this driver, then refer to the postgres-jdbc email
list:

	http://www.postgresql.org/

The Driver's home page is:

	http://jdbc.postgresql.org/

---------------------------------------------------------------------------

COMPILING

To compile you will need to have ANT installed. To obtain ant go to
http://jakarta.apache.org/ant/index.html and download the binary. Being pure
java it will run on virtually all java platforms. If you have any problems
please email the jdbc list.

Once you have ANT, run the configure script in the top-level directory with
the --with-java option.  Then proceed with 'make' and 'make install' as
usual.  This will compile the correct driver for your JVM, and build a .jar
file (Java ARchive) called postgresql.jar.  The file will be installed in
the directory PREFIX/share/java.

That jar file will contain the driver for _your_ version of the JDK.

If you would like to use ANT directly, first invoke 'make build.properties'
after running the configure script with the java option. This will create a
needed Java properties file from the configured information.

REMEMBER: Once you have compiled the driver, it will work on ALL platforms
that support that version of the API. You don't need to build it for each
platform.

Possible problems

You may see a message similar to:

postgresql/Driver.java:87: interface java.sql.Connection is an interface. It can't be instantiated.
    return new Connection (host(), port(), props, database(), url, this);

This is caused by not having the current directory in your CLASSPATH. Under
Linux/Solaris, unset the CLASSPATH environment variable, and rerun ant.

If you are still having problems, prebuilt versions of the driver 
are available at http://jdbc.postgresql.org/

---------------------------------------------------------------------------

INSTALLING THE DRIVER

To install the driver, the .class files have to be in the classpath.

ie: under LINUX/SOLARIS (the example here is my linux box):

	export CLASSPATH=.:/usr/local/pgsql/share/java/postgresql.jar

---------------------------------------------------------------------------

USING THE DRIVER

To use the driver, you must introduce it to JDBC. Again, there's two ways
of doing this:

1: Hardcoded.

   This method hardcodes your driver into your application/applet. You
   introduce the driver using the following snippet of code:

	try {
	  Class.forName("org.postgresql.Driver");
	} catch(Exception e) {
	  // your error handling code goes here
	}

   Remember, this method restricts your code to just the postgresql database.
   However, this is how most people load the driver.

2: Parameters

   This method specifies the driver from the command line. When running the
   application, you specify the driver using the option:

	-Djdbc.drivers=org.postgresql.Driver

   eg: This is an example of running one of my other projects with the driver:

	java -Djdbc.drivers=org.postgresql.Driver uk.org.retep.finder.Main

   note: This method only works with Applications (not for Applets).
	 However, the application is not tied to one driver, so if you needed
	 to switch databases (why I don't know ;-) ), you don't need to
	 recompile the application (as long as you havent hardcoded the url's).

---------------------------------------------------------------------------

JDBC URL syntax

The driver recognises JDBC URL's of the form:

	jdbc:postgresql:database

	jdbc:postgresql://host/database

	jdbc:postgresql://host:port/database

Also, you can supply both username and passwords as arguments, by appending
them to the URL. eg:

	jdbc:postgresql:database?user=me
	jdbc:postgresql:database?user=me&password=mypass

Notes:

1) If you are connecting to localhost or 127.0.0.1 you can leave it out of the
   URL. ie: jdbc:postgresql://localhost/mydb can be replaced with
   jdbc:postgresql:mydb

2) The port defaults to 5432 if it's left out.

---------------------------------------------------------------------------

That's the basics related to this driver. You'll need to read the JDBC Docs
on how to use it. However, there are some examples included in the example
directory. To build, type: make examples

To run them, they follow the same syntax. For example, the basic example shows
how to insert data, and perform queries:

	java example.basic jdbc:postgresql:test user password

---------------------------------------------------------------------------

POSTGRESQL SPECIFICS
--------------------

Large Objects:

A "feature" of PostgreSQL is that access to LargeObjects is only permitted
within a Transaction. Because of this, any use of LargeObjects (also known
as Blobs) requires that the Connection.setAutoCommit() method be called
disabling the autocommit feature.

For example:

	Connection db;			// open the connection here
	db.setAutoCommit(false);	// Turn off AutoCommit

			------------------

Large Object API

The first thing you need to do is to open the LargeObjectManager. This class
handles the opening of existing objects, and creating new ones. To do this,
you use the following line of code:

	LargeObjectManager lobj;
	lobj = ((org.postgresql.Connection)db).getLargeObjectAPI();

where db is a reference to an open Connection object.

Once that is done, you can use the API for the lifetime of that Connection.

To create an object, you call the create() method. This takes an argument
with the file modes you intend to use. The following line is normally
sufficient:

       int oid = lobj.create(LargeObjectManager.READ|LargeObjectManager.WRITE);

Here, lobj is the LargeObjectManager we have opened earlier, and oid is the
Large Object's oid in the database.

To open an existing object, you use the open() method. This takes an oid, and
the file permissions. It then returns a LargeObject object.

	LargeObject obj = lobj.open(oid,LargeObjectManager.WRITE);

Once the LargeObject is open, you can call methods to read, write, seek etc.
Here's the supported methods:

	int oid = obj.getOID();			Return the objects oid
	obj.close();				Close the object
	byte data[] = obj.read(int len);	Read len bytes
	onj.read(byte data[],int off,int len);	Read into data[off] len bytes
	obj.write(byte data[]);			Write the array data
	obj.write(byte data[],int off,int len);	Write len bytes from data[off]
	obj.seek(int pos,int ref);		As fseek in C.
	obj.seek(int pos);			Move to pos (from the begining)
	int pos = obj.tell();			Returns the current position
	int size = obj.size();			Returns the objects size

Caveat: If you commit(), rollback() a transaction, or turn on autocommit whilst
an object is open PostgreSQL will close it. You will need to reopen the object
before using it again. Using the existing LargeObject will cause an
SQLException to be thrown.

			------------------

JDBC supports database specific data types using the getObject() call. The
following types have their own Java equivalents supplied by the driver:

	box, circle, line, lseg, path, point, polygon

When using the getObject() method on a resultset, it returns a PG_Object,
which holds the postgres type, and its value. This object also supports
methods to retrive these types.

	Eg: column 3 contains a point, and rs is the ResultSet:

	PG_Object o = (PG_Object)rs.getObject(3);
	PGpoint p = o.getPoint();
	System.out.println("point returned x="+p.x+", y="+p.y);

Also, when using these classes, their toString() methods return the correct
syntax for writing these to the database.

---------------------------------------------------------------------------

@


1.13
log
@Mike Beachy's build patch to allow ant builds without make
@
text
@@


1.12
log
@Applied patch submitted by Mike Beachy to give a better error message if
configure hasn't been run before trying to build.
Also cleaned up the README file and removed some obsolete files.

 Modified Files:
 	jdbc/README jdbc/build.xml
 Removed Files:
 	jdbc/CHANGELOG jdbc/Implementation jdbc/jdbc.jpx
@
text
@d35 4
@


1.11
log
@Mention new jdbc mailing list instead of interfaces list.
@
text
@a2 3
This file was amended on January 17 2001 to reflect the changes made in the 7.1
release.

d5 1
a5 1
This isn't a guide on how to use JDBC - for that refer to Javasoft's web site:
d7 1
a7 1
	http://www.javasoft.com/
a16 4
or	http://www.retep.org.uk/postgresql/

NB: They are both the same physical directory so both will always be in sync
(unless the laws of physics break down ;-) )
a34 3
Note: As of 7.1, you can build from the top-level directory or from
src/interfaces/jdbc.

a38 7
That means you don't have to compile it on every platform. Believe me, I
still hear from people who ask me "I've compiled it ok under Solaris, but it
won't compile under Linux" - there's no difference.

Don't try to run javac directly.  Don't try to run ant directly.  Neither
will work.

d49 2
a50 5
If you are still having problems, I keep a copy of the driver (for different
versions of the backend) on my web site http://www.retep.org.uk/postgres/
or http://jdbc.postgresql.org/

More details are in the Implementation file src/interfaces/jdbc/Implementation
a61 3
Please don't be tempted to extract the files from the .jar file. There are a
lot of files in there, and you may break the Exception handling.

a156 4
Most of the time, you can use the getBytes()/setBytes() methods to read and
write small Large Objects. However, PostgreSQL's own internal api's are
available. These allow you to access the object as if it was a file.

a202 22
Date datatype:

The driver now issues the "show datestyle;" query when it first connects, so
any call to ResultSet.getDate() how returns the correct date.

One caveat though: if you change the datestyle from within JDBC, you must also
issue the "show datestyle" query. Without this, the driver will not know of
the change.

ie:
	Statement s = db.createStatement();
	...
	s.executeUpdate("set datestyle='european'");
	s.executeUpdate("show datestyle");
	..
	s.close();

Please note: This may change later, so that the driver uses the same format
internally (similar to how the ODBC driver works).

			------------------

a222 6
Peter T Mount, December 29 1998
home email: peter@@retep.org.uk		http://www.retep.org.uk
work email: petermount@@it.maidstone.gov.uk or peter@@taer.maidstone.gov.uk

PS: Please use the home email whenever possible. If you must contact me at work
then please cc my home one at the same time.
@


1.10
log
@Update Peter Mount's email address in README.
@
text
@d12 1
a12 1
For problems with this driver, then refer to the postgres-interfaces email
d32 1
a32 1
please email the INTERFACES list.
@


1.9
log
@Update.  Things are now build through 'make'.
@
text
@d273 1
a273 1
home email: pmount@@retep.org.uk		http://www.retep.org.uk
@


1.8
log
@Thu Jan 18 12:24:00 GMT 2001 peter@@retep.org.uk
        - These methods in org.postgresql.jdbc2.ResultSet are now implemented:
            getBigDecimal(int) ie: without a scale (why did this get missed?)
            getBlob(int)
            getCharacterStream(int)
            getConcurrency()
            getDate(int,Calendar)
            getFetchDirection()
            getFetchSize()
            getTime(int,Calendar)
            getTimestamp(int,Calendar)
            getType()
          NB: Where int represents the column name, the associated version
              taking a String were already implemented by calling the int
              version.
        - These methods no longer throw the not implemented but the new noupdate
          error. This is in preparation for the Updateable ResultSet support
          which will overide these methods by extending the existing class to
          implement that functionality, but needed to show something other than
          notimplemented:
            cancelRowUpdates()
            deleteRow()
        - Added new error message into errors.properties "postgresql.noupdate"
          This is used by jdbc2.ResultSet when an update method is called and
          the ResultSet is not updateable. A new method notUpdateable() has been
          added to that class to throw this exception, keeping the binary size
          down.
        - Added new error message into errors.properties "postgresql.psqlnotimp"
          This is used instead of unimplemented when it's a feature in the
          backend that is preventing this method from being implemented.
        - Removed getKeysetSize() as its not part of the ResultSet API

Thu Jan 18 09:46:00 GMT 2001 peter@@retep.org.uk
        - Applied modified patch from Richard Bullington-McGuire
          <rbulling@@microstate.com>. I had to modify it as some of the code
          patched now exists in different classes, and some of it actually
          patched obsolete code.

Wed Jan 17 10:19:00 GMT 2001 peter@@retep.org.uk
        - Updated Implementation to include both ANT & JBuilder
        - Updated README to reflect the changes since 7.0
	- Created jdbc.jpr file which allows JBuilder to be used to edit the
          source. JBuilder _CAN_NOT_ be used to compile. You must use ANT for
          that. It's only to allow JBuilders syntax checking to improve the
          drivers source. Refer to Implementation for more details
@
text
@d34 5
a38 3
Once you have ANT, cd to the src directory and type "ant". This will compile
the correct driver for your JVM, and build a .jar file (Java ARchive) called
postgresql.jar
d42 2
a43 6
Note: As of 7.1, you build from pgsql/src and not pgsql/src/interfaces/jdbc.
Well you can, but building from the top will also build some extra utilities
located under /contrib at the same time. Also later on (either 7.1.1 or 7.2)
it's intended to have the main configure script to build the driver
automatically if it finds both a JDK & ANT installed, so this is the first step
towards that.
d53 2
a54 2
I advise you don't try running javac outside of ANT as it builds some classes
on the fly.
d76 1
a76 2
To install the driver, the .class files have to be in the classpath. To do
this, copy the postgres.jar file into a directory, and add it to the classpath.
d80 1
a80 1
	export CLASSPATH=.:/usr/local/lib/postgresql.jar
@


1.7
log
@Minor fixes ready for 7.0
@
text
@d3 1
a3 1
This file was amended on May 2 2000 to document the changes made in the 7.0
d10 1
a10 1
	http://www.javasoft.com
d15 9
a23 1
	http://www.postgresql.org
d29 4
a32 1
There are actually two versions of the driver. One for the JDBC1.2 specification, and one for the JDBC2 specification. To compile the driver, you need to select the correct one.
d34 2
a35 5
If you have JDK1.1.x you need to type: make jdbc1

If you have JDK1.2 or JDK1.3, you need to type: make jdbc2

This will compile the driver, and build a .jar file (Java ARchive) called
d40 7
d55 2
a56 5
PS: When you run make, don't worry if you see more than one or two calls to
    javac. This is normal, because the driver dynamically loads classes, and
    the Makefile ensures everything gets compiled.

I advise you don't try running javac outside of make. You may miss something.
d66 1
a66 1
Linux/Solaris, unset the CLASSPATH environment variable, and rerun make.
d70 3
d85 3
d142 8
@


1.6
log
@As the email posted to the announce and interfaces list, attached is a tar
file containing the latest version of the JDBC driver, allowing it to be
compiled and used under JDK 1.2 and later.

NB: None (well almost none) of the new methods actually do anything. This
release only handles getting it to compile and run. Now this is done, I'll
start working on implementing the new stuff.

Now this tar file replaces everything under src/interfaces/jdbc. I had to
do it this way, rather than diffs, because most of the classes under the
postgresql subdirectory have moved to a new directory under that one, to
enable the support of the two JDBC standards.

Here's a list of files in the tar file. Any file not listed here (in the
postgresql directory) will have to be deleted, otherwise it could cause
the driver to fail:

Peter Mount
@
text
@d3 5
a11 6
or the JDBC mailing list:

	jdbc@@java.blackdown.org

	http://www.blackdown.org

d17 1
a17 2
When PostgreSQL V6.4 was released, full documentation for the driver was
included in the main documentation tree (under the doc directory).
d19 1
a19 2
This file was finally amended on December 29 1998 to account for the major
changes made to the driver since V6.4 was released.
d21 1
a21 1
---------------------------------------------------------------------------
d23 1
a23 1
COMPILING
d25 1
a25 2
To compile the driver, simply use make in the src/interfaces/jdbc directory.
This will compile the driver, and build a .jar file (Java ARchive).
d27 2
a28 2
REMEMBER: once you have compiled the driver, it will work on ALL platforms
that support the JDK 1.1 api or later.
d30 1
a30 16
The V6.5 driver introduced support for the JDBC2 specification (which is used
with JDK 1.2 api and later). This caused us some problems because classes
written for JDBC1 and JDBC2 are not compatible, so a large chunk of the
driver had to be re-written to accomodate this.

Running make will build a .jar file (postgresql.jar) which contains the driver.
That jar file will contain the driver for _your_ version of the JDK. That is,
if you run make using JDK 1.1.7, then you will get the JDBC1 driver. If you
run using 1.2 then you will get the JDBC2 driver.

Tip: If you want the driver to run on both JDBC1 or JDBC2, first compile under
JDK 1.1.x, then recompile under JDK 1.2.

In testing, I've done this using 1.1.6 (running under linux), and running make
on my Win95 based Laptop (CygWin B20.1 was used to get a GNUMake - and a
decent shell {bash}).
d32 3
a34 2
When the .jar file is built, it includes all the classes under postgresql, and
the driver automatically selects the correct classes.
d63 2
a64 2
To install the driver, the .class files have to be in the classpath. This can be
done in two ways:
d66 1
a66 3
1: create a directory "postgresql" (and it must be called this) in the current
   directory (or a directory in the class path), and copy all .class files
   into it.
d68 1
a68 7
2: copy the postgres.jar file into a directory, and add it to the classpath.

   ie: under LINUX/SOLARIS (the example here is my linux box):

	export CLASSPATH=.:/usr/local/lib/postgresql.jar:/usr/local/jdk1.1.1/lib/classes.zip

   note: in java, .zip and .jar files hold collections of classes.
d83 1
a83 1
	  Class.forName("postgresql.Driver");
d89 1
d96 1
a96 1
	-Djdbc.drivers=postgresql.Driver
d100 1
a100 1
	java -Djdbc.drivers=postgresql.Driver finder.finder
d125 8
a132 2
Previous versions you had to use an auth argument to tell the driver what
authentication scheme to use when connecting to the database.
d134 1
a134 2
However, this is no longer supported because the database tells the driver
what scheme it's expecting.
a137 3
That's the basics related to this driver. You'll need to read the JDBC Docs
on how to use it.

d140 66
@


1.5
log
@Peter's Mega-Patch for JDBC...

see README_6.3 for list of changes
@
text
@d18 5
a22 2
By the time V6.3 is released, full documentation will be on the web, and in
the distribution.
d34 20
d58 5
a62 4
PS: When you run make, don't worry if you see just one or two calls to javac.
    If, while compiling a class, javac needs another class that's not compiled,
    it will compile it automatically. This reduces the numer of calls to javac
    that make has to do.
d74 3
d150 2
a151 8
By default, the driver doesn't use password authentication. You can enable
this by adding the argument auth. ie:

	jdbc:postgresql:database?user=me&password=mypass&auth=password

or if passing the user & password directly via DriverManager.getConnection():

	jdbc:postgresql:database?auth=password
d153 2
a154 8
PS: Password authentication is enabled if the value of auth starts with 'p'.
    It is case insensitive.

As of postgresql 6.3, Ident (RFC 1413) authentication is also supported.
Simply use auth=ident in the url.

Also, as of 6.3, a system property of postgresql.auth is supported. This
defines the default authentication to use. The auth property overides this.
a165 9
The driver now supports US and European date styles (although it is currently
limited to postgres format).

Basically the US like to format their dates as mm-dd-yyyy, while in Europe,
we like to use dd-mm-yyyy. Postgres supports this by the DateStyle variable.
From psql, you can issue "set datestyle='european';" to set european style,
and "set datestyle='us';" to set the US format. You can see what the current
value for this with "show datestyle;".

d180 4
a183 1
	
d189 1
a189 1
	box, circle, lseg, path, point, polygon
d206 3
a208 6
Peter T Mount, January 11 1998
home email: pmount@@maidast.demon.co.uk	http://www.demon.co.uk/finder
work email: peter@@maidstone.gov.uk	http://www.maidstone.gov.uk

Adrian Hall
     email: adrian@@hottub.org
d210 2
@


1.4
log
@Update of Java driver from Peter Mount.
@
text
@d13 8
d126 1
a126 1
	jdbc:postgresql:database?user=me&password=mypass&auth=y
d130 1
a130 1
	jdbc:postgresql:database?auth=y
d132 1
a132 1
PS: Password authentication is enabled if the value of auth starts with 'y'.
d135 6
d197 1
a197 1
Peter T Mount, October 28 1997
@


1.3
log
@Fix for java to allow password, european dates,from Peter T Mount
@
text
@d124 2
a125 1
PS: 'y' could be anything, aslong as there is something after the '='
@


1.2
log
@From: Peter T Mount <patches@@maidast.demon.co.uk>


This patch fixes a few results in DatabaseMetaData, and updates the README
and TODO files (the later being a new file).

The TODO file lists the things that need to be looked into after 6.2 is
released, and describes the problem with Large Objects.
@
text
@d115 11
d134 28
d182 1
a182 1
Peter T Mount, August 30 1997
d188 1
@


1.1
log
@Get these two files finally committed for Peter...sorry for delay :(
@
text
@d32 10
a139 14

TODO
----

Currently only host authentication is supported. Password authentication
will be in there in a few days.

Incorporating more features from the other driver (esp. in the MetaData's)

Large Object support will also go in there, although it may not be done as
pure JDBC, but as an extra API.

Producing some documentation with javadoc - not all of the sources have them
yet.
@
