Package org.eclipse.jetty.server.session
Class DatabaseAdaptor
java.lang.Object
org.eclipse.jetty.server.session.DatabaseAdaptor
DatabaseAdaptor
Handles differences between databases.
Postgres uses the getBytes and setBinaryStream methods to access
a "bytea" datatype, which can be up to 1Gb of binary data. MySQL
is happy to use the "blob" type and getBlob() methods instead.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
adaptTo
(DatabaseMetaData dbMeta) convertIdentifier
(String identifier) Convert a camel case identifier into either upper or lower depending on the way the db stores identifiers.getBlobInputStream
(ResultSet result, String columnName) protected Connection
Get a connection from the driver or datasource.void
boolean
boolean
rowId is a reserved word for Oracle, so change the name of this columnvoid
setBlobType
(String blobType) void
void
setDatasourceName
(String jndi) void
setDriverInfo
(String driverClassName, String connectionUrl) Configure jdbc connection information via a jdbc Drivervoid
setDriverInfo
(Driver driverClass, String connectionUrl) Configure jdbc connection information via a jdbc Drivervoid
setLongType
(String longType) void
setStringType
(String stringType) toString()
-
Field Details
-
_blobType
-
_longType
-
_stringType
-
-
Constructor Details
-
DatabaseAdaptor
public DatabaseAdaptor()
-
-
Method Details
-
adaptTo
- Throws:
SQLException
-
setBlobType
-
getBlobType
-
setLongType
-
getLongType
-
setStringType
-
getStringType
-
convertIdentifier
Convert a camel case identifier into either upper or lower depending on the way the db stores identifiers.- Parameters:
identifier
- the raw identifier- Returns:
- the converted identifier
-
getDBName
-
getBlobInputStream
- Throws:
SQLException
-
isEmptyStringNull
public boolean isEmptyStringNull() -
isRowIdReserved
public boolean isRowIdReserved()rowId is a reserved word for Oracle, so change the name of this column- Returns:
- true if db in use is oracle
-
setDriverInfo
Configure jdbc connection information via a jdbc Driver- Parameters:
driverClassName
- the driver classnameconnectionUrl
- the driver connection url
-
setDriverInfo
Configure jdbc connection information via a jdbc Driver- Parameters:
driverClass
- the driver classconnectionUrl
- the driver connection url
-
setDatasource
-
setDatasourceName
-
getDatasourceName
-
getDatasource
-
getDriverClassName
-
getDriver
-
getConnectionUrl
-
initialize
- Throws:
Exception
-
getConnection
Get a connection from the driver or datasource.- Returns:
- the connection for the datasource
- Throws:
SQLException
- if unable to get the connection
-
toString
-