Class JtdsConnection
- java.lang.Object
-
- net.sourceforge.jtds.jdbc.JtdsConnection
-
- All Implemented Interfaces:
java.lang.AutoCloseable,java.sql.Connection,java.sql.Wrapper
public class JtdsConnection extends java.lang.Object implements java.sql.ConnectionjTDS implementation of the java.sql.Connection interface.Implementation notes:
- Environment setting code carried over from old jTDS otherwise generally a new implementation of Connection.
- Connection properties and SQLException text messages are loaded from a properties file.
- Character set choices are also loaded from a resource file and the original Encoder class has gone.
- Prepared SQL statements are converted to procedures in the prepareSQL method.
- Use of Stored procedures is optional and controlled via connection property.
- This Connection object maintains a table of weak references to associated statements. This allows the connection object to control the statements (for example to close them) but without preventing them being garbage collected in a pooled environment.
- Version:
- $Id: JtdsConnection.java,v 1.119.2.14 2010-05-17 10:27:00 ickzon Exp $
- Author:
- Mike Hutchinson, Alin Sinpalean
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringappNameThe application name.private booleanautoCommitDefault auto commit state.private TdsCorebaseTdsThe cored TDS protocol object.private intbatchSizeThe maximum size of a batch.private java.lang.StringbindAddressThe local address to bind to when connecting to a database via TCP/IP.private java.io.FilebufferDirThe directory to buffer data toprivate intbufferMaxMemoryThe global buffer memory limit for all connections (in kilobytes).private intbufferMinPacketsThe minimum number of packets per statement to buffer to memory.private TdsCorecachedTdsA cachedTdsCoreinstance to reuse on new statements.private CharsetInfocharsetInfoJava charset for encoding.private booleancharsetSpecifiedTrue if user specifies an explicit charset.private booleanclosedTrue if this connection is closed.private byte[]collationSQL Server 2000 collation.private static int[]connectionsthe number of currently open connectionsprivate java.lang.StringcurrentDatabaseThe current database name.private intcursorSequenceNoCursor unique ID number.private intdatabaseMajorVersionThe major version number eg 11.private intdatabaseMinorVersionThe minor version number eg 92.private java.lang.StringdatabaseNameThe requested database name.private java.lang.StringdatabaseProductNameThe database product name eg SQL SERVER.private java.lang.StringdatabaseProductVersionThe product version eg 11.92.private java.lang.StringdomainNameThe Windows Domain name.private java.lang.StringinstanceNameThe SQL Server instance.private java.lang.StringlanguageThe server message language.private booleanlastUpdateCountOnly return the last update count.private longlobBufferThe amount of LOB data to buffer in memory.private intloginTimeoutLogin timeout value in seconds or 0.private java.lang.StringmacAddressThe client MAC Address.private intmaxPrecisionMaximum decimal precision.private intmaxStatementsThe maximum number of statements to keep open.private SQLDiagnosticmessagesDiagnostc messages for this connection.private SemaphoremutexMutual exclusion lock to control access to connection.private booleannamedPipeUse named pipe IPC instead of TCP/IP sockets.private intnetPacketSizeThe initial network packet size.private intpacketSizeUser requested packet size.private java.lang.StringpasswordThe user password.private intportNumberThe server port number.private intprepareSqlMethod for preparing SQL used in Prepared Statements.private static java.lang.IntegerprocessIdThe process ID to report to a server when connecting.private java.util.ArrayListprocInTranProcedures in this transaction.private java.lang.StringprogNameThe program name.private booleanreadOnlyTrue if this connection is read only.private introwCountConnection's current rowcount limit.private intsavepointIdCounter for generating unique savepoint identifiersprivate java.util.MapsavepointProcInTranMaps each savepoint to a list of temp procedures created since the savepointprivate java.util.ArrayListsavepointsThe list of savepoints.private java.lang.StringserverCharsetThe server character set.private java.lang.StringserverNameThe server host name.private intserverTypeThe make of SQL Server (sybase/microsoft).private SharedSocketsocketThe network TCP/IP socket.private booleansocketKeepAliveTrue to enable socket keep alive.private intsocketTimeoutSocket timeout value in seconds or 0.private intspSequenceNoStored procedure unique ID number.private static java.lang.StringSQL_SERVER_65_CHARSET_QUERYSQL query to determine the server charset on MS SQL Server 6.5.private static java.lang.StringSQL_SERVER_INITIAL_SQLSQL Server initial connection string.private java.lang.StringsslSSL setting.private StatementCachestatementCacheStatement cache.private java.util.ArrayListstatementsList of statements associated with this connection.private static java.lang.StringSYBASE_INITIAL_SQLSybase initial connection string.private static java.lang.StringSYBASE_SERVER_CHARSET_QUERYSQL query to determine the server charset on Sybase.private intsybaseInfoSybase capability mask.private booleantcpNoDelayTCP_NODELAYprivate inttdsVersionThe server protocol version.private inttextSizeConnection's current maximum field size limit.static intTRANSACTION_SNAPSHOTSQL Server custom transaction isolation level.private inttransactionIsolationDefault transaction isolation level.private java.lang.StringurlThe orginal connection URL.private booleanuseCursorsUse fast forward cursors for forward only result sets.private booleanuseJCIFSForce use of jCIFS library on Windows when connecting via named pipes.private booleanuseKerberosForce Kerberos authenticationprivate booleanuseLOBsMap large types (IMAGE and TEXT/NTEXT) to LOBs by default.private booleanuseMetadataCacheUse metadata cache for prepared statements.private booleanuseNTLMv2When doing NTLM authentication, send NTLMv2 response rather than regular responseprivate java.lang.StringuserThe database user ID.private booleanuseUnicodeSend parameters as unicode.private java.lang.StringwsidWorkstation ID.private booleanxaEmulationTrue if driver should emulate distributed transactions.private intxaStateCurrent emulated XA State eg start/end/prepare etc.private booleanxaTransactionTrue if running distributed transaction.private java.lang.ObjectxidCurrent XA Transaction ID.
-
Constructor Summary
Constructors Modifier Constructor Description privateJtdsConnection()Default constructor.(package private)JtdsConnection(java.lang.String url, java.util.Properties info)Create a new database connection.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort(java.util.concurrent.Executor executor)(package private) voidaddCachedProcedure(java.lang.String key)Add a stored procedure to the savepoint cache.(package private) voidaddCachedProcedure(java.lang.String key, ProcEntry proc)Add a stored procedure to the cache.(package private) voidaddStatement(JtdsStatement statement)Adds a statement object to the list maintained by the connection.(package private) voidcheckLocal(java.lang.String method)Checks that this connection is in local transaction mode.(package private) voidcheckOpen()Checks that the connection is still open.private voidclearSavepoints()Releases all savepoints.voidclearWarnings()voidclose()Releases thisConnectionobject's database and JDBC resources immediately instead of waiting for them to be automatically released.voidcommit()java.sql.ArraycreateArrayOf(java.lang.String typeName, java.lang.Object[] elements)java.sql.BlobcreateBlob()java.sql.ClobcreateClob()private SharedSocketcreateNamedPipe(JtdsConnection connection)Creates aSharedSocketobject representing a connection to a named pipe.java.sql.NClobcreateNClob()java.sql.SQLXMLcreateSQLXML()java.sql.StatementcreateStatement()java.sql.StatementcreateStatement(int type, int concurrency)java.sql.StatementcreateStatement(int type, int concurrency, int holdability)java.sql.StructcreateStruct(java.lang.String typeName, java.lang.Object[] attributes)private java.lang.StringdetermineServerCharset()Discovers the server charset for server versions that do not sendENVCHANGEpackets on login ack, by executing a DB vendor/version specific query.(package private) voidenlistConnection(byte[] oleTranID)Enlists the current connection in a distributed transaction.protected voidfinalize()Ensure all resources are released.(package private) java.lang.StringgetAppName()Retrieves the application name for this connection.booleangetAutoCommit()(package private) intgetBatchSize()Retrieves the batch size to be used internally.(package private) java.lang.StringgetBindAddress()Retrieves the bind address for this connection.(package private) java.io.FilegetBufferDir()Returns the directory where data should be buffered to.(package private) intgetBufferMaxMemory()Retrieves the maximum amount of memory in Kb to buffer for all connections.(package private) intgetBufferMinPackets()Retrieves the minimum number of packets to buffer perStatementfor this connection.(package private) TdsCoregetCachedTds()Retrieves the cachedTdsCoreornullif nothing is cached and resets the cache (sets it tonull).java.lang.StringgetCatalog()protected java.lang.StringgetCharset()Retrieve the Java charset to use for encoding.protected CharsetInfogetCharsetInfo()Retrieve theCharsetInfoinstance used by this connection.java.util.PropertiesgetClientInfo()java.lang.StringgetClientInfo(java.lang.String name)(package private) byte[]getCollation()Retrieve the SQL Server 2000 default collation.(package private) java.lang.StringgetCursorName()Retrieves the next unique cursor name.intgetDatabaseMajorVersion()Retrieves the DBMS major version.intgetDatabaseMinorVersion()Retrieves the DBMS minor version.(package private) java.lang.StringgetDatabaseName()Retrieves the database name for this connection.(package private) java.lang.StringgetDatabaseProductName()Retrieves the DBMS product name.(package private) java.lang.StringgetDatabaseProductVersion()Retrieves the DBMS product version.(package private) java.lang.StringgetDomainName()Retrieves the domain name for this connection.intgetHoldability()(package private) java.lang.StringgetInstanceName()Retrieves the instance name for this connection.(package private) booleangetLastUpdateCount()Retrieves the status of the lastUpdateCount flag.(package private) longgetLobBuffer()Retrieves the LOB buffer size.(package private) intgetLoginTimeout()Retrieves the login timeout for this connection.(package private) java.lang.StringgetMacAddress()Retrieves the MAC (ethernet) address for this connection.(package private) intgetMaxPrecision()Retrieves the maximum decimal precision.(package private) intgetMaxStatements()Retrieves the maximum statement cache size.java.sql.DatabaseMetaDatagetMetaData()(package private) SemaphoregetMutex()Retrieves the connection mutex and acquires an exclusive lock on the network connection.(package private) booleangetNamedPipe()Retrieves the named pipe setting for this connection.(package private) intgetNetPacketSize()Retrieves the network packet size.intgetNetworkTimeout()private intgetNextSavepointId()Returns the next savepoint identifier.(package private) intgetPacketSize()Retrieves the packet size for this connection.(package private) java.lang.StringgetPassword()Retrieves the password for this connection.(package private) intgetPortNumber()Retrieves the port number for this connection.(package private) intgetPrepareSql()Retrieves the Prepared SQL method.(package private) intgetProcessId()Retrieves the process ID to send to a server when a connection is established.(package private) java.lang.StringgetProcName()Retrieves the next unique stored procedure name.(package private) java.lang.StringgetProgName()Retrieves the program name for this connection.java.lang.StringgetRmHost()Retrieves the host and port for this connection.(package private) intgetRowCount()Retrieves the current row count on this connection.java.lang.StringgetSchema()(package private) java.lang.StringgetServerName()Retrieves the server name for this connection.intgetServerType()Retrieves the server type.(package private) SharedSocketgetSocket()Retrive the shared socket.(package private) booleangetSocketKeepAlive()Retrieves whether to enable socket keep alive.(package private) intgetSocketTimeout()Retrieves the socket timeout for this connection.protected booleangetSybaseInfo(int flag)Retrieve the Sybase capability data.(package private) booleangetTcpNoDelay()Retrieves the tcpNoDelay setting for this connection.(package private) intgetTdsVersion()Retrieve the TDS protocol version.intgetTextSize()Retrieves the current maximum textsize on this connection.intgetTransactionIsolation()java.util.MapgetTypeMap()(package private) java.lang.StringgetURL()Retrieves the original connection URL.(package private) booleangetUseCursors()Indicates whether fast forward only cursors should be used for forward only result sets.(package private) booleangetUseJCIFS()Retrieves the useJCIFS setting for this connection.(package private) booleangetUseKerberos()Return whether to use Kerberos authentication for MS SQL Server.(package private) booleangetUseLOBs()Indicates whether large types (IMAGE and TEXT/NTEXT) should be mapped by default to LOB types orStringandbyte[]respectively.(package private) booleangetUseMetadataCache()Retrieves the boolean indicating whether metadata caching is enabled.(package private) booleangetUseNTLMv2()Indicates whether, when doing Windows authentication to an MS SQL server, NTLMv2 should be used.(package private) java.lang.StringgetUser()Retrieves the user for this connection.protected booleangetUseUnicode()Retrieve the sendParametersAsUnicode flag.java.sql.SQLWarninggetWarnings()(package private) java.lang.StringgetWsid()Retrieves the workstation ID (WSID) for this connection.(package private) intgetXaState()Retrieves the XA state variable.(package private) java.lang.ObjectgetXid()Gets the XA transaction ID when running in emulation mode.(package private) booleanisCharsetSpecified()Retrieves whether a specific charset was requested on creation.booleanisClosed()booleanisReadOnly()booleanisValid(int timeout)protected booleanisWideChar()Retrieve the multibyte status of the current character set.booleanisWrapperFor(java.lang.Class arg0)(package private) booleanisXaEmulation()Retrieves the XA Emulation flag.private voidloadCharset(java.lang.String charset)Load the Java charset to match the server character set.private voidloadCharset(CharsetInfo ci, java.lang.String ref)Load the Java charset to match the server character set.java.lang.StringnativeSQL(java.lang.String sql)(package private) static voidnotImplemented(java.lang.String method)Reports that user tried to call a method which has not been implemented.private static booleanparseBooleanProperty(java.util.Properties info, java.lang.String key)Parse a string property value into an boolean value.private static intparseIntegerProperty(java.util.Properties info, java.lang.String key)Parse a string property value into an integer value.private static longparseLongProperty(java.util.Properties info, java.lang.String key)Parse a string property value into a long value.java.sql.CallableStatementprepareCall(java.lang.String sql)java.sql.CallableStatementprepareCall(java.lang.String sql, int type, int concurrency)java.sql.CallableStatementprepareCall(java.lang.String sql, int type, int concurrency, int holdability)(package private) java.lang.StringprepareSQL(JtdsPreparedStatement pstmt, java.lang.String sql, ParamInfo[] params, boolean returnKeys, boolean cursorNeeded)Try to convert the SQL statement into a statement prepare.java.sql.PreparedStatementprepareStatement(java.lang.String sql)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int autoGeneratedKeys)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int[] columnIndexes)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int type, int concurrency)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int type, int concurrency, int holdability)java.sql.PreparedStatementprepareStatement(java.lang.String sql, java.lang.String[] columnNames)voidreleaseSavepoint(java.sql.Savepoint savepoint)(package private) voidreleaseTds(TdsCore tds)Releases (either closes or caches) aTdsCore.(package private) voidremoveCachedProcedure(java.lang.String key)Remove a stored procedure from the cache.(package private) voidremoveStatement(JtdsStatement statement)Removes a statement object from the list maintained by the connection and cleans up the statement cache if necessary.voidrollback()voidrollback(java.sql.Savepoint savepoint)(package private) byte[][]sendXaPacket(int[] args, byte[] data)Invokes thexp_jtdsxaextended stored procedure on the server.voidsetAutoCommit(boolean autoCommit)voidsetCatalog(java.lang.String catalog)voidsetClientInfo(java.lang.String name, java.lang.String value)voidsetClientInfo(java.util.Properties properties)(package private) voidsetClosed()Forces the closed status on the statement if an I/O error has occurred.(package private) voidsetCollation(byte[] collation)Set the default collation for this connection.protected voidsetDatabase(java.lang.String newDb, java.lang.String oldDb)Called by the protcol to change the current database context.protected voidsetDBServerInfo(java.lang.String databaseProductName, int databaseMajorVersion, int databaseMinorVersion, int buildNumber)Update the connection instance with information about the server.voidsetHoldability(int holdability)(package private) voidsetNetPacketSize(int size)Sets the network packet size.voidsetNetworkTimeout(java.util.concurrent.Executor executor, int milliseconds)voidsetReadOnly(boolean readOnly)(package private) voidsetRowCount(int count)Sets the current row count on this connection.java.sql.SavepointsetSavepoint()java.sql.SavepointsetSavepoint(java.lang.String name)private voidsetSavepoint(SavepointImpl savepoint)Add a savepoint to the list maintained by this connection.voidsetSchema(java.lang.String schema)protected voidsetServerCharset(java.lang.String charset)Called by the protocol to change the current character set.protected voidsetSybaseInfo(int mask)Set the Sybase capability data.voidsetTextSize(int textSize)Sets the current maximum textsize on this connection.voidsetTransactionIsolation(int level)voidsetTypeMap(java.util.Map map)(package private) voidsetXaState(int value)Sets the XA state variable.(package private) voidsetXid(java.lang.Object xid)Sets the XA transaction ID when running in emulation mode.protected voidunpackProperties(java.util.Properties info)Transfers the properties to the local instance variables.java.lang.Objectunwrap(java.lang.Class arg0)
-
-
-
Field Detail
-
SYBASE_SERVER_CHARSET_QUERY
private static final java.lang.String SYBASE_SERVER_CHARSET_QUERY
SQL query to determine the server charset on Sybase.- See Also:
- Constant Field Values
-
SQL_SERVER_65_CHARSET_QUERY
private static final java.lang.String SQL_SERVER_65_CHARSET_QUERY
SQL query to determine the server charset on MS SQL Server 6.5.- See Also:
- Constant Field Values
-
SYBASE_INITIAL_SQL
private static final java.lang.String SYBASE_INITIAL_SQL
Sybase initial connection string.- See Also:
- Constant Field Values
-
SQL_SERVER_INITIAL_SQL
private static final java.lang.String SQL_SERVER_INITIAL_SQL
SQL Server initial connection string. Also contains aSELECT @@MAX_PRECISIONquery to retrieve the maximum precision for DECIMAL/NUMERIC data.- See Also:
- Constant Field Values
-
TRANSACTION_SNAPSHOT
public static final int TRANSACTION_SNAPSHOT
SQL Server custom transaction isolation level.- See Also:
- Constant Field Values
-
url
private final java.lang.String url
The orginal connection URL.
-
serverName
private java.lang.String serverName
The server host name.
-
portNumber
private int portNumber
The server port number.
-
serverType
private int serverType
The make of SQL Server (sybase/microsoft).
-
instanceName
private java.lang.String instanceName
The SQL Server instance.
-
databaseName
private java.lang.String databaseName
The requested database name.
-
currentDatabase
private java.lang.String currentDatabase
The current database name.
-
domainName
private java.lang.String domainName
The Windows Domain name.
-
user
private java.lang.String user
The database user ID.
-
password
private java.lang.String password
The user password.
-
serverCharset
private java.lang.String serverCharset
The server character set.
-
appName
private java.lang.String appName
The application name.
-
progName
private java.lang.String progName
The program name.
-
wsid
private java.lang.String wsid
Workstation ID.
-
language
private java.lang.String language
The server message language.
-
macAddress
private java.lang.String macAddress
The client MAC Address.
-
tdsVersion
private int tdsVersion
The server protocol version.
-
socket
private final SharedSocket socket
The network TCP/IP socket.
-
baseTds
private final TdsCore baseTds
The cored TDS protocol object.
-
netPacketSize
private int netPacketSize
The initial network packet size.
-
packetSize
private int packetSize
User requested packet size.
-
collation
private byte[] collation
SQL Server 2000 collation.
-
charsetSpecified
private boolean charsetSpecified
True if user specifies an explicit charset.
-
databaseProductName
private java.lang.String databaseProductName
The database product name eg SQL SERVER.
-
databaseProductVersion
private java.lang.String databaseProductVersion
The product version eg 11.92.
-
databaseMajorVersion
private int databaseMajorVersion
The major version number eg 11.
-
databaseMinorVersion
private int databaseMinorVersion
The minor version number eg 92.
-
closed
private boolean closed
True if this connection is closed.
-
readOnly
private boolean readOnly
True if this connection is read only.
-
statements
private final java.util.ArrayList statements
List of statements associated with this connection.
-
transactionIsolation
private int transactionIsolation
Default transaction isolation level.
-
autoCommit
private boolean autoCommit
Default auto commit state.
-
messages
private final SQLDiagnostic messages
Diagnostc messages for this connection.
-
rowCount
private int rowCount
Connection's current rowcount limit.
-
textSize
private int textSize
Connection's current maximum field size limit.
-
maxPrecision
private int maxPrecision
Maximum decimal precision.
-
spSequenceNo
private int spSequenceNo
Stored procedure unique ID number.
-
cursorSequenceNo
private int cursorSequenceNo
Cursor unique ID number.
-
procInTran
private final java.util.ArrayList procInTran
Procedures in this transaction.
-
charsetInfo
private CharsetInfo charsetInfo
Java charset for encoding.
-
prepareSql
private int prepareSql
Method for preparing SQL used in Prepared Statements.
-
lobBuffer
private long lobBuffer
The amount of LOB data to buffer in memory.
-
maxStatements
private int maxStatements
The maximum number of statements to keep open.
-
statementCache
private StatementCache statementCache
Statement cache.
-
useUnicode
private boolean useUnicode
Send parameters as unicode.
-
namedPipe
private boolean namedPipe
Use named pipe IPC instead of TCP/IP sockets.
-
lastUpdateCount
private boolean lastUpdateCount
Only return the last update count.
-
tcpNoDelay
private boolean tcpNoDelay
TCP_NODELAY
-
loginTimeout
private int loginTimeout
Login timeout value in seconds or 0.
-
sybaseInfo
private int sybaseInfo
Sybase capability mask.
-
xaTransaction
private boolean xaTransaction
True if running distributed transaction.
-
xaState
private int xaState
Current emulated XA State eg start/end/prepare etc.
-
xid
private java.lang.Object xid
Current XA Transaction ID.
-
xaEmulation
private boolean xaEmulation
True if driver should emulate distributed transactions.
-
mutex
private final Semaphore mutex
Mutual exclusion lock to control access to connection.
-
socketTimeout
private int socketTimeout
Socket timeout value in seconds or 0.
-
socketKeepAlive
private boolean socketKeepAlive
True to enable socket keep alive.
-
processId
private static java.lang.Integer processId
The process ID to report to a server when connecting.
-
ssl
private java.lang.String ssl
SSL setting.
-
batchSize
private int batchSize
The maximum size of a batch.
-
useMetadataCache
private boolean useMetadataCache
Use metadata cache for prepared statements.
-
useCursors
private boolean useCursors
Use fast forward cursors for forward only result sets.
-
bufferDir
private java.io.File bufferDir
The directory to buffer data to
-
bufferMaxMemory
private int bufferMaxMemory
The global buffer memory limit for all connections (in kilobytes).
-
bufferMinPackets
private int bufferMinPackets
The minimum number of packets per statement to buffer to memory.
-
useLOBs
private boolean useLOBs
Map large types (IMAGE and TEXT/NTEXT) to LOBs by default.
-
cachedTds
private TdsCore cachedTds
A cachedTdsCoreinstance to reuse on new statements.
-
bindAddress
private java.lang.String bindAddress
The local address to bind to when connecting to a database via TCP/IP.
-
useJCIFS
private boolean useJCIFS
Force use of jCIFS library on Windows when connecting via named pipes.
-
useNTLMv2
private boolean useNTLMv2
When doing NTLM authentication, send NTLMv2 response rather than regular response
-
useKerberos
private boolean useKerberos
Force Kerberos authentication
-
connections
private static int[] connections
the number of currently open connections
-
savepoints
private java.util.ArrayList savepoints
The list of savepoints.
-
savepointProcInTran
private java.util.Map savepointProcInTran
Maps each savepoint to a list of temp procedures created since the savepoint
-
savepointId
private int savepointId
Counter for generating unique savepoint identifiers
-
-
Constructor Detail
-
JtdsConnection
private JtdsConnection()
Default constructor. Used for testing.
-
JtdsConnection
JtdsConnection(java.lang.String url, java.util.Properties info) throws java.sql.SQLExceptionCreate a new database connection.- Parameters:
url- The connection URL starting jdbc:jtds:.info- The additional connection properties.- Throws:
java.sql.SQLException
-
-
Method Detail
-
finalize
protected void finalize() throws java.lang.ThrowableEnsure all resources are released.- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
createNamedPipe
private SharedSocket createNamedPipe(JtdsConnection connection) throws java.io.IOException
Creates aSharedSocketobject representing a connection to a named pipe. If theos.namesystem property starts with "Windows" (case-insensitive) and theuseJCIFSparameter isfalse, aSharedLocalNamedPipeobject is created. Else aSharedNamedPipeis created which uses jCIFS to provide a pure-Java implementation of Windows named pipes.This method will retry for
loginTimeoutseconds to create a named pipe if anIOExceptioncontinues to be thrown stating, "All pipe instances are busy". IfloginTimeoutis set to zero (e.g., not set), a default of 20 seconds will be used.- Parameters:
connection- the connection object- Returns:
- an object representing the named pipe connection
- Throws:
java.io.IOException- on error; if anIOExceptionis thrown with a message stating "All pipe instances are busy", then the method timed out afterloginTimeoutmilliseconds attempting to create a named pipe.
-
getSocket
SharedSocket getSocket()
Retrive the shared socket.- Returns:
- The
SharedSocketobject.
-
getTdsVersion
int getTdsVersion()
Retrieve the TDS protocol version.- Returns:
- The TDS version as an
int.
-
getProcName
java.lang.String getProcName()
Retrieves the next unique stored procedure name.Notes:
- Some versions of Sybase require an id with a length of <= 10.
- The format of this name works for sybase and Microsoft and allows for 16M names per session.
- The leading '#jtds' indicates this is a temporary procedure and the '#' is removed by the lower level TDS5 routines.
prepareSQL(net.sourceforge.jtds.jdbc.JtdsPreparedStatement, java.lang.String, net.sourceforge.jtds.jdbc.ParamInfo[], boolean, boolean)method.- Returns:
- the next temporary SP name as a
String
-
getCursorName
java.lang.String getCursorName()
Retrieves the next unique cursor name.- Returns:
- the next cursor name as a
String
-
prepareSQL
java.lang.String prepareSQL(JtdsPreparedStatement pstmt, java.lang.String sql, ParamInfo[] params, boolean returnKeys, boolean cursorNeeded) throws java.sql.SQLException
Try to convert the SQL statement into a statement prepare.Synchronized because it accesses the procedure cache and the
baseTds, but the method call also needs to made in asynchronized (connection)block together with the execution (if the prepared statement is actually executed) to ensure the transaction isn't rolled back between this method call and the actual execution.- Parameters:
pstmt- the target prepared statementsql- the SQL statement to prepareparams- the parametersreturnKeys- indicates whether the statement will return generated keyscursorNeeded- indicates whether a cursor prepare is needed- Returns:
- the SQL procedure name as a
Stringor null if the SQL cannot be prepared - Throws:
java.sql.SQLException
-
addCachedProcedure
void addCachedProcedure(java.lang.String key, ProcEntry proc)Add a stored procedure to the cache.Not explicitly synchronized because it's only called by synchronized methods.
- Parameters:
key- The signature of the procedure to cache.proc- The stored procedure descriptor.
-
removeCachedProcedure
void removeCachedProcedure(java.lang.String key)
Remove a stored procedure from the cache.Not explicitly synchronized because it's only called by synchronized methods.
- Parameters:
key- The signature of the procedure to remove from the cache.
-
getMaxStatements
int getMaxStatements()
Retrieves the maximum statement cache size.- Returns:
- the maximum statement cache size
-
getServerType
public int getServerType()
Retrieves the server type.- Returns:
- the server type as an
intwhere 1 == SQLSERVER and 2 == SYBASE.
-
setNetPacketSize
void setNetPacketSize(int size)
Sets the network packet size.- Parameters:
size- the new packet size
-
getNetPacketSize
int getNetPacketSize()
Retrieves the network packet size.- Returns:
- the packet size as an
int
-
getRowCount
int getRowCount()
Retrieves the current row count on this connection.- Returns:
- the row count as an
int
-
setRowCount
void setRowCount(int count)
Sets the current row count on this connection.- Parameters:
count- the new row count
-
getTextSize
public int getTextSize()
Retrieves the current maximum textsize on this connection.- Returns:
- the maximum textsize as an
int
-
setTextSize
public void setTextSize(int textSize)
Sets the current maximum textsize on this connection.- Parameters:
textSize- the new maximum textsize
-
getLastUpdateCount
boolean getLastUpdateCount()
Retrieves the status of the lastUpdateCount flag.- Returns:
- the lastUpdateCount flag as a
boolean
-
getMaxPrecision
int getMaxPrecision()
Retrieves the maximum decimal precision.- Returns:
- the precision as an
int
-
getLobBuffer
long getLobBuffer()
Retrieves the LOB buffer size.- Returns:
- the LOB buffer size as a
long
-
getPrepareSql
int getPrepareSql()
Retrieves the Prepared SQL method.- Returns:
- the Prepared SQL method
-
getBatchSize
int getBatchSize()
Retrieves the batch size to be used internally.- Returns:
- the batch size as an
int
-
getUseMetadataCache
boolean getUseMetadataCache()
Retrieves the boolean indicating whether metadata caching is enabled.- Returns:
trueif metadata caching is enabled,falseif caching is disabled
-
getUseCursors
boolean getUseCursors()
Indicates whether fast forward only cursors should be used for forward only result sets.- Returns:
trueif fast forward cursors are requested
-
getUseLOBs
boolean getUseLOBs()
Indicates whether large types (IMAGE and TEXT/NTEXT) should be mapped by default to LOB types orStringandbyte[]respectively.- Returns:
trueif the default mapping should be to LOBs,falseotherwise
-
getUseNTLMv2
boolean getUseNTLMv2()
Indicates whether, when doing Windows authentication to an MS SQL server, NTLMv2 should be used. When this is set to "false", LM and NTLM responses are sent to the server, which should work fine in most cases. However, some servers are configured to require LMv2 and NTLMv2. In these rare cases, this property should be set to "true".
-
getUseKerberos
boolean getUseKerberos()
Return whether to use Kerberos authentication for MS SQL Server.
-
getAppName
java.lang.String getAppName()
Retrieves the application name for this connection.- Returns:
- the application name
-
getBindAddress
java.lang.String getBindAddress()
Retrieves the bind address for this connection.- Returns:
- the bind address
-
getBufferDir
java.io.File getBufferDir()
Returns the directory where data should be buffered to.- Returns:
- the directory where data should be buffered to.
-
getBufferMaxMemory
int getBufferMaxMemory()
Retrieves the maximum amount of memory in Kb to buffer for all connections.- Returns:
- the maximum amount of memory in Kb to buffer for all connections
-
getBufferMinPackets
int getBufferMinPackets()
Retrieves the minimum number of packets to buffer perStatementfor this connection.- Returns:
- the minimum number of packets to buffer per
Statement
-
getDatabaseName
java.lang.String getDatabaseName()
Retrieves the database name for this connection.- Returns:
- the database name
-
getDomainName
java.lang.String getDomainName()
Retrieves the domain name for this connection.- Returns:
- the domain name
-
getInstanceName
java.lang.String getInstanceName()
Retrieves the instance name for this connection.- Returns:
- the instance name
-
getLoginTimeout
int getLoginTimeout()
Retrieves the login timeout for this connection.- Returns:
- the login timeout
-
getSocketTimeout
int getSocketTimeout()
Retrieves the socket timeout for this connection.- Returns:
- the socket timeout
-
getSocketKeepAlive
boolean getSocketKeepAlive()
Retrieves whether to enable socket keep alive.- Returns:
trueif the socket keep alive is enabled
-
getProcessId
int getProcessId()
Retrieves the process ID to send to a server when a connection is established.- Returns:
- the process ID
-
getMacAddress
java.lang.String getMacAddress()
Retrieves the MAC (ethernet) address for this connection.- Returns:
- the MAC (ethernet) address
-
getNamedPipe
boolean getNamedPipe()
Retrieves the named pipe setting for this connection.- Returns:
- the named pipe setting
-
getPacketSize
int getPacketSize()
Retrieves the packet size for this connection.- Returns:
- the packet size
-
getPassword
java.lang.String getPassword()
Retrieves the password for this connection.- Returns:
- the password
-
getPortNumber
int getPortNumber()
Retrieves the port number for this connection.- Returns:
- the port number
-
getProgName
java.lang.String getProgName()
Retrieves the program name for this connection.- Returns:
- the program name
-
getServerName
java.lang.String getServerName()
Retrieves the server name for this connection.- Returns:
- the server name
-
getTcpNoDelay
boolean getTcpNoDelay()
Retrieves the tcpNoDelay setting for this connection.- Returns:
- the tcpNoDelay setting
-
getUseJCIFS
boolean getUseJCIFS()
Retrieves the useJCIFS setting for this connection.- Returns:
- the useJCIFS setting
-
getUser
java.lang.String getUser()
Retrieves the user for this connection.- Returns:
- the user
-
getWsid
java.lang.String getWsid()
Retrieves the workstation ID (WSID) for this connection.- Returns:
- the workstation ID (WSID)
-
unpackProperties
protected void unpackProperties(java.util.Properties info) throws java.sql.SQLExceptionTransfers the properties to the local instance variables.- Parameters:
info- The connection properties Object.- Throws:
java.sql.SQLException- If an invalid property value is found.
-
parseBooleanProperty
private static boolean parseBooleanProperty(java.util.Properties info, java.lang.String key) throws java.sql.SQLExceptionParse a string property value into an boolean value.- Parameters:
info- The connection properties object.key- The message key used to retrieve the property name.- Returns:
- The boolean value of the string property value.
- Throws:
java.sql.SQLException- If the property value can't be parsed.
-
parseIntegerProperty
private static int parseIntegerProperty(java.util.Properties info, java.lang.String key) throws java.sql.SQLExceptionParse a string property value into an integer value.- Parameters:
info- The connection properties object.key- The message key used to retrieve the property name.- Returns:
- The integer value of the string property value.
- Throws:
java.sql.SQLException- If the property value can't be parsed.
-
parseLongProperty
private static long parseLongProperty(java.util.Properties info, java.lang.String key) throws java.sql.SQLExceptionParse a string property value into a long value.- Parameters:
info- The connection properties object.key- The message key used to retrieve the property name.- Returns:
- The long value of the string property value.
- Throws:
java.sql.SQLException- If the property value can't be parsed.
-
getCharset
protected java.lang.String getCharset()
Retrieve the Java charset to use for encoding.- Returns:
- the Charset name as a
String
-
isWideChar
protected boolean isWideChar()
Retrieve the multibyte status of the current character set.- Returns:
booleantrue if a multi byte character set
-
getCharsetInfo
protected CharsetInfo getCharsetInfo()
Retrieve theCharsetInfoinstance used by this connection.- Returns:
- the default
CharsetInfofor this connection
-
getUseUnicode
protected boolean getUseUnicode()
Retrieve the sendParametersAsUnicode flag.- Returns:
booleantrue if parameters should be sent as unicode.
-
getSybaseInfo
protected boolean getSybaseInfo(int flag)
Retrieve the Sybase capability data.- Returns:
- Capability bit mask as an
int.
-
setSybaseInfo
protected void setSybaseInfo(int mask)
Set the Sybase capability data.- Parameters:
mask- The capability bit mask.
-
setServerCharset
protected void setServerCharset(java.lang.String charset) throws java.sql.SQLExceptionCalled by the protocol to change the current character set.- Parameters:
charset- the server character set name- Throws:
java.sql.SQLException
-
loadCharset
private void loadCharset(java.lang.String charset) throws java.sql.SQLExceptionLoad the Java charset to match the server character set.- Parameters:
charset- the server character set- Throws:
java.sql.SQLException
-
loadCharset
private void loadCharset(CharsetInfo ci, java.lang.String ref) throws java.sql.SQLException
Load the Java charset to match the server character set.- Parameters:
ci- theCharsetInfoto load- Throws:
java.sql.SQLException
-
determineServerCharset
private java.lang.String determineServerCharset() throws java.sql.SQLExceptionDiscovers the server charset for server versions that do not sendENVCHANGEpackets on login ack, by executing a DB vendor/version specific query.Will throw an
SQLExceptionif used on SQL Server 7.0 or 2000; the idea is that the charset should already be determined fromENVCHANGEpackets for these DB servers.Should only be called from the constructor.
- Returns:
- the default server charset
- Throws:
java.sql.SQLException- if an error condition occurs
-
setCollation
void setCollation(byte[] collation) throws java.sql.SQLExceptionSet the default collation for this connection.Set by a SQL Server 2000 environment change packet. The collation consists of the following fields:
- bits 0-19 - The locale eg 0x0409 for US English which maps to code page 1252 (Latin1_General).
- bits 20-31 - Reserved.
- bits 32-39 - Sort order (csid from syscharsets)
- Parameters:
collation- The new collation.- Throws:
java.sql.SQLException
-
getCollation
byte[] getCollation()
Retrieve the SQL Server 2000 default collation.- Returns:
- The collation as a
byte[5].
-
isCharsetSpecified
boolean isCharsetSpecified()
Retrieves whether a specific charset was requested on creation. If this is the case, all character data should be encoded/decoded using that charset.
-
setDatabase
protected void setDatabase(java.lang.String newDb, java.lang.String oldDb) throws java.sql.SQLExceptionCalled by the protcol to change the current database context.- Parameters:
newDb- The new database selected on the server.oldDb- The old database as known by the server.- Throws:
java.sql.SQLException
-
setDBServerInfo
protected void setDBServerInfo(java.lang.String databaseProductName, int databaseMajorVersion, int databaseMinorVersion, int buildNumber)Update the connection instance with information about the server.- Parameters:
databaseProductName- The server name eg SQL Server.databaseMajorVersion- The major version eg 11databaseMinorVersion- The minor version eg 92buildNumber- The server build number.
-
removeStatement
void removeStatement(JtdsStatement statement) throws java.sql.SQLException
Removes a statement object from the list maintained by the connection and cleans up the statement cache if necessary.Synchronized because it accesses the statement list, the statement cache and the
baseTds.- Parameters:
statement- the statement to remove- Throws:
java.sql.SQLException
-
addStatement
void addStatement(JtdsStatement statement)
Adds a statement object to the list maintained by the connection. WeakReferences are used so that statements can still be closed and garbage collected even if not explicitly closed by the connection.- Parameters:
statement- statement to add
-
checkOpen
void checkOpen() throws java.sql.SQLExceptionChecks that the connection is still open.- Throws:
java.sql.SQLException- if the connection is closed
-
checkLocal
void checkLocal(java.lang.String method) throws java.sql.SQLExceptionChecks that this connection is in local transaction mode.- Parameters:
method- the method name being tested- Throws:
java.sql.SQLException- if in XA distributed transaction mode
-
notImplemented
static void notImplemented(java.lang.String method) throws java.sql.SQLExceptionReports that user tried to call a method which has not been implemented.- Parameters:
method- the method name to report in the error message- Throws:
java.sql.SQLException- always, with the not implemented message
-
getDatabaseMajorVersion
public int getDatabaseMajorVersion()
Retrieves the DBMS major version.- Returns:
- the version as an
int
-
getDatabaseMinorVersion
public int getDatabaseMinorVersion()
Retrieves the DBMS minor version.- Returns:
- the version as an
int
-
getDatabaseProductName
java.lang.String getDatabaseProductName()
Retrieves the DBMS product name.- Returns:
- the name as a
String
-
getDatabaseProductVersion
java.lang.String getDatabaseProductVersion()
Retrieves the DBMS product version.- Returns:
- the version as a
String
-
getURL
java.lang.String getURL()
Retrieves the original connection URL.- Returns:
- the connection url as a
String
-
getRmHost
public java.lang.String getRmHost()
Retrieves the host and port for this connection.Used to identify same resource manager in XA transactions.
- Returns:
- the hostname and port as a
String
-
setClosed
void setClosed()
Forces the closed status on the statement if an I/O error has occurred.
-
sendXaPacket
byte[][] sendXaPacket(int[] args, byte[] data) throws java.sql.SQLExceptionInvokes thexp_jtdsxaextended stored procedure on the server. Synchronized because it accesses thebaseTds.- Parameters:
args- the arguments eg cmd, rmid, flags etc.data- option byte data eg open string xid etc.- Returns:
- optional byte data eg OLE cookie
- Throws:
java.sql.SQLException- if an error condition occurs
-
enlistConnection
void enlistConnection(byte[] oleTranID) throws java.sql.SQLExceptionEnlists the current connection in a distributed transaction.- Parameters:
oleTranID- the OLE transaction cookie or null to delist- Throws:
java.sql.SQLException- if an error condition occurs
-
setXid
void setXid(java.lang.Object xid)
Sets the XA transaction ID when running in emulation mode.- Parameters:
xid- the XA Transaction ID
-
getXid
java.lang.Object getXid()
Gets the XA transaction ID when running in emulation mode.- Returns:
- the transaction ID as an
Object
-
setXaState
void setXaState(int value)
Sets the XA state variable.- Parameters:
value- the XA state value
-
getXaState
int getXaState()
Retrieves the XA state variable.- Returns:
- the xa state variable as an
int
-
isXaEmulation
boolean isXaEmulation()
Retrieves the XA Emulation flag.- Returns:
- True if in XA emulation mode.
-
getMutex
Semaphore getMutex()
Retrieves the connection mutex and acquires an exclusive lock on the network connection.- Returns:
- the mutex object as a
Semaphore
-
releaseTds
void releaseTds(TdsCore tds) throws java.sql.SQLException
Releases (either closes or caches) aTdsCore.- Parameters:
tds- theTdsCoreinstance to release- Throws:
java.sql.SQLException- if an error occurs while closing or cleaning up
-
getCachedTds
TdsCore getCachedTds()
Retrieves the cachedTdsCoreornullif nothing is cached and resets the cache (sets it tonull).- Returns:
- the value of
cachedTds - To do:
- Should probably synchronize on another object
-
getHoldability
public int getHoldability() throws java.sql.SQLException- Specified by:
getHoldabilityin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getTransactionIsolation
public int getTransactionIsolation() throws java.sql.SQLException- Specified by:
getTransactionIsolationin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
clearWarnings
public void clearWarnings() throws java.sql.SQLException- Specified by:
clearWarningsin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
close
public void close() throws java.sql.SQLExceptionReleases thisConnectionobject's database and JDBC resources immediately instead of waiting for them to be automatically released.Calling the method close on a
Connectionobject that is already closed is a no-op.Note: A
Connectionobject is automatically closed when it is garbage collected. Certain fatal errors also close aConnectionobject.Synchronized because it accesses the statement list and the
baseTds.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.sql.Connection- Throws:
java.sql.SQLException- if a database access error occurs
-
commit
public void commit() throws java.sql.SQLException- Specified by:
commitin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
rollback
public void rollback() throws java.sql.SQLException- Specified by:
rollbackin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getAutoCommit
public boolean getAutoCommit() throws java.sql.SQLException- Specified by:
getAutoCommitin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
isClosed
public boolean isClosed() throws java.sql.SQLException- Specified by:
isClosedin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
isReadOnly
public boolean isReadOnly() throws java.sql.SQLException- Specified by:
isReadOnlyin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setHoldability
public void setHoldability(int holdability) throws java.sql.SQLException- Specified by:
setHoldabilityin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setTransactionIsolation
public void setTransactionIsolation(int level) throws java.sql.SQLException- Specified by:
setTransactionIsolationin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setAutoCommit
public void setAutoCommit(boolean autoCommit) throws java.sql.SQLException- Specified by:
setAutoCommitin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setReadOnly
public void setReadOnly(boolean readOnly) throws java.sql.SQLException- Specified by:
setReadOnlyin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getCatalog
public java.lang.String getCatalog() throws java.sql.SQLException- Specified by:
getCatalogin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setCatalog
public void setCatalog(java.lang.String catalog) throws java.sql.SQLException- Specified by:
setCatalogin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getMetaData
public java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLException- Specified by:
getMetaDatain interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getWarnings
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException- Specified by:
getWarningsin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createStatement
public java.sql.Statement createStatement() throws java.sql.SQLException- Specified by:
createStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createStatement
public java.sql.Statement createStatement(int type, int concurrency) throws java.sql.SQLException- Specified by:
createStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createStatement
public java.sql.Statement createStatement(int type, int concurrency, int holdability) throws java.sql.SQLException- Specified by:
createStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getTypeMap
public java.util.Map getTypeMap() throws java.sql.SQLException- Specified by:
getTypeMapin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setTypeMap
public void setTypeMap(java.util.Map map) throws java.sql.SQLException- Specified by:
setTypeMapin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
nativeSQL
public java.lang.String nativeSQL(java.lang.String sql) throws java.sql.SQLException- Specified by:
nativeSQLin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLException- Specified by:
prepareCallin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql, int type, int concurrency) throws java.sql.SQLException- Specified by:
prepareCallin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql, int type, int concurrency, int holdability) throws java.sql.SQLException- Specified by:
prepareCallin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int type, int concurrency) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int type, int concurrency, int holdability) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setSavepoint
private void setSavepoint(SavepointImpl savepoint) throws java.sql.SQLException
Add a savepoint to the list maintained by this connection.- Parameters:
savepoint- The savepoint object to add.- Throws:
java.sql.SQLException
-
clearSavepoints
private void clearSavepoints()
Releases all savepoints. Used internally when committing or rolling back a transaction.
-
releaseSavepoint
public void releaseSavepoint(java.sql.Savepoint savepoint) throws java.sql.SQLException- Specified by:
releaseSavepointin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
rollback
public void rollback(java.sql.Savepoint savepoint) throws java.sql.SQLException- Specified by:
rollbackin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setSavepoint
public java.sql.Savepoint setSavepoint() throws java.sql.SQLException- Specified by:
setSavepointin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setSavepoint
public java.sql.Savepoint setSavepoint(java.lang.String name) throws java.sql.SQLException- Specified by:
setSavepointin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getNextSavepointId
private int getNextSavepointId()
Returns the next savepoint identifier.- Returns:
- the next savepoint identifier
-
addCachedProcedure
void addCachedProcedure(java.lang.String key)
Add a stored procedure to the savepoint cache.- Parameters:
key- The signature of the procedure to cache.
-
createArrayOf
public java.sql.Array createArrayOf(java.lang.String typeName, java.lang.Object[] elements) throws java.sql.SQLException- Specified by:
createArrayOfin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createBlob
public java.sql.Blob createBlob() throws java.sql.SQLException- Specified by:
createBlobin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createClob
public java.sql.Clob createClob() throws java.sql.SQLException- Specified by:
createClobin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createNClob
public java.sql.NClob createNClob() throws java.sql.SQLException- Specified by:
createNClobin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createSQLXML
public java.sql.SQLXML createSQLXML() throws java.sql.SQLException- Specified by:
createSQLXMLin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createStruct
public java.sql.Struct createStruct(java.lang.String typeName, java.lang.Object[] attributes) throws java.sql.SQLException- Specified by:
createStructin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getClientInfo
public java.util.Properties getClientInfo() throws java.sql.SQLException- Specified by:
getClientInfoin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getClientInfo
public java.lang.String getClientInfo(java.lang.String name) throws java.sql.SQLException- Specified by:
getClientInfoin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
isValid
public boolean isValid(int timeout) throws java.sql.SQLException- Specified by:
isValidin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setClientInfo
public void setClientInfo(java.util.Properties properties) throws java.sql.SQLClientInfoException- Specified by:
setClientInfoin interfacejava.sql.Connection- Throws:
java.sql.SQLClientInfoException
-
setClientInfo
public void setClientInfo(java.lang.String name, java.lang.String value) throws java.sql.SQLClientInfoException- Specified by:
setClientInfoin interfacejava.sql.Connection- Throws:
java.sql.SQLClientInfoException
-
isWrapperFor
public boolean isWrapperFor(java.lang.Class arg0) throws java.sql.SQLException- Specified by:
isWrapperForin interfacejava.sql.Wrapper- Throws:
java.sql.SQLException
-
unwrap
public java.lang.Object unwrap(java.lang.Class arg0) throws java.sql.SQLException- Specified by:
unwrapin interfacejava.sql.Wrapper- Throws:
java.sql.SQLException
-
setSchema
public void setSchema(java.lang.String schema) throws java.sql.SQLException- Specified by:
setSchemain interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getSchema
public java.lang.String getSchema() throws java.sql.SQLException- Specified by:
getSchemain interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
abort
public void abort(java.util.concurrent.Executor executor) throws java.sql.SQLException- Specified by:
abortin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setNetworkTimeout
public void setNetworkTimeout(java.util.concurrent.Executor executor, int milliseconds) throws java.sql.SQLException- Specified by:
setNetworkTimeoutin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getNetworkTimeout
public int getNetworkTimeout() throws java.sql.SQLException- Specified by:
getNetworkTimeoutin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
-