Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit99048ac

Browse files
committed
Get these two files finally committed for Peter...sorry for delay :(
1 parentc5d4990 commit99048ac

File tree

2 files changed

+241
-0
lines changed

2 files changed

+241
-0
lines changed

‎src/interfaces/jdbc/Makefile

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#-------------------------------------------------------------------------
2+
#
3+
# Makefile
4+
# Makefile for Java JDBC interface
5+
#
6+
# IDENTIFICATION
7+
# $Header: /cvsroot/pgsql/src/interfaces/jdbc/Attic/Makefile,v 1.1 1997/09/26 08:22:21 scrappy Exp $
8+
#
9+
#-------------------------------------------------------------------------
10+
11+
# These are commented out, but would be included in the postgresql source
12+
13+
FIND= find
14+
JAR= jar
15+
JAVA= java
16+
JAVAC= javac
17+
JAVADOC= javadoc
18+
RM= rm -f
19+
20+
# This defines how to compile a java class
21+
.java.class:
22+
$(JAVAC)$<
23+
24+
.SUFFIXES:.class .java
25+
.PHONY:all clean doc
26+
27+
all: postgresql.jar
28+
29+
doc:
30+
$(JAVADOC) -public postgresql
31+
32+
OBJS=postgresql/CallableStatement.class\
33+
postgresql/Connection.class\
34+
postgresql/DatabaseMetaData.class\
35+
postgresql/Driver.class\
36+
postgresql/Field.class\
37+
postgresql/PG_Object.class\
38+
postgresql/PG_Stream.class\
39+
postgresql/PGbox.class\
40+
postgresql/PGcircle.class\
41+
postgresql/PGlobj.class\
42+
postgresql/PGlseg.class\
43+
postgresql/PGpath.class\
44+
postgresql/PGpoint.class\
45+
postgresql/PGpolygon.class\
46+
postgresql/PGtokenizer.class\
47+
postgresql/PreparedStatement.class\
48+
postgresql/ResultSet.class\
49+
postgresql/ResultSetMetaData.class\
50+
postgresql/Statement.class
51+
52+
postgresql.jar:$(OBJS)
53+
$(JAR) -c0vf$@$^
54+
55+
# This rule removes any temporary and compiled files from the source tree.
56+
clean:
57+
$(FIND). -name"*~" -exec$(RM) {}\;
58+
$(FIND). -name"*.class" -exec$(RM) {}\;
59+
$(RM) postgres.jar
60+
61+
#######################################################################
62+
# This helps make workout what classes are from what source files
63+
#
64+
# Java is unlike C in that one source file can generate several
65+
# _Different_ file names
66+
#
67+
postgresql/CallableStatement.class:postgresql/CallableStatement.java
68+
postgresql/Connection.class:postgresql/Connection.java
69+
postgresql/DatabaseMetaData.class:postgresql/DatabaseMetaData.java
70+
postgresql/Driver.class:postgresql/Driver.java
71+
postgresql/Field.class:postgresql/Field.java
72+
postgresql/PG_Object.class:postgresql/PG_Object.java
73+
postgresql/PG_Stream.class:postgresql/PG_Stream.java
74+
postgresql/PGbox.class:postgresql/PGbox.java
75+
postgresql/PGcircle.class:postgresql/PGcircle.java
76+
postgresql/PGlobj.class:postgresql/PGlobj.java
77+
postgresql/PGlseg.class:postgresql/PGlseg.java
78+
postgresql/PGpath.class:postgresql/PGpath.java
79+
postgresql/PGpoint.class:postgresql/PGpoint.java
80+
postgresql/PGpolygon.class:postgresql/PGpolygon.java
81+
postgresql/PGtokenizer.class:postgresql/PGtokenizer.java
82+
postgresql/PreparedStatement.class:postgresql/PreparedStatement.java
83+
postgresql/ResultSet.class:postgresql/ResultSet.java
84+
postgresql/ResultSetMetaData.class:postgresql/ResultSetMetaData.java
85+
postgresql/Statement.class:postgresql/Statement.java
86+
87+
88+
89+

‎src/interfaces/jdbc/README

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
This is a simple readme describing how to compile and use the jdbc driver.
2+
3+
This isn't a guide on how to use JDBC - for that refer to Javasoft's web site:
4+
5+
http://www.javasoft.com
6+
7+
or the JDBC mailing list:
8+
9+
jdbc@java.blackdown.org
10+
11+
http://www.blackdown.org
12+
13+
---------------------------------------------------------------------------
14+
15+
COMPILING
16+
17+
To compile the driver, simply use make in the src/interfaces/jdbc directory.
18+
This will compile the driver, and build a .jar file (Java ARchive).
19+
20+
REMEMBER: once you have compiled the driver, it will work on ALL platforms
21+
that support the JDK 1.1 api or later.
22+
23+
That means you don't have to compile it on every platform. Believe me, I
24+
still hear from people who ask me "I've compiled it ok under Solaris, but it
25+
won't compile under Linux" - there's no difference.
26+
27+
PS: When you run make, don't worry if you see just one or two calls to javac.
28+
If, while compiling a class, javac needs another class that's not compiled,
29+
it will compile it automatically. This reduces the numer of calls to javac
30+
that make has to do.
31+
32+
---------------------------------------------------------------------------
33+
34+
INSTALLING THE DRIVER
35+
36+
To install the driver, the .class files have to be in the classpath. This can be
37+
done in two ways:
38+
39+
1: create a directory "postgresql" (and it must be called this) in the current
40+
directory (or a directory in the class path), and copy all .class files
41+
into it.
42+
43+
2: copy the postgres.jar file into a directory, and add it to the classpath.
44+
45+
ie: under LINUX/SOLARIS (the example here is my linux box):
46+
47+
export CLASSPATH=.:/usr/local/lib/postgresql.jar:/usr/local/jdk1.1.1/lib/classes.zip
48+
49+
note: in java, .zip and .jar files hold collections of classes.
50+
51+
---------------------------------------------------------------------------
52+
53+
USING THE DRIVER
54+
55+
To use the driver, you must introduce it to JDBC. Again, there's two ways
56+
of doing this:
57+
58+
1: Hardcoded.
59+
60+
This method hardcodes your driver into your application/applet. You
61+
introduce the driver using the following snippet of code:
62+
63+
try {
64+
Class.forName("postgresql.Driver");
65+
} catch(Exception e) {
66+
// your error handling code goes here
67+
}
68+
69+
Remember, this method restricts your code to just the postgresql database.
70+
71+
2: Parameters
72+
73+
This method specifies the driver from the command line. When running the
74+
application, you specify the driver using the option:
75+
76+
-Djdbc.drivers=postgresql.Driver
77+
78+
eg: This is an example of running one of my other projects with the driver:
79+
80+
java -Djdbc.drivers=postgresql.Driver finder.finder
81+
82+
note: This method only works with Applications (not for Applets).
83+
However, the application is not tied to one driver, so if you needed
84+
to switch databases (why I don't know ;-) ), you don't need to
85+
recompile the application (as long as you havent hardcoded the url's).
86+
87+
---------------------------------------------------------------------------
88+
89+
JDBC URL syntax
90+
91+
The driver recognises JDBC URL's of the form:
92+
93+
jdbc:postgresql:database
94+
95+
jdbc:postgresql://host/database
96+
97+
jdbc:postgresql://host:port/database
98+
99+
Also, you can supply both username and passwords as arguments, by appending
100+
them to the URL. eg:
101+
102+
jdbc:postgresql:database?user=me
103+
jdbc:postgresql:database?user=me&password=mypass
104+
105+
---------------------------------------------------------------------------
106+
107+
That's the basics related to this driver. You'll need to read the JDBC Docs
108+
on how to use it.
109+
110+
POSTGRESQL SPECIFICS
111+
--------------------
112+
113+
JDBC supports database specific data types using the getObject() call. The
114+
following types have their own Java equivalents supplied by the driver:
115+
116+
box, circle, lseg, path, point, polygon
117+
118+
When using the getObject() method on a resultset, it returns a PG_Object,
119+
which holds the postgres type, and its value. This object also supports
120+
methods to retrive these types.
121+
122+
Eg: column 3 contains a point, and rs is the ResultSet:
123+
124+
PG_Object o = (PG_Object)rs.getObject(3);
125+
PGpoint p = o.getPoint();
126+
System.out.println("point returned x="+p.x+", y="+p.y);
127+
128+
Also, when using these classes, their toString() methods return the correct
129+
syntax for writing these to the database.
130+
131+
TODO
132+
----
133+
134+
Currently only host authentication is supported. Password authentication
135+
will be in there in a few days.
136+
137+
Incorporating more features from the other driver (esp. in the MetaData's)
138+
139+
Large Object support will also go in there, although it may not be done as
140+
pure JDBC, but as an extra API.
141+
142+
Producing some documentation with javadoc - not all of the sources have them
143+
yet.
144+
145+
---------------------------------------------------------------------------
146+
147+
Peter T Mount, August 30 1997
148+
home email: pmount@maidast.demon.co.ukhttp://www.demon.co.uk/finder
149+
work email: peter@maidstone.gov.ukhttp://www.maidstone.gov.uk
150+
151+
Adrian Hall
152+
email: adrian@hottub.org

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp