提交 ea794574 编写于 作者: B Barry Lind

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
上级 272bf59d
此差异已折叠。
This short document is provided to help programmers through the internals of
the PostgreSQL JDBC driver.
Last update: January 17 2001 peter@retep.org.uk
build.xml
---------
As of 7.1, we now use the ANT build tool to build the driver. ANT is part of
the Apache/Jakarta project, and provides far superior build capabilities. You
can find ANT from http://jakarta.apache.org/ant/index.html and being pure java
it will run on any java platform.
So far I've tested it under JDK1.2.x & JDK1.3 (both Linux & NT) but not yet with
JDK1.1.8. Because of the latter the Makefile still works for now, but should be
gone for 7.2.
Anyhow, to build, simply type ant and the .jar file will be created and put into
the jars directory.
Tip: If you run ant from the sources root directory (ie: where the configure
script is located) you will find another build.xml file. It is advised to run
ant from that directory as it will then compile some auxilary Java/JDBC
utilities that are located under the /contrib/retep directory.
Makefile
--------
Prior to 7.1, all compilation must be done by using Make. This is because there
are three versions of the driver, one for JDBC1 (for JDK 1.1.x) and the others
for JDBC2 (for JDK 1.2 or later, one standard and one enterprise).
As of 7.1, ANT is the build tool of choice. Just compare Makefile and build.xml
to see why! Make just isn't suited to Java.
Building with just the JDK
--------------------------
This is not advised, simply because you have to make sure you include the
correct classes, and the fact that org.postgresql.Driver is built on the fly.
Also, javac won't pick up all the classes because some (org.postgresql.geometric
for example) are loaded dynamically.
org/postgresql/Driver.java.in
-----------------------------
Because there are three versions of the driver, the org.postgresql.Driver class
is built dynamically. To build correctly ANT copies the Driver.java.in file to
Driver.java replacing certain values according to the required driver.
The replaced values are of the format %VALUE%, ie: %MAJORVERSION% is replaced
with 7 in the 7.1 version of the driver.
postgresql.jar
--------------
This jar file is produced by ANT, and contains the driver for your JDK platform.
If you downloaded a precompiled binary from the web, you may find that the
jar file will be named differently. These are identical to this file but are
named according to the backend and jdk versions.
The naming convention is of the form: jdbc-#.#-#.##.jar
ie: for 7.1
jdbc-7.1-1.1.jar JDBC Driver for JDK1.1.8
jdbc-7.1-1.2.jar JDBC Driver for JDK1.2 & JDK1.3
jdbc-7.1-1.2ent.jar JDBC Driver for JDK1.2 & JDK1.3 Enterprise Editions
If in the future there are any 1.3 specific classes then there will be two new
jar files.
Note: All the precompiled binaries are built under Linux.
jdbc.jpx
--------
This is a JBuilder4 project file. It's here to allow JBuilder to be used to
develop the driver. Mainly for it's Editor's features like syntax checking and
auto-completion etc.
IMPORTANT: You CAN NOT build the driver from within JBuilder. You must use ANT.
This is because of the three versions of the JDK. If you try to use
JBuilder, it will try to build everything, and it will just not work.
Importing packages
------------------
In user code, you may have to import one or more packages, if and only if you
are using the non jdbc extensions (like FastPath, or LargeObject).
DO NOT import the postgresql, postgresql.jdbc1 or postgresql.jdbc2 packages!
Internally, some classes will import the packages when there is a link between
them and the other packages. However, the above rule still applies. It's there
because Javac becomes confused between the different places that similar class
names are present.
However, there are places where they need to refer to classes in the postgresql
package. In this case, import the individual classes, and not the entire
package.
ie: import postgresql.Field
NOT import postgresql.*
Package Layout
--------------
The driver is split into several packages:
org.postgresql core classes that can be accessed by user code
org.postgresql.core core classes not normally used externally
org.postgresql.jdbc1 classes used only in implementing JDBC 1
org.postgresql.jdbc2 classes used only in implementing JDBC 2
org.postgresql.fastpath FastPath to backend functions
org.postgresql.geometric 2D Geometric types mapped to Java Objects
org.postgresql.largeobject Low level Large Object access
org.postgresql.util Utility classes
Package org.postgresql
------------------
This package holds the core classes.
Driver registers the driver when it's loaded, and determines which
Connection class (in jdbc1 or jdbc2 packages) to use when
connecting to a database.
Field Used internally to represent a Field
PG_Stream Used internally to manage the network stream.
PostgresqlDataSource
Exists in the Java2 Enterprise edition driver only and is the
enterprise equivalent to Driver
These classes contains common code that is not dependent to the
two JDBC specifications.
Connection Common code used in Connections, mainly Network Protocol stuff.
ResultSet Common code used in ResultSet's
Package org.postgresql.core
-----------------------
New in 7.1, this is where core classes (common to all versions) will exist. Any
new class that would have gone into org.postgresql must go in here instead.
BytePoolDim1 Handles a pool of byte[] arrays.
BytePoolDim2 Handles a pool of byte[][] arrays
MemoryPool Interface for managing MemoryPools. Not used (yet).
ObjectPool Interface for an Object Pool
SimpleObjectPool Class that implements ObjectPool and used by BytePoolDim#
Encoding Character encoding logic, mainly for Connection and PG_Stream.
Package org.postgresql.fastpath
---------------------------
Fastpath Handles executing a function on the PostgreSQL Backend
FastpathArg Defines an argument for a function call
Package org.postgresql.geometric
----------------------------
PGbox Maps to postgresql type box
PGcircle Maps to postgresql type circle
PGline Maps to postgresql type line
PGlseg Maps to postgresql type lseg
PGpath Maps to postgresql type path
PGpoint Maps to postgresql type point
PGpolygon Maps to postgresql type polygon
Package org.postgresql.jdbc1
------------------------
The classes in this package handle the JDBC 1 Specification, for JDK 1.1.x
All interfaces in the java.sql package are present here.
Package org.postgresql.jdbc2
------------------------
The classes in this package handle the JDBC 2 Specification, for JDK 1.2
All interfaces in the java.sql, and javax.sql packages are present here.
Package org.postgresql.largeobject
------------------------------
LargeObject Represents an open LargeObject
LargeObjectManager Handles the opening and deleting of LargeObjects
Package org.postgresql.util
-----------------------
PGmoney Maps to postgresql type money
PGobject Used to represent postgresql types that have no Java equivalent
PGtokenizer Helper class for the geometric types
Serialize Used to serialise Java objects into tabes, rather than Blobs
UnixCrypt Used to handle crypt authentication
This is a simple readme describing how to compile and use the jdbc driver.
This file was amended on January 17 2001 to reflect the changes made in the 7.1
release.
---------------------------------------------------------------------------
This isn't a guide on how to use JDBC - for that refer to Javasoft's web site:
This isn't a guide on how to use JDBC - for that refer to sun's web site:
http://www.javasoft.com/
http://java.sun.com/
For problems with this driver, then refer to the postgres-jdbc email
list:
......@@ -17,10 +14,6 @@ list:
The Driver's home page is:
http://jdbc.postgresql.org/
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 ;-) )
---------------------------------------------------------------------------
......@@ -39,20 +32,10 @@ the directory PREFIX/share/java.
That jar file will contain the driver for _your_ version of the JDK.
Note: As of 7.1, you can build from the top-level directory or from
src/interfaces/jdbc.
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.
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.
Possible problems
You may see a message similar to:
......@@ -63,11 +46,8 @@ postgresql/Driver.java:87: interface java.sql.Connection is an interface. It can
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, 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
If you are still having problems, prebuilt versions of the driver
are available at http://jdbc.postgresql.org/
---------------------------------------------------------------------------
......@@ -79,9 +59,6 @@ ie: under LINUX/SOLARIS (the example here is my linux box):
export CLASSPATH=.:/usr/local/pgsql/share/java/postgresql.jar
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.
---------------------------------------------------------------------------
USING THE DRIVER
......@@ -177,10 +154,6 @@ For example:
Large Object API
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.
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:
......@@ -227,28 +200,6 @@ SQLException to be thrown.
------------------
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).
------------------
JDBC supports database specific data types using the getObject() call. The
following types have their own Java equivalents supplied by the driver:
......@@ -269,9 +220,3 @@ syntax for writing these to the database.
---------------------------------------------------------------------------
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.
......@@ -6,7 +6,7 @@
This file now requires Ant 1.4.1. 2002-04-18
$Header: /cvsroot/pgsql/src/interfaces/jdbc/Attic/build.xml,v 1.29 2002/09/25 07:01:30 barry Exp $
$Header: /cvsroot/pgsql/src/interfaces/jdbc/Attic/build.xml,v 1.30 2002/10/20 00:10:55 barry Exp $
-->
......@@ -156,10 +156,14 @@
<filter token="JDBCCONNECTCLASS" value="${connectclass}" />
<filter token="DEF_PGPORT" value="${def_pgport}" />
<fail unless="major" message="'major' undefined. Please follow the directions in README."/>
<fail unless="minor" message="'minor' undefined. Please follow the directions in README."/>
<!-- Put a check for the current version here -->
<!-- now copy and filter the file -->
<copy file="${package}/Driver.java.in"
overwrite="true"
tofile="${package}/Driver.java"
filtering="yes" />
......
<?xml version="1.0" encoding="UTF-8"?>
<!--JBuilder XML Project-->
<project>
<property category="runtime.0" name="RunnableType" value="com.borland.jbuilder.runtime.ApplicationRunner" />
<property category="runtime.0" name="jsprunner.docbase" value="." />
<property category="runtime.0" name="jsprunner.jspfile" value="E%|/docs/java/xml/example6" />
<property category="sys" name="BackupPath" value="bak" />
<property category="sys" name="CheckStable" value="1" />
<property category="sys" name="Company" value="" />
<property category="sys" name="Copyright" value="Copyright (c) 2001" />
<property category="sys" name="DefaultPackage" value="org.postgresql.core" />
<property category="sys" name="Description" value="" />
<property category="sys" name="DocPath" value="doc" />
<property category="sys" name="ExcludeClassEnabled" value="0" />
<property category="sys" name="JDK" value="java 1.3.0-C" />
<property category="sys" name="LastTag" value="0" />
<property category="sys" name="Libraries" value="JUnit" />
<property category="sys" name="MakeStable" value="0" />
<property category="sys" name="OutPath" value="build" />
<property category="sys" name="SourcePath" value="." />
<property category="sys" name="Title" value="" />
<property category="sys" name="Version" value="1.0" />
<property category="sys" name="WorkingDirectory" value="." />
<node type="Package" name="org.postgresql.core" />
<file path="build.xml" />
<file path="CHANGELOG" />
<file path="Implementation" />
<file path="README" />
<file path="org/postgresql/jdbc2/UpdateableResultSet.java" />
</project>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册