|
|||||||||
| Home >> All >> [ postgresql overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
postgresql
Class Driver

java.lang.Objectpostgresql.Driver
- All Implemented Interfaces:
- java.sql.Driver
- public class Driver
- extends java.lang.Object
- implements java.sql.Driver
- extends java.lang.Object
The Java SQL framework allows for multiple database drivers. Each driver should supply a class that implements the Driver interface
The DriverManager will try to load as many drivers as it can find and then for any given connection request, it will ask each driver in turn to try to connect to the target URL.
It is strongly recommended that each Driver class should be small and standalone so that the Driver class can be loaded and queried without bringing in vast quantities of supporting code.
When a Driver class is loaded, it should create an instance of itself and register it with the DriverManager. This means that a user can load and register a driver by doing Class.forName("foo.bah.Driver")
| Field Summary | |
(package private) static int |
MAJORVERSION
|
(package private) static int |
MINORVERSION
|
private java.util.Properties |
props
|
private static java.lang.String[] |
protocols
|
| Constructor Summary | |
Driver()
Construct a new driver and register it with DriverManager |
|
| Method Summary | |
boolean |
acceptsURL(java.lang.String url)
Returns true if the driver thinks it can open a connection to the given URL. |
java.sql.Connection |
connect(java.lang.String url,
java.util.Properties info)
Try to make a database connection to the given URL. |
java.lang.String |
database()
|
int |
getMajorVersion()
Gets the drivers major version number |
int |
getMinorVersion()
Get the drivers minor version number |
java.sql.DriverPropertyInfo[] |
getPropertyInfo(java.lang.String url,
java.util.Properties info)
The getPropertyInfo method is intended to allow a generic GUI tool to discover what properties it should prompt a human for in order to get enough information to connect to a database. |
java.lang.String |
host()
|
boolean |
jdbcCompliant()
Report whether the driver is a genuine JDBC compliant driver. |
static java.sql.SQLException |
notImplemented()
This method was added in v6.5, and simply throws an SQLException for an unimplemented method. |
(package private) java.util.Properties |
parseURL(java.lang.String url,
java.util.Properties defaults)
Constructs a new DriverURL, splitting the specified URL into its component parts |
int |
port()
|
java.lang.String |
property(java.lang.String name)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
MAJORVERSION
static final int MAJORVERSION
- See Also:
- Constant Field Values
MINORVERSION
static final int MINORVERSION
- See Also:
- Constant Field Values
props
private java.util.Properties props
protocols
private static java.lang.String[] protocols
| Constructor Detail |
Driver
public Driver()
throws java.sql.SQLException
- Construct a new driver and register it with DriverManager
| Method Detail |
connect
public java.sql.Connection connect(java.lang.String url, java.util.Properties info) throws java.sql.SQLException
- Try to make a database connection to the given URL. The driver
should return "null" if it realizes it is the wrong kind of
driver to connect to the given URL. This will be common, as
when the JDBC driverManager is asked to connect to a given URL,
it passes the URL to each loaded driver in turn.
The driver should raise an SQLException if it is the right driver to connect to the given URL, but has trouble connecting to the database.
The java.util.Properties argument can be used to pass arbitrary string tag/value pairs as connection arguments. Normally, at least "user" and "password" properties should be included in the properties. Our protocol takes the forms:
jdbc:postgresql://host:port/database?param1=val1&...
- Specified by:
connectin interfacejava.sql.Driver
acceptsURL
public boolean acceptsURL(java.lang.String url) throws java.sql.SQLException
- Returns true if the driver thinks it can open a connection to the
given URL. Typically, drivers will return true if they understand
the subprotocol specified in the URL and false if they don't. Our
protocols start with jdbc:postgresql:
- Specified by:
acceptsURLin interfacejava.sql.Driver
getPropertyInfo
public java.sql.DriverPropertyInfo[] getPropertyInfo(java.lang.String url, java.util.Properties info) throws java.sql.SQLException
- The getPropertyInfo method is intended to allow a generic GUI
tool to discover what properties it should prompt a human for
in order to get enough information to connect to a database.
Note that depending on the values the human has supplied so far, additional values may become necessary, so it may be necessary to iterate through several calls to getPropertyInfo
- Specified by:
getPropertyInfoin interfacejava.sql.Driver
getMajorVersion
public int getMajorVersion()
- Gets the drivers major version number
- Specified by:
getMajorVersionin interfacejava.sql.Driver
getMinorVersion
public int getMinorVersion()
- Get the drivers minor version number
- Specified by:
getMinorVersionin interfacejava.sql.Driver
jdbcCompliant
public boolean jdbcCompliant()
- Report whether the driver is a genuine JDBC compliant driver. A
driver may only report "true" here if it passes the JDBC compliance
tests, otherwise it is required to return false. JDBC compliance
requires full support for the JDBC API and full support for SQL 92
Entry Level.
For PostgreSQL, this is not yet possible, as we are not SQL92 compliant (yet).
- Specified by:
jdbcCompliantin interfacejava.sql.Driver
parseURL
java.util.Properties parseURL(java.lang.String url, java.util.Properties defaults) throws java.sql.SQLException
- Constructs a new DriverURL, splitting the specified URL into its
component parts
host
public java.lang.String host()
port
public int port()
database
public java.lang.String database()
property
public java.lang.String property(java.lang.String name)
notImplemented
public static java.sql.SQLException notImplemented()
- This method was added in v6.5, and simply throws an SQLException
for an unimplemented method. I decided to do it this way while
implementing the JDBC2 extensions to JDBC, as it should help keep the
overall driver size down.
|
|||||||||
| Home >> All >> [ postgresql overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
postgresql.Driver