i-net JDBC drivers for Sybase

com.inet.syb
Class SybDataSource

java.lang.Object
  extended bycom.inet.syb.SybDriver
      extended bycom.inet.syb.SybDataSource
All Implemented Interfaces:
java.lang.Cloneable, javax.sql.DataSource, java.sql.Driver, javax.naming.Referenceable, java.lang.Runnable, java.io.Serializable
Direct Known Subclasses:
PDataSource, XDataSource

public class SybDataSource
extends com.inet.syb.SybDriver
implements javax.sql.DataSource, java.io.Serializable, java.lang.Cloneable, javax.naming.Referenceable

This class is an implementation of a simple DataSource for the drivers i-net SY-TO(tm) / i-net SYBELUX(tm).

See Also:
Serialized Form

Constructor Summary
SybDataSource()
          Attempt to create a Datasource.
SybDataSource(java.util.Properties info)
          Attempt to create a Datasource with the given properties.
 
Method Summary
 java.lang.Object clone()
          Create a new object of the same class like this DataSource.
 boolean equals(java.lang.Object obj)
          Compare this DataSource to the specified object.
 java.lang.String getAppname()
          Return the Application Name.
 java.lang.String getChained()
          Get the chained property.
 java.lang.String getCharset()
          Return the charset for the connection.
 java.sql.Connection getConnection()
          Attempt to establish a connection to the database.
 java.sql.Connection getConnection(java.lang.String username, java.lang.String password)
          Attempt to establish a connection to the database.
 java.lang.String getDatabaseName()
          Return the first database name of the connection after login.
 java.lang.String getDescription()
          Return a one line description of the DataSource.
 boolean getImpltran()
          Get the implicit transaction mode of the driver.
 java.lang.String getLogging()
          Returns the value of logging property
 int getLoginTimeout()
          Returns the timeout for login.
 java.io.PrintWriter getLogWriter()
           
 java.lang.String getPassword()
          Return the password for the connection.
 java.lang.String getPort()
          Return the TCP/IP port number of the Sybase Server.
 int getPortNumber()
          Return the TCP/IP port number of the Sybase Server.
 java.util.Properties getProperties()
          Get all properties of the DataSource without LoginTimeout and LogWriter.
 java.lang.String getProperty(java.lang.String name)
          Get any property of the DataSource without LoginTimeout and LogWriter.
 javax.naming.Reference getReference()
          Retrieves the Reference of this SybDataSource object.
 java.lang.String getServerName()
          Return the server name of the Sybase Server.
 java.lang.String getUser()
          Return the user for the connection.
 void setAppname(java.lang.String appname)
          Set the Application Name.
 void setChained(java.lang.String chained)
          Set the chained property.
 void setCharset(java.lang.String charset)
          Set the charset for the connection.
 void setDatabaseName(java.lang.String databaseName)
          Set the first database name of the connection after login.
 void setDescription(java.lang.String description)
          Set the description of the DataSource.
 void setImpltran(boolean impltran)
          Set the implicit transaction mode.
 void setLogging(java.lang.String logging)
          Set the logging property of driver.
 void setLoginTimeout(int seconds)
          Set the login timeout for the connection.
 void setLogWriter(java.io.PrintWriter out)
           
 void setPassword(java.lang.String password)
          Set the password for the connection.
 void setPort(java.lang.String port)
          Set TCP/IP port number of the Sybase Server.
 void setPortNumber(int portNumber)
          Set TCP/IP port number of the Sybase Server.
 void setProperties(java.util.Properties properties)
          Set all properties of the DataSource without LoginTimeout and LogWriter.
 void setProperty(java.lang.String name, java.lang.Object value)
          Set any property of the DataSource without LoginTimeout and LogWriter.
 void setProperty(java.lang.String name, java.lang.String value)
          Set any property of the DataSource without LoginTimeout and LogWriter.
 void setServerName(java.lang.String serverName)
          Set the server name of the Sybase Server.
 void setUser(java.lang.String user)
          Set the user account for the connection.
 java.lang.String toString()
           
 
Methods inherited from class com.inet.syb.SybDriver
acceptsURL, connect, getMajorVersion, getMinorVersion, getPropertyInfo, jdbcCompliant, run
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SybDataSource

public SybDataSource()
Attempt to create a Datasource.


SybDataSource

public SybDataSource(java.util.Properties info)
              throws java.sql.SQLException
Attempt to create a Datasource with the given properties.

Parameters:
info - a list of arbitrary string tag/value pairs as connection arguments; normally at least a "user" and "password" property should be included
Method Detail

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Attempt to establish a connection to the database.

Specified by:
getConnection in interface javax.sql.DataSource
Returns:
a Connection to the database.
Throws:
java.sql.SQLException

getConnection

public java.sql.Connection getConnection(java.lang.String username,
                                         java.lang.String password)
                                  throws java.sql.SQLException
Attempt to establish a connection to the database.

Specified by:
getConnection in interface javax.sql.DataSource
Parameters:
username - the database user on whose behalf the Connection is being made.
password - the user's password.
Returns:
a Connection to the database.
Throws:
java.sql.SQLException

getServerName

public java.lang.String getServerName()
Return the server name of the Sybase Server.

Returns:
the host name or IP-Address. If not set the value is "localhost".

setServerName

public void setServerName(java.lang.String serverName)
Set the server name of the Sybase Server.

Parameters:
serverName - the host name or IP-Address.

getDatabaseName

public java.lang.String getDatabaseName()
Return the first database name of the connection after login. If not set the user default database is used.

Returns:
the name of database. If not set the value is null.

setDatabaseName

public void setDatabaseName(java.lang.String databaseName)
Set the first database name of the connection after login.

Parameters:
databaseName - the name of database.

getDescription

public java.lang.String getDescription()
Return a one line description of the DataSource.

Returns:
the description. If not set the value is null.

setDescription

public void setDescription(java.lang.String description)
Set the description of the DataSource.

Parameters:
description - a one line description.

getAppname

public java.lang.String getAppname()
Return the Application Name.

Returns:
the appname. If not set the value is null.

setAppname

public void setAppname(java.lang.String appname)
Set the Application Name. This has only an effect for the Enterprice and OEM license

Parameters:
appname - a one line description.

getPortNumber

public int getPortNumber()
Return the TCP/IP port number of the Sybase Server.

Returns:
the port number. If not set the value is 5000.

setPortNumber

public void setPortNumber(int portNumber)
Set TCP/IP port number of the Sybase Server.

Parameters:
portNumber - the port number.

getPort

public java.lang.String getPort()
Return the TCP/IP port number of the Sybase Server.

Returns:
the port number. If not set the value will be "5000".

setPort

public void setPort(java.lang.String port)
Set TCP/IP port number of the Sybase Server.

Parameters:
port - the port number.

getPassword

public java.lang.String getPassword()
Return the password for the connection.

Returns:
the password. If not set the value is null.

setPassword

public void setPassword(java.lang.String password)
Set the password for the connection. If not set an empty password is used.

Parameters:
password - the password for the Sybase Server.

getCharset

public java.lang.String getCharset()
Return the charset for the connection.

Returns:
the charset. If not set the value is null.

setCharset

public void setCharset(java.lang.String charset)
Set the charset for the connection.

Parameters:
charset -

getUser

public java.lang.String getUser()
Return the user for the connection.

Returns:
the user. If not set the value is null.

setUser

public void setUser(java.lang.String user)
Set the user account for the connection.

Parameters:
user - the user name.

setChained

public void setChained(java.lang.String chained)
Set the chained property. If true then the driver change in the CHAINED MODE on autocommit false.

See Also:
getChained()

getChained

public java.lang.String getChained()
Get the chained property.

See Also:
setChained(java.lang.String)

setLogging

public void setLogging(java.lang.String logging)
Set the logging property of driver.

Parameters:
logging - either "true" or "false".

getLogging

public java.lang.String getLogging()
Returns the value of logging property

Returns:
the value of logging property

getLogWriter

public java.io.PrintWriter getLogWriter()
Specified by:
getLogWriter in interface javax.sql.DataSource

setLogWriter

public void setLogWriter(java.io.PrintWriter out)
Specified by:
setLogWriter in interface javax.sql.DataSource

getLoginTimeout

public int getLoginTimeout()
Returns the timeout for login.

Specified by:
getLoginTimeout in interface javax.sql.DataSource
Returns:
the login timeout. If not set the value is 0.

setLoginTimeout

public void setLoginTimeout(int seconds)
Set the login timeout for the connection. This timeout is also the default query timeout for all statements.

Specified by:
setLoginTimeout in interface javax.sql.DataSource
Parameters:
seconds - The login timeout for the connection.

setImpltran

public void setImpltran(boolean impltran)
Set the implicit transaction mode. If the value is true then the method setTransactionIsolation() will call setAutoCommit( false ) implicitly and start a transaction.

Parameters:
impltran - the implicit transaction mode
See Also:
getImpltran()

getImpltran

public boolean getImpltran()
Get the implicit transaction mode of the driver.

Returns:
the implicit transaction mode
See Also:
setImpltran(boolean)

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
Set any property of the DataSource without LoginTimeout and LogWriter.

Parameters:
name - The name of the property.
value - The value of the property.
See Also:
getProperty(String), getProperties()

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Set any property of the DataSource without LoginTimeout and LogWriter. This method was used from WebLogic Server

Parameters:
name - The name of the property.
value - The value of the property.
See Also:
getProperty(String), getProperties()

getProperty

public java.lang.String getProperty(java.lang.String name)
Get any property of the DataSource without LoginTimeout and LogWriter.

Parameters:
name - The name of the property.
Returns:
value The value of the property.
See Also:
setProperty(String,String), getProperties()

setProperties

public void setProperties(java.util.Properties properties)
Set all properties of the DataSource without LoginTimeout and LogWriter.

Parameters:
properties - All properties of the DataSource without LoginTimeout and LogWriter.
See Also:
getProperty(String), getProperties()

getProperties

public java.util.Properties getProperties()
Get all properties of the DataSource without LoginTimeout and LogWriter.

Returns:
value The value of the property.
See Also:
setProperty(String,String), getProperty(String)

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Create a new object of the same class like this DataSource.

Returns:
a clone of this instance.
Throws:
java.lang.CloneNotSupportedException

equals

public boolean equals(java.lang.Object obj)
Compare this DataSource to the specified object. The result is true if and only if the argument is not null and is a SybDataSource object that has the same significant properties.

Parameters:
obj - the object to compare.

getReference

public javax.naming.Reference getReference()
                                    throws javax.naming.NamingException
Retrieves the Reference of this SybDataSource object.

Specified by:
getReference in interface javax.naming.Referenceable
Returns:
The non-null Reference of this object.
Throws:
javax.naming.NamingException - If a naming exception was encountered while retrieving the reference

toString

public java.lang.String toString()

i-net JDBC drivers for Sybase


copyright by i-net software