public abstract class BaseDataSource
extends java.lang.Object
implements javax.naming.Referenceable
Constructor and Description |
---|
BaseDataSource() |
Modifier and Type | Method and Description |
---|---|
protected javax.naming.Reference |
createReference()
Generates a reference using the appropriate object factory.
|
java.lang.String |
getApplicationName() |
boolean |
getBinaryTransfer()
Gets the protocol transfer mode.
|
java.lang.String |
getBinaryTransferDisable()
Gets override set of Oid values that have binary transfer disabled.
|
java.lang.String |
getBinaryTransferEnable()
Gets override set of Oid values that have binary transfer enabled.
|
java.lang.String |
getCompatible() |
java.sql.Connection |
getConnection()
Gets a connection to the PostgreSQL database.
|
java.sql.Connection |
getConnection(java.lang.String user,
java.lang.String password)
Gets a connection to the PostgreSQL database.
|
java.lang.String |
getDatabaseName()
Gets the name of the PostgreSQL database, running on the server identified
by the serverName property.
|
abstract java.lang.String |
getDescription()
Gets a description of this DataSource-ish thing.
|
int |
getLoginTimeout() |
int |
getLogLevel() |
java.io.PrintWriter |
getLogWriter()
Gets the log writer used to log connections opened.
|
java.lang.String |
getPassword()
Gets the password to connect with by default.
|
int |
getPortNumber()
Gets the port which the PostgreSQL server is listening on for TCP/IP
connections.
|
int |
getPrepareThreshold()
Gets the default threshold for enabling server-side prepare.
|
int |
getProtocolVersion() |
int |
getReceiveBufferSize()
Gets the write buffer size of TCP/IP socket.
|
javax.naming.Reference |
getReference() |
int |
getSendBufferSize()
Gets the send buffer size of TCP/IP socket.
|
java.lang.String |
getServerName()
Gets the name of the host the PostgreSQL database is running on.
|
int |
getSocketTimeout() |
boolean |
getSsl()
Gets SSL encryption setting.
|
java.lang.String |
getSslfactory()
Gets the name of the
SSLSocketFactory used for connections. |
java.lang.String |
getStringType() |
boolean |
getTcpKeepAlive() |
int |
getUnknownLength() |
java.lang.String |
getUrl()
Generates a DriverManager URL from the other properties supplied.
|
java.lang.String |
getUser()
Gets the user to connect as by default.
|
void |
initializeFrom(BaseDataSource source) |
boolean |
isColumnSanitiserDisabled()
Returns the state of column sanitiser optimisation.
|
protected void |
readBaseObject(java.io.ObjectInputStream in) |
void |
setApplicationName(java.lang.String applicationName) |
void |
setBinaryTransfer(boolean enabled)
Sets protocol transfer mode.
|
void |
setBinaryTransferDisable(java.lang.String oidList)
Add types to the override set of
Oid values that will not be used for binary transfer. |
void |
setBinaryTransferEnable(java.lang.String oidList)
Add types to the override set of
Oid values used for binary transfer. |
void |
setCompatible(java.lang.String compatible) |
void |
setDatabaseName(java.lang.String databaseName)
Sets the name of the PostgreSQL database, running on the server identified
by the serverName property.
|
void |
setDisableColumnSanitiser(boolean disableColumnSanitiser)
Set the state of column sanitiser optimisation.
|
void |
setLoginTimeout(int i)
Set the login timeout, in seconds.
|
void |
setLogLevel(int logLevel) |
void |
setLogWriter(java.io.PrintWriter printWriter)
The DataSource will note every connection opened to the provided log writer.
|
void |
setPassword(java.lang.String password)
Sets the password to connect with by default.
|
void |
setPortNumber(int portNumber)
Gets the port which the PostgreSQL server is listening on for TCP/IP
connections.
|
void |
setPrepareThreshold(int count)
Sets the default threshold for enabling server-side prepare.
|
void |
setProtocolVersion(int protocolVersion) |
void |
setReceiveBufferSize(int nbytes)
Sets the write buffer size of TCP/IP socket.
|
void |
setSendBufferSize(int nbytes)
Sets the send buffer size of TCP/IP socket.
|
void |
setServerName(java.lang.String serverName)
Sets the name of the host the PostgreSQL database is running on.
|
void |
setSocketTimeout(int seconds)
Sets the socket timeout (SOTimeout), in seconds
|
void |
setSsl(boolean enabled)
Set whether the connection will be SSL encrypted or not.
|
void |
setSslfactory(java.lang.String classname)
Set the name of the
SSLSocketFactory to use for connections. |
void |
setStringType(java.lang.String stringType) |
void |
setTcpKeepAlive(boolean enabled) |
void |
setUnknownLength(int unknownLength) |
void |
setUrl(java.lang.String url)
+ * Sets properties from a DriverManager URL.
|
void |
setUser(java.lang.String user)
Sets the user to connect as by default.
|
protected void |
writeBaseObject(java.io.ObjectOutputStream out) |
public java.sql.Connection getConnection() throws java.sql.SQLException
java.sql.SQLException
- Occurs when the database connection cannot be established.public java.sql.Connection getConnection(java.lang.String user, java.lang.String password) throws java.sql.SQLException
java.sql.SQLException
- Occurs when the database connection cannot be established.public int getLoginTimeout() throws java.sql.SQLException
java.sql.SQLException
public void setLoginTimeout(int i) throws java.sql.SQLException
java.sql.SQLException
public java.io.PrintWriter getLogWriter() throws java.sql.SQLException
java.sql.SQLException
public void setLogWriter(java.io.PrintWriter printWriter) throws java.sql.SQLException
java.sql.SQLException
public java.lang.String getServerName()
public void setServerName(java.lang.String serverName)
public java.lang.String getCompatible()
public void setCompatible(java.lang.String compatible)
public int getLogLevel()
public void setLogLevel(int logLevel)
public int getProtocolVersion()
public void setProtocolVersion(int protocolVersion)
public java.lang.String getDatabaseName()
public void setDatabaseName(java.lang.String databaseName)
public abstract java.lang.String getDescription()
public java.lang.String getUser()
public void setUser(java.lang.String user)
public java.lang.String getPassword()
public void setPassword(java.lang.String password)
public int getPortNumber()
public void setPortNumber(int portNumber)
public void setPrepareThreshold(int count)
PGConnection.setPrepareThreshold(int)
for details.count
- the number of times a statement object must be reused before server-side
prepare is enabled.public int getReceiveBufferSize()
public void setReceiveBufferSize(int nbytes)
public int getSendBufferSize()
public void setSendBufferSize(int nbytes)
public int getPrepareThreshold()
setPrepareThreshold(int)
public void setUnknownLength(int unknownLength)
public int getUnknownLength()
public void setSocketTimeout(int seconds)
public int getSocketTimeout()
public void setSsl(boolean enabled)
enabled
- if true
, connect with SSL.public boolean getSsl()
true
if connections will be encrypted with SSL.public void setSslfactory(java.lang.String classname)
SSLSocketFactory
to use for connections.
Use org.postgresql.ssl.NonValidatingFactory
if you don't want certificate validation.classname
- name of a subclass of javax.net.ssl.SSLSocketFactory
or null
for the default implementation.public java.lang.String getSslfactory()
SSLSocketFactory
used for connections.null
if the default implementation is used.public void setApplicationName(java.lang.String applicationName)
public java.lang.String getApplicationName()
public void setTcpKeepAlive(boolean enabled)
public boolean getTcpKeepAlive()
public void setBinaryTransfer(boolean enabled)
enabled
- True if the binary transfer mode is used for supported field types,
false if text based transfer is used.public boolean getBinaryTransfer()
setBinaryTransfer(boolean)
public void setBinaryTransferEnable(java.lang.String oidList)
Oid
values used for binary transfer.oidList
- The comma separated list of Oids. Either textual or numeric value.public java.lang.String getBinaryTransferEnable()
setBinaryTransferEnable(String)
public void setBinaryTransferDisable(java.lang.String oidList)
Oid
values that will not be used for binary transfer.
This overrides any values in the driver detault set or values set with setBinaryTransferEnable(String)
.oidList
- The comma separated list of Oids. Either textual or numeric value.public java.lang.String getBinaryTransferDisable()
setBinaryTransferDisable(String)
public java.lang.String getStringType()
public void setStringType(java.lang.String stringType)
public boolean isColumnSanitiserDisabled()
public void setDisableColumnSanitiser(boolean disableColumnSanitiser)
boolean
- new optimisation statepublic java.lang.String getUrl()
public void setUrl(java.lang.String url) throws java.sql.SQLException
java.sql.SQLException
protected javax.naming.Reference createReference()
public javax.naming.Reference getReference() throws javax.naming.NamingException
getReference
in interface javax.naming.Referenceable
javax.naming.NamingException
protected void writeBaseObject(java.io.ObjectOutputStream out) throws java.io.IOException
java.io.IOException
protected void readBaseObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void initializeFrom(BaseDataSource source) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException