|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.jtds.jdbc.ConnectionJDBC2
jTDS implementation of the java.sql.Connection interface.
Implementation notes:
Field Summary | |
private java.lang.String |
appName
The application name. |
private boolean |
autoCommit
Default auto commit state. |
private TdsCore |
baseTds
The cored TDS protocol object. |
private int |
batchSize
The maximum size of a batch. |
private java.lang.String |
bindAddress
The local address to bind to when connecting to a database via TCP/IP. |
private java.io.File |
bufferDir
The directory to buffer data to |
private int |
bufferMaxMemory
The global buffer memory limit for all connections (in kilobytes). |
private int |
bufferMinPackets
The minimum number of packets per statement to buffer to memory. |
private TdsCore |
cachedTds
A cached TdsCore instance to reuse on new statements. |
private CharsetInfo |
charsetInfo
Java charset for encoding. |
private boolean |
charsetSpecified
True if user specifies an explicit charset. |
private boolean |
closed
True if this connection is closed. |
private byte[] |
collation
SQL Server 2000 collation. |
private static int[] |
connections
the number of currently open connections |
private java.lang.String |
currentDatabase
The current database name. |
private int |
cursorSequenceNo
Cursor unique ID number. |
private int |
databaseMajorVersion
The major version number eg 11. |
private int |
databaseMinorVersion
The minor version number eg 92. |
private java.lang.String |
databaseName
The requested database name. |
private java.lang.String |
databaseProductName
The database product name eg SQL SERVER. |
private java.lang.String |
databaseProductVersion
The product version eg 11.92. |
private java.lang.String |
domainName
The Windows Domain name. |
private java.lang.String |
instanceName
The SQL Server instance. |
private java.lang.String |
language
The server message language. |
private boolean |
lastUpdateCount
Only return the last update count. |
private long |
lobBuffer
The amount of LOB data to buffer in memory. |
private int |
loginTimeout
Login timeout value in seconds or 0. |
private java.lang.String |
macAddress
The client MAC Address. |
private int |
maxPrecision
Maximum decimal precision. |
private int |
maxStatements
The maximum number of statements to keep open. |
private SQLDiagnostic |
messages
Diagnostc messages for this connection. |
private Semaphore |
mutex
Mutual exclusion lock to control access to connection. |
private boolean |
namedPipe
Use named pipe IPC instead of TCP/IP sockets. |
private int |
netPacketSize
The initial network packet size. |
private int |
packetSize
User requested packet size. |
private java.lang.String |
password
The user password. |
private int |
portNumber
The server port number. |
private int |
prepareSql
Method for preparing SQL used in Prepared Statements. |
private static java.lang.Integer |
processId
The process ID to report to a server when connecting. |
private java.util.ArrayList |
procInTran
Procedures in this transaction. |
private java.lang.String |
progName
The program name. |
private boolean |
readOnly
True if this connection is read only. |
private int |
rowCount
Connection's current rowcount limit. |
private java.lang.String |
serverCharset
The server character set. |
private java.lang.String |
serverName
The server host name. |
private int |
serverType
The make of SQL Server (sybase/microsoft). |
private SharedSocket |
socket
The network TCP/IP socket. |
private boolean |
socketKeepAlive
True to enable socket keep alive. |
private int |
socketTimeout
Socket timeout value in seconds or 0. |
private int |
spSequenceNo
Stored procedure unique ID number. |
private static java.lang.String |
SQL_SERVER_65_CHARSET_QUERY
SQL query to determine the server charset on MS SQL Server 6.5. |
private static java.lang.String |
SQL_SERVER_INITIAL_SQL
SQL Server initial connection string. |
private java.lang.String |
ssl
SSL setting. |
private StatementCache |
statementCache
Statement cache. |
private java.util.ArrayList |
statements
List of statements associated with this connection. |
private static java.lang.String |
SYBASE_INITIAL_SQL
Sybase initial connection string. |
private static java.lang.String |
SYBASE_SERVER_CHARSET_QUERY
SQL query to determine the server charset on Sybase. |
private int |
sybaseInfo
Sybase capability mask. |
private boolean |
tcpNoDelay
TCP_NODELAY |
private int |
tdsVersion
The server protocol version. |
private int |
textSize
Connection's current maximum field size limit. |
static int |
TRANSACTION_SNAPSHOT
SQL Server custom transaction isolation level. |
private int |
transactionIsolation
Default transaction isolation level. |
private java.lang.String |
url
The orginal connection URL. |
private boolean |
useCursors
Use fast forward cursors for forward only result sets. |
private boolean |
useJCIFS
Force use of jCIFS library on Windows when connecting via named pipes. |
private boolean |
useLOBs
Map large types (IMAGE and TEXT/NTEXT) to LOBs by default. |
private boolean |
useMetadataCache
Use metadata cache for prepared statements. |
private boolean |
useNTLMv2
When doing NTLM authentication, send NTLMv2 response rather than regular response |
private java.lang.String |
user
The database user ID. |
private boolean |
useUnicode
Send parameters as unicode. |
private java.lang.String |
wsid
Workstation ID. |
private boolean |
xaEmulation
True if driver should emulate distributed transactions. |
private int |
xaState
Current emulated XA State eg start/end/prepare etc. |
private boolean |
xaTransaction
True if running distributed transaction. |
private java.lang.Object |
xid
Current XA Transaction ID. |
Fields inherited from interface java.sql.Connection |
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
Constructor Summary | |
private |
ConnectionJDBC2()
Default constructor. |
(package private) |
ConnectionJDBC2(java.lang.String url,
java.util.Properties info)
Create a new database connection. |
Method Summary | |
(package private) void |
addCachedProcedure(java.lang.String key,
ProcEntry proc)
Add a stored procedure to the cache. |
(package private) void |
addStatement(JtdsStatement statement)
Adds a statement object to the list maintained by the connection. |
(package private) void |
checkLocal(java.lang.String method)
Checks that this connection is in local transaction mode. |
(package private) void |
checkOpen()
Checks that the connection is still open. |
(package private) void |
clearSavepoints()
Releases all savepoints. |
void |
clearWarnings()
|
void |
close()
Releases this Connection object's database and JDBC
resources immediately instead of waiting for them to be automatically
released.
|
void |
commit()
|
private SharedSocket |
createNamedPipe(ConnectionJDBC2 connection)
Creates a SharedSocket object representing a connection to a named
pipe. |
java.sql.Statement |
createStatement()
|
java.sql.Statement |
createStatement(int type,
int concurrency)
|
java.sql.Statement |
createStatement(int type,
int concurrency,
int holdability)
|
private java.lang.String |
determineServerCharset()
Discovers the server charset for server versions that do not send ENVCHANGE packets on login ack, by executing a DB
vendor/version specific query.
|
(package private) void |
enlistConnection(byte[] oleTranID)
Enlists the current connection in a distributed transaction. |
protected void |
finalize()
Ensure all resources are released. |
(package private) java.lang.String |
getAppName()
Retrieves the application name for this connection. |
boolean |
getAutoCommit()
|
(package private) int |
getBatchSize()
Retrieves the batch size to be used internally. |
(package private) java.lang.String |
getBindAddress()
Retrieves the bind address for this connection. |
(package private) java.io.File |
getBufferDir()
Returns the directory where data should be buffered to. |
(package private) int |
getBufferMaxMemory()
Retrieves the maximum amount of memory in Kb to buffer for all connections. |
(package private) int |
getBufferMinPackets()
Retrieves the minimum number of packets to buffer per Statement for this connection. |
(package private) TdsCore |
getCachedTds()
Retrieves the cached TdsCore or null if
nothing is cached and resets the cache (sets it to null ). |
java.lang.String |
getCatalog()
|
protected java.lang.String |
getCharset()
Retrieve the Java charset to use for encoding. |
protected CharsetInfo |
getCharsetInfo()
Retrieve the CharsetInfo instance used by this connection. |
(package private) byte[] |
getCollation()
Retrieve the SQL Server 2000 default collation. |
(package private) java.lang.String |
getCursorName()
Retrieves the next unique cursor name. |
int |
getDatabaseMajorVersion()
Retrieves the DBMS major version. |
int |
getDatabaseMinorVersion()
Retrieves the DBMS minor version. |
(package private) java.lang.String |
getDatabaseName()
Retrieves the database name for this connection. |
(package private) java.lang.String |
getDatabaseProductName()
Retrieves the DBMS product name. |
(package private) java.lang.String |
getDatabaseProductVersion()
Retrieves the DBMS product version. |
(package private) java.lang.String |
getDomainName()
Retrieves the domain name for this connection. |
int |
getHoldability()
|
(package private) java.lang.String |
getInstanceName()
Retrieves the instance name for this connection. |
(package private) boolean |
getLastUpdateCount()
Retrieves the status of the lastUpdateCount flag. |
(package private) long |
getLobBuffer()
Retrieves the LOB buffer size. |
(package private) int |
getLoginTimeout()
Retrieves the login timeout for this connection. |
(package private) java.lang.String |
getMacAddress()
Retrieves the MAC (ethernet) address for this connection. |
(package private) int |
getMaxPrecision()
Retrieves the maximum decimal precision. |
(package private) int |
getMaxStatements()
Retrieves the maximum statement cache size. |
java.sql.DatabaseMetaData |
getMetaData()
|
(package private) Semaphore |
getMutex()
Retrieves the connection mutex and acquires an exclusive lock on the network connection. |
(package private) boolean |
getNamedPipe()
Retrieves the named pipe setting for this connection. |
(package private) int |
getNetPacketSize()
Retrieves the network packet size. |
(package private) int |
getPacketSize()
Retrieves the packet size for this connection. |
(package private) java.lang.String |
getPassword()
Retrieves the password for this connection. |
(package private) int |
getPortNumber()
Retrieves the port number for this connection. |
(package private) int |
getPrepareSql()
Retrieves the Prepared SQL method. |
(package private) int |
getProcessId()
Retrieves the process ID to send to a server when a connection is established. |
(package private) java.lang.String |
getProcName()
Retrieves the next unique stored procedure name. |
(package private) java.lang.String |
getProgName()
Retrieves the program name for this connection. |
java.lang.String |
getRmHost()
Retrieves the host and port for this connection. |
(package private) int |
getRowCount()
Retrieves the current row count on this connection. |
(package private) java.lang.String |
getServerName()
Retrieves the server name for this connection. |
int |
getServerType()
Retrieves the server type. |
(package private) SharedSocket |
getSocket()
Retrive the shared socket. |
(package private) boolean |
getSocketKeepAlive()
Retrieves whether to enable socket keep alive. |
(package private) int |
getSocketTimeout()
Retrieves the socket timeout for this connection. |
protected boolean |
getSybaseInfo(int flag)
Retrieve the Sybase capability data. |
(package private) boolean |
getTcpNoDelay()
Retrieves the tcpNoDelay setting for this connection. |
(package private) int |
getTdsVersion()
Retrieve the TDS protocol version. |
int |
getTextSize()
Retrieves the current maximum textsize on this connection. |
int |
getTransactionIsolation()
|
java.util.Map |
getTypeMap()
|
(package private) java.lang.String |
getURL()
Retrieves the original connection URL. |
(package private) boolean |
getUseCursors()
Indicates whether fast forward only cursors should be used for forward only result sets. |
(package private) boolean |
getUseJCIFS()
Retrieves the useJCIFS setting for this connection. |
(package private) boolean |
getUseLOBs()
Indicates whether large types (IMAGE and TEXT/NTEXT) should be mapped by default to LOB types or String and byte[]
respectively. |
(package private) boolean |
getUseMetadataCache()
Retrieves the boolean indicating whether metadata caching is enabled. |
(package private) boolean |
getUseNTLMv2()
Indicates whether, when doing Windows authentication to an MS SQL server, NTLMv2 should be used. |
(package private) java.lang.String |
getUser()
Retrieves the user for this connection. |
protected boolean |
getUseUnicode()
Retrieve the sendParametersAsUnicode flag. |
java.sql.SQLWarning |
getWarnings()
|
(package private) java.lang.String |
getWsid()
Retrieves the workstation ID (WSID) for this connection. |
(package private) int |
getXaState()
Retrieves the XA state variable. |
(package private) java.lang.Object |
getXid()
Gets the XA transaction ID when running in emulation mode. |
(package private) boolean |
isCharsetSpecified()
Retrieves whether a specific charset was requested on creation. |
boolean |
isClosed()
|
boolean |
isReadOnly()
|
protected boolean |
isWideChar()
Retrieve the multibyte status of the current character set. |
(package private) boolean |
isXaEmulation()
Retrieves the XA Emulation flag. |
private void |
loadCharset(CharsetInfo ci,
java.lang.String ref)
Load the Java charset to match the server character set. |
private void |
loadCharset(java.lang.String charset)
Load the Java charset to match the server character set. |
java.lang.String |
nativeSQL(java.lang.String sql)
|
(package private) static void |
notImplemented(java.lang.String method)
Reports that user tried to call a method which has not been implemented. |
private static boolean |
parseBooleanProperty(java.util.Properties info,
java.lang.String key)
Parse a string property value into an boolean value. |
private static int |
parseIntegerProperty(java.util.Properties info,
java.lang.String key)
Parse a string property value into an integer value. |
private static long |
parseLongProperty(java.util.Properties info,
java.lang.String key)
Parse a string property value into a long value. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql)
|
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int type,
int concurrency)
|
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int type,
int concurrency,
int holdability)
|
(package private) java.lang.String |
prepareSQL(JtdsPreparedStatement pstmt,
java.lang.String sql,
ParamInfo[] params,
boolean returnKeys,
boolean cursorNeeded)
Try to convert the SQL statement into a statement prepare. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int autoGeneratedKeys)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int[] columnIndexes)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int type,
int concurrency)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int type,
int concurrency,
int holdability)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
java.lang.String[] columnNames)
|
void |
releaseSavepoint(java.sql.Savepoint savepoint)
|
(package private) void |
releaseTds(TdsCore tds)
Releases (either closes or caches) a TdsCore . |
(package private) void |
removeCachedProcedure(java.lang.String key)
Remove a stored procedure from the cache. |
(package private) void |
removeStatement(JtdsStatement statement)
Removes a statement object from the list maintained by the connection and cleans up the statement cache if necessary. |
void |
rollback()
|
void |
rollback(java.sql.Savepoint savepoint)
|
(package private) byte[][] |
sendXaPacket(int[] args,
byte[] data)
Invokes the xp_jtdsxa extended stored procedure on the
server.
|
void |
setAutoCommit(boolean autoCommit)
|
void |
setCatalog(java.lang.String catalog)
|
(package private) void |
setClosed()
Forces the closed status on the statement if an I/O error has occurred. |
(package private) void |
setCollation(byte[] collation)
Set the default collation for this connection. |
protected void |
setDatabase(java.lang.String newDb,
java.lang.String oldDb)
Called by the protcol to change the current database context. |
protected void |
setDBServerInfo(java.lang.String databaseProductName,
int databaseMajorVersion,
int databaseMinorVersion,
int buildNumber)
Update the connection instance with information about the server. |
void |
setHoldability(int holdability)
|
(package private) void |
setNetPacketSize(int size)
Sets the network packet size. |
void |
setReadOnly(boolean readOnly)
|
(package private) void |
setRowCount(int count)
Sets the current row count on this connection. |
java.sql.Savepoint |
setSavepoint()
|
java.sql.Savepoint |
setSavepoint(java.lang.String name)
|
protected void |
setServerCharset(java.lang.String charset)
Called by the protocol to change the current character set. |
protected void |
setSybaseInfo(int mask)
Set the Sybase capability data. |
void |
setTextSize(int textSize)
Sets the current maximum textsize on this connection. |
void |
setTransactionIsolation(int level)
|
void |
setTypeMap(java.util.Map map)
|
(package private) void |
setXaState(int value)
Sets the XA state variable. |
(package private) void |
setXid(java.lang.Object xid)
Sets the XA transaction ID when running in emulation mode. |
protected void |
unpackProperties(java.util.Properties info)
Transfers the properties to the local instance variables. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String SYBASE_SERVER_CHARSET_QUERY
private static final java.lang.String SQL_SERVER_65_CHARSET_QUERY
private static final java.lang.String SYBASE_INITIAL_SQL
private static final java.lang.String SQL_SERVER_INITIAL_SQL
SELECT @@MAX_PRECISION
query to retrieve
the maximum precision for DECIMAL/NUMERIC data.
public static final int TRANSACTION_SNAPSHOT
private final java.lang.String url
private java.lang.String serverName
private int portNumber
private int serverType
private java.lang.String instanceName
private java.lang.String databaseName
private java.lang.String currentDatabase
private java.lang.String domainName
private java.lang.String user
private java.lang.String password
private java.lang.String serverCharset
private java.lang.String appName
private java.lang.String progName
private java.lang.String wsid
private java.lang.String language
private java.lang.String macAddress
private int tdsVersion
private final SharedSocket socket
private final TdsCore baseTds
private int netPacketSize
private int packetSize
private byte[] collation
private boolean charsetSpecified
private java.lang.String databaseProductName
private java.lang.String databaseProductVersion
private int databaseMajorVersion
private int databaseMinorVersion
private boolean closed
private boolean readOnly
private final java.util.ArrayList statements
private int transactionIsolation
private boolean autoCommit
private final SQLDiagnostic messages
private int rowCount
private int textSize
private int maxPrecision
private int spSequenceNo
private int cursorSequenceNo
private final java.util.ArrayList procInTran
private CharsetInfo charsetInfo
private int prepareSql
private long lobBuffer
private int maxStatements
private StatementCache statementCache
private boolean useUnicode
private boolean namedPipe
private boolean lastUpdateCount
private boolean tcpNoDelay
private int loginTimeout
private int sybaseInfo
private boolean xaTransaction
private int xaState
private java.lang.Object xid
private boolean xaEmulation
private final Semaphore mutex
private int socketTimeout
private boolean socketKeepAlive
private static java.lang.Integer processId
private java.lang.String ssl
private int batchSize
private boolean useMetadataCache
private boolean useCursors
private java.io.File bufferDir
private int bufferMaxMemory
private int bufferMinPackets
private boolean useLOBs
private TdsCore cachedTds
TdsCore
instance to reuse on new statements.
private java.lang.String bindAddress
private boolean useJCIFS
private boolean useNTLMv2
private static int[] connections
Constructor Detail |
private ConnectionJDBC2()
ConnectionJDBC2(java.lang.String url, java.util.Properties info) throws java.sql.SQLException
url
- The connection URL starting jdbc:jtds:.info
- The additional connection properties.
java.sql.SQLException
Method Detail |
protected void finalize() throws java.lang.Throwable
java.lang.Throwable
private SharedSocket createNamedPipe(ConnectionJDBC2 connection) throws java.io.IOException
SharedSocket
object representing a connection to a named
pipe. If the os.name
system property starts with "Windows"
(case-insensitive) and the useJCIFS
parameter is
false
, a SharedLocalNamedPipe
object is created.
Else a SharedNamedPipe
is created which uses
jCIFS to provide a pure-Java
implementation of Windows named pipes.
This method will retry for loginTimeout
seconds to create a
named pipe if an IOException
continues to be thrown stating,
"All pipe instances are busy". If loginTimeout
is set to
zero (e.g., not set), a default of 20 seconds will be used.
connection
- the connection object
java.io.IOException
- on error; if an IOException
is thrown with
a message stating "All pipe instances are busy", then the method timed out
after loginTimeout
milliseconds attempting to create a named pipe.SharedSocket getSocket()
SharedSocket
object.int getTdsVersion()
int
.java.lang.String getProcName()
Notes:
prepareSQL(net.sourceforge.jtds.jdbc.JtdsPreparedStatement, java.lang.String, net.sourceforge.jtds.jdbc.ParamInfo[], boolean, boolean)
method.
String
java.lang.String getCursorName()
String
java.lang.String prepareSQL(JtdsPreparedStatement pstmt, java.lang.String sql, ParamInfo[] params, boolean returnKeys, boolean cursorNeeded) throws java.sql.SQLException
Synchronized because it accesses the procedure cache and the
baseTds
, but the method call also needs to made in a
synchronized (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.
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
String
or null if the
SQL cannot be prepared
java.sql.SQLException
void addCachedProcedure(java.lang.String key, ProcEntry proc)
Not explicitly synchronized because it's only called by synchronized methods.
key
- The signature of the procedure to cache.proc
- The stored procedure descriptor.void removeCachedProcedure(java.lang.String key)
Not explicitly synchronized because it's only called by synchronized methods.
key
- The signature of the procedure to remove from the cache.int getMaxStatements()
public int getServerType()
int
where 1 == SQLSERVER and
2 == SYBASE.void setNetPacketSize(int size)
size
- the new packet sizeint getNetPacketSize()
int
int getRowCount()
int
void setRowCount(int count)
count
- the new row countpublic int getTextSize()
int
public void setTextSize(int textSize)
textSize
- the new maximum textsizeboolean getLastUpdateCount()
boolean
int getMaxPrecision()
int
long getLobBuffer()
long
int getPrepareSql()
int getBatchSize()
int
boolean getUseMetadataCache()
true
if metadata caching is enabled,
false
if caching is disabledboolean getUseCursors()
true
if fast forward cursors are requestedboolean getUseLOBs()
String
and byte[]
respectively.
true
if the default mapping should be to LOBs,
false
otherwiseboolean getUseNTLMv2()
java.lang.String getAppName()
java.lang.String getBindAddress()
java.io.File getBufferDir()
int getBufferMaxMemory()
int getBufferMinPackets()
Statement
for this connection.
Statement
java.lang.String getDatabaseName()
java.lang.String getDomainName()
java.lang.String getInstanceName()
int getLoginTimeout()
int getSocketTimeout()
boolean getSocketKeepAlive()
true
if the socket keep alive is enabledint getProcessId()
java.lang.String getMacAddress()
boolean getNamedPipe()
int getPacketSize()
java.lang.String getPassword()
int getPortNumber()
java.lang.String getProgName()
java.lang.String getServerName()
boolean getTcpNoDelay()
boolean getUseJCIFS()
java.lang.String getUser()
java.lang.String getWsid()
protected void unpackProperties(java.util.Properties info) throws java.sql.SQLException
info
- The connection properties Object.
java.sql.SQLException
- If an invalid property value is found.private static boolean parseBooleanProperty(java.util.Properties info, java.lang.String key) throws java.sql.SQLException
info
- The connection properties object.key
- The message key used to retrieve the property name.
java.sql.SQLException
- If the property value can't be parsed.private static int parseIntegerProperty(java.util.Properties info, java.lang.String key) throws java.sql.SQLException
info
- The connection properties object.key
- The message key used to retrieve the property name.
java.sql.SQLException
- If the property value can't be parsed.private static long parseLongProperty(java.util.Properties info, java.lang.String key) throws java.sql.SQLException
info
- The connection properties object.key
- The message key used to retrieve the property name.
java.sql.SQLException
- If the property value can't be parsed.protected java.lang.String getCharset()
String
protected boolean isWideChar()
boolean
true if a multi byte character setprotected CharsetInfo getCharsetInfo()
CharsetInfo
instance used by this connection.
CharsetInfo
for this connectionprotected boolean getUseUnicode()
boolean
true if parameters should be sent as unicode.protected boolean getSybaseInfo(int flag)
int
.protected void setSybaseInfo(int mask)
mask
- The capability bit mask.protected void setServerCharset(java.lang.String charset) throws java.sql.SQLException
charset
- the server character set name
java.sql.SQLException
private void loadCharset(java.lang.String charset) throws java.sql.SQLException
charset
- the server character set
java.sql.SQLException
private void loadCharset(CharsetInfo ci, java.lang.String ref) throws java.sql.SQLException
ci
- the CharsetInfo
to load
java.sql.SQLException
private java.lang.String determineServerCharset() throws java.sql.SQLException
ENVCHANGE
packets on login ack, by executing a DB
vendor/version specific query.
Will throw an SQLException
if used on SQL Server 7.0 or
2000; the idea is that the charset should already be determined from
ENVCHANGE
packets for these DB servers.
Should only be called from the constructor.
java.sql.SQLException
- if an error condition occursvoid setCollation(byte[] collation) throws java.sql.SQLException
Set by a SQL Server 2000 environment change packet. The collation consists of the following fields:
collation
- The new collation.
java.sql.SQLException
byte[] getCollation()
byte[5]
.boolean isCharsetSpecified()
protected void setDatabase(java.lang.String newDb, java.lang.String oldDb) throws java.sql.SQLException
newDb
- The new database selected on the server.oldDb
- The old database as known by the server.
java.sql.SQLException
protected void setDBServerInfo(java.lang.String databaseProductName, int databaseMajorVersion, int databaseMinorVersion, int buildNumber)
databaseProductName
- The server name eg SQL Server.databaseMajorVersion
- The major version eg 11databaseMinorVersion
- The minor version eg 92buildNumber
- The server build number.void removeStatement(JtdsStatement statement) throws java.sql.SQLException
Synchronized because it accesses the statement list, the statement cache
and the baseTds
.
statement
- the statement to remove
java.sql.SQLException
void addStatement(JtdsStatement statement)
statement
- statement to addvoid checkOpen() throws java.sql.SQLException
java.sql.SQLException
- if the connection is closedvoid checkLocal(java.lang.String method) throws java.sql.SQLException
method
- the method name being tested
java.sql.SQLException
- if in XA distributed transaction modestatic void notImplemented(java.lang.String method) throws java.sql.SQLException
method
- the method name to report in the error message
java.sql.SQLException
- always, with the not implemented messagepublic int getDatabaseMajorVersion()
int
public int getDatabaseMinorVersion()
int
java.lang.String getDatabaseProductName()
String
java.lang.String getDatabaseProductVersion()
String
java.lang.String getURL()
String
public java.lang.String getRmHost()
Used to identify same resource manager in XA transactions.
String
void setClosed()
byte[][] sendXaPacket(int[] args, byte[] data) throws java.sql.SQLException
xp_jtdsxa
extended stored procedure on the
server.
Synchronized because it accesses the baseTds
.
args
- the arguments eg cmd, rmid, flags etc.data
- option byte data eg open string xid etc.
java.sql.SQLException
- if an error condition occursvoid enlistConnection(byte[] oleTranID) throws java.sql.SQLException
oleTranID
- the OLE transaction cookie or null to delist
java.sql.SQLException
- if an error condition occursvoid setXid(java.lang.Object xid)
xid
- the XA Transaction IDjava.lang.Object getXid()
Object
void setXaState(int value)
value
- the XA state valueint getXaState()
int
boolean isXaEmulation()
Semaphore getMutex()
Semaphore
void releaseTds(TdsCore tds) throws java.sql.SQLException
TdsCore
.
tds
- the TdsCore
instance to release
java.sql.SQLException
- if an error occurs while closing or cleaning upTdsCore getCachedTds()
TdsCore
or null
if
nothing is cached and resets the cache (sets it to null
).
cachedTds
public int getHoldability() throws java.sql.SQLException
getHoldability
in interface java.sql.Connection
java.sql.SQLException
public int getTransactionIsolation() throws java.sql.SQLException
getTransactionIsolation
in interface java.sql.Connection
java.sql.SQLException
public void clearWarnings() throws java.sql.SQLException
clearWarnings
in interface java.sql.Connection
java.sql.SQLException
public void close() throws java.sql.SQLException
Connection
object's database and JDBC
resources immediately instead of waiting for them to be automatically
released.
Calling the method close on a Connection
object that is
already closed is a no-op.
Note: A Connection
object is automatically closed
when it is garbage collected. Certain fatal errors also close a
Connection
object.
Synchronized because it accesses the statement list and the
baseTds
.
close
in interface java.sql.Connection
java.sql.SQLException
- if a database access error occurspublic void commit() throws java.sql.SQLException
commit
in interface java.sql.Connection
java.sql.SQLException
public void rollback() throws java.sql.SQLException
rollback
in interface java.sql.Connection
java.sql.SQLException
public boolean getAutoCommit() throws java.sql.SQLException
getAutoCommit
in interface java.sql.Connection
java.sql.SQLException
public boolean isClosed() throws java.sql.SQLException
isClosed
in interface java.sql.Connection
java.sql.SQLException
public boolean isReadOnly() throws java.sql.SQLException
isReadOnly
in interface java.sql.Connection
java.sql.SQLException
public void setHoldability(int holdability) throws java.sql.SQLException
setHoldability
in interface java.sql.Connection
java.sql.SQLException
public void setTransactionIsolation(int level) throws java.sql.SQLException
setTransactionIsolation
in interface java.sql.Connection
java.sql.SQLException
public void setAutoCommit(boolean autoCommit) throws java.sql.SQLException
setAutoCommit
in interface java.sql.Connection
java.sql.SQLException
public void setReadOnly(boolean readOnly) throws java.sql.SQLException
setReadOnly
in interface java.sql.Connection
java.sql.SQLException
public java.lang.String getCatalog() throws java.sql.SQLException
getCatalog
in interface java.sql.Connection
java.sql.SQLException
public void setCatalog(java.lang.String catalog) throws java.sql.SQLException
setCatalog
in interface java.sql.Connection
java.sql.SQLException
public java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLException
getMetaData
in interface java.sql.Connection
java.sql.SQLException
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException
getWarnings
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Savepoint setSavepoint() throws java.sql.SQLException
setSavepoint
in interface java.sql.Connection
java.sql.SQLException
public void releaseSavepoint(java.sql.Savepoint savepoint) throws java.sql.SQLException
releaseSavepoint
in interface java.sql.Connection
java.sql.SQLException
public void rollback(java.sql.Savepoint savepoint) throws java.sql.SQLException
rollback
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Statement createStatement() throws java.sql.SQLException
createStatement
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Statement createStatement(int type, int concurrency) throws java.sql.SQLException
createStatement
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Statement createStatement(int type, int concurrency, int holdability) throws java.sql.SQLException
createStatement
in interface java.sql.Connection
java.sql.SQLException
public java.util.Map getTypeMap() throws java.sql.SQLException
getTypeMap
in interface java.sql.Connection
java.sql.SQLException
public void setTypeMap(java.util.Map map) throws java.sql.SQLException
setTypeMap
in interface java.sql.Connection
java.sql.SQLException
public java.lang.String nativeSQL(java.lang.String sql) throws java.sql.SQLException
nativeSQL
in interface java.sql.Connection
java.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
java.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql, int type, int concurrency) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
java.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql, int type, int concurrency, int holdability) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int type, int concurrency) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int type, int concurrency, int holdability) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Savepoint setSavepoint(java.lang.String name) throws java.sql.SQLException
setSavepoint
in interface java.sql.Connection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
void clearSavepoints()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |