Klasse DriverWrapper
- Alle implementierten Schnittstellen:
Driver
This method currently works with J2EE DataSource implementations, and with DriverManager framework.
Simply replace the "jdbc:postgresql:" with a "jdbc:postgresql_postGIS:" in the jdbc URL.
When using the drivermanager, you need to initialize DriverWrapper
instead of (or in addition to)
Driver
. When using a J2EE DataSource implementation, set the driver class property in the
datasource config, the following works for jboss:
<driver-class>io.github.sebasbaumh.postgis.DriverWrapper</driver-class>
If you don't like or want to use the DriverWrapper
, you can just call registerDataTypes(Connection)
on your Connection
.
This wrapper always uses EWKB as representation, and thus works against PostGIS servers starting from 2.3.
original author Markus Schaber <[email protected]>
reworked by Sebastian Baumhekel
-
Feldübersicht
Felder -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungboolean
acceptsURL
(String url) Check whether the driver thinks he can handle the given URL.connect
(String url, Properties info) Creates a postgresql connection, and then adds the PostGIS data types to it calling addpgtypes()static void
registerDataTypes
(Connection conn) Registers all datatypes on the given connection, supports wrapped connections unlikeregisterDataTypes(PGConnection)
.static void
registerDataTypes
(org.postgresql.PGConnection pgconn) Registers all datatypes on the given connection.Von Klasse geerbte Methoden org.postgresql.Driver
deregister, getMajorVersion, getMinorVersion, getPropertyInfo, getSharedTimer, getVersion, isRegistered, jdbcCompliant, notImplemented, parseURL, register
-
Felddetails
-
POSTGIS_PROTOCOL
PostGIS custom JDBC protocol.- Siehe auch:
-
POSTGRES_PROTOCOL
PostgreSQL JDBC protocol.- Siehe auch:
-
-
Konstruktordetails
-
DriverWrapper
public DriverWrapper()Default constructor.
-
-
Methodendetails
-
registerDataTypes
Registers all datatypes on the given connection, supports wrapped connections unlikeregisterDataTypes(PGConnection)
.- Parameter:
conn
-Connection
- Löst aus:
SQLException
- if theConnection
is neither anPGConnection
, nor aConnection
wrapped around anPGConnection
.
-
registerDataTypes
Registers all datatypes on the given connection.- Parameter:
pgconn
-PGConnection
- Löst aus:
SQLException
-
acceptsURL
Check whether the driver thinks he can handle the given URL.- Angegeben von:
acceptsURL
in SchnittstelleDriver
- Setzt außer Kraft:
acceptsURL
in Klasseorg.postgresql.Driver
- Parameter:
url
- the URL of the driver- Gibt zurück:
- true if this driver accepts the given URL
- Siehe auch:
-
connect
@Nullable @Owning public Connection connect(@Nonnull String url, @Nonnull Properties info) throws SQLException Creates a postgresql connection, and then adds the PostGIS data types to it calling addpgtypes()- Angegeben von:
connect
in SchnittstelleDriver
- Setzt außer Kraft:
connect
in Klasseorg.postgresql.Driver
- Parameter:
url
- the URL of the database to connect toinfo
- a list of arbitrary tag/value pairs as connection arguments- Gibt zurück:
- a connection to the URL or null if it isnt us
- Löst aus:
SQLException
- if a database access error occurs- Siehe auch:
-
getParentLogger
- Angegeben von:
getParentLogger
in SchnittstelleDriver
- Setzt außer Kraft:
getParentLogger
in Klasseorg.postgresql.Driver
-