i-net JDBC drivers for Oracle Server

com.inet.ora
Class OraDataSource

java.lang.Object
  extended bycom.inet.ora.OraDriver
      extended bycom.inet.ora.OraDataSource
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 OraDataSource
extends com.inet.ora.OraDriver
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 SEROPTO(tm) and i-net ORANXO(tm).

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.inet.ora.OraDriver
CURSOR
 
Constructor Summary
OraDataSource()
          Attempt to create a Datasource.
OraDataSource(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 getAlterSession()
          Return if the driver alters the session.
 java.lang.String getCaseSensitive()
          Return if the driver treats columns case sensitive.
 java.lang.String getColumnsCaseSensitive()
          Deprecated. Use getCaseSensitive
 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 getDedicated()
          Return if the connection should be dedicated.
 java.lang.String getDescription()
          Return a one line description of the DataSource.
 boolean getFailover()
          Returns if failover is enabled.
 java.lang.String getHost1()
          Returns the host name of the first failover node.
 java.lang.String getIgnoreScale()
          Return if getObject() and getBigDecimal(x) should ignore the scale of the column definition.
 java.lang.String getInitSQL()
          Get the value of initSQL.
 boolean getLoadbalance()
          Returns if failover is enabled.
 java.lang.String getLogging()
          Returns if the driver prints logging to System.out.
 int getLoginTimeout()
          Returns the timeout for login.
 java.lang.String getLogonMode()
          Return the logon mode for the sys account.
 java.io.PrintWriter getLogWriter()
           
 java.lang.String getMapNumbers()
          Return if getObject() on numbers returns always a Bigdecimal.
 int getOpencursors()
          Returns the maximum number of open cursors.
 java.lang.String getPassword()
          Return the password for the connection.
 java.lang.String getPort()
          Return the TCP/IP port number of the Oracle Server.
 java.lang.String getPort1()
          Returns the port value of the first failover node.
 int getPortNumber()
          Return the TCP/IP port number of the Oracle Server.
 java.lang.String getProgramName()
          Return the program name for a session.
 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.
 java.lang.String getProtocol()
          Get the protocol type.
 int getQueryTimeout()
          Returns the timeout for queries.
 javax.naming.Reference getReference()
           
 java.lang.String getReportUnsupportedMethods()
          Returns if the driver throws exceptions on unsupported methods.
 java.lang.String getSduSize()
          Return the sduSize for the connection.
 java.lang.String getServerName()
          Return the host name of the Oracle Server.
 java.lang.String getServiceName()
          Return the network servicename of a database.
 java.lang.String getSid()
          Return the insance name of the database.
 java.lang.String getStreamstolob()
          Return the value of the property streamstolob.
 java.lang.String getTables()
          Return if the driver uses temporary tables for scrollable resultsets.
 java.lang.String getTimestampToDate()
          Return the value of the property timestampToDate.
 java.lang.String getTraceLevel()
          Deprecated.  
 java.lang.String getTracePackets()
          Returns if the driver prints out a packet dump.
 java.lang.String getTraceToSysStream()
          Deprecated.  
 java.lang.String getUser()
          Return the user for the connection.
 void setAlterSession(java.lang.String session)
          Set if the driver should alter the session depending on the clients locale.
 void setCaseSensitive(java.lang.String sensitive)
          Set if the driver should treats columns case sensitive.
 void setColumnsCaseSensitive(java.lang.String sensitive)
          Deprecated. Use setCaseSensitive
 void setDedicated(java.lang.String dedicated)
          Set if the connection should be dedicated.
 void setDescription(java.lang.String description)
          Set the description of the DataSource.
 void setFailover(boolean failover)
          Sets if the driver should use the failover mechanism.
 void setHost1(java.lang.String host1)
          Set the host name for the first failover node.
 void setIgnoreScale(java.lang.String ignoreScale)
          Set if the driver should ignore the scale of the column definition.
 void setInitSQL(java.lang.String initSQL)
          Set a SQL expression to init the connection.
 void setLoadbalance(boolean loadbalance)
          Sets if the driver should use the failover mechanism.
 void setLogging(java.lang.String logging)
          Enable the logging of the driver to System.out.
 void setLoginTimeout(int seconds)
          Set the login timeout for the connection.
 void setLogonMode(java.lang.String mode)
          Set the logon mode for the sys account.
 void setLogWriter(java.io.PrintWriter out)
           
 void setMapNumbers(java.lang.String map)
          Set if the driver should always return a BigDecimal on number columns.
 void setOpencursors(int number)
          Set the maximum size of open cursors for ResultSets.
 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 Oracle Server.
 void setPort1(java.lang.String port1)
          Set the port value for the first failover node.
 void setPortNumber(int portNumber)
          Set TCP/IP port number of the Oracle Server.
 void setProgramName(java.lang.String name)
          Set the program name for the session.
 void setProperties(java.util.Properties properties)
          Set all properties of the DataSource without LoginTimeout and LogWriter.
 void setProperty(java.lang.String keyValuePair)
          Set any property of the datasource.
 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 setProtocol(java.lang.String protocol)
          Set the protocol type.
 void setQueryTimeout(int seconds)
          Set the query timeout for statements.
 void setReportUnsupportedMethods(java.lang.String report)
          Set the drivers behaviour on unsupported exceptions.
 void setSduSize(int size)
          Set the sduSize for the connection.
 void setSduSize(java.lang.String size)
          Set the sduSize for the connection.
 void setServerName(java.lang.String hostName)
          Set the host name of the Oracle Server.
 void setServiceName(java.lang.String serviceName)
          Set the network servicename of a database.
 void setSid(java.lang.String sid)
          Set the insance name of the database.
 void setStreamstolob(java.lang.String streamstolob)
          Set if the driver should handle streams as BLOB / CLOB.
 void setTables(java.lang.String table)
          Set if the driver should use temporary tables for scrollable resultsets.
 void setTimestampToDate(java.lang.String timestampToDate)
          Set if the driver should handle parameters of type java.sql.Timestamp as Oracle data type DATE.
 void setTraceLevel(int level)
          Deprecated.  
 void setTraceLevel(java.lang.String level)
          Deprecated.  
 void setTracePackets(java.lang.String packet)
          Sets if the driver should dump out packets.
 void setTraceToSysStream(java.lang.String trace)
          Deprecated.  
 void setUser(java.lang.String user)
          Set the user account for the connection.
 java.lang.String toString()
           
 
Methods inherited from class com.inet.ora.OraDriver
acceptsURL, connect, getMajorVersion, getMinorVersion, getPropertyInfo, jdbcCompliant, run
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OraDataSource

public OraDataSource()
Attempt to create a Datasource.


OraDataSource

public OraDataSource(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 host name of the Oracle Server.

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

setServerName

public void setServerName(java.lang.String hostName)
Set the host name of the Oracle Server.

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

getServiceName

public java.lang.String getServiceName()
Return the network servicename of a database.

Returns:
the service name. If not set the value is null.

setServiceName

public void setServiceName(java.lang.String serviceName)
Set the network servicename of a database.

Parameters:
serviceName - the service name of the Oracle server.

getSid

public java.lang.String getSid()
Return the insance name of the database.

Returns:
the service name. If not set the value is null.

setSid

public void setSid(java.lang.String sid)
Set the insance name of the database.

Parameters:
sid - the insance name of the 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.

getPortNumber

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

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

setPortNumber

public void setPortNumber(int portNumber)
Set TCP/IP port number of the Oracle Server. If not set the default value of 1521 will be used.

Parameters:
portNumber - the port number.

getPort

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

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

setPort

public void setPort(java.lang.String port)
Set TCP/IP port number of the Oracle Server. If not set the default value of 1521 will be used.

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. It must be the password of a Oracle Server login and not the password of a NT Account.

Parameters:
password - the password for the Oracle Server.

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. This account must be set. It must be a user name of a Oracle Server login and not the user name of a NT Account.

Parameters:
user - The user name for the Oracle Server.

getSduSize

public java.lang.String getSduSize()
Return the sduSize for the connection.

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

setSduSize

public void setSduSize(java.lang.String size)
Set the sduSize for the connection.

Parameters:
size - The sduSize of the connection

setSduSize

public void setSduSize(int size)
Set the sduSize for the connection.

Parameters:
size - The sduSize for the connection

getLogonMode

public java.lang.String getLogonMode()
Return the logon mode for the sys account.

Returns:
the logon mode. If not set the value is null.

setLogonMode

public void setLogonMode(java.lang.String mode)
Set the logon mode for the sys account.

Parameters:
mode - The logon mode.

getReportUnsupportedMethods

public java.lang.String getReportUnsupportedMethods()
Returns if the driver throws exceptions on unsupported methods.

Returns:
true if exceptions will thrown on unsupported methods.

setReportUnsupportedMethods

public void setReportUnsupportedMethods(java.lang.String report)
Set the drivers behaviour on unsupported exceptions.

Parameters:
report - true if the driver should throws exceptions on unsupported methods.

getTraceLevel

public java.lang.String getTraceLevel()
Deprecated.  

Return the tracelevel.

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

setTraceLevel

public void setTraceLevel(java.lang.String level)
Deprecated.  

Set the tracelevel.

Parameters:
level -

setTraceLevel

public void setTraceLevel(int level)
Deprecated.  

Set the tracelevel.

Parameters:
level -

getTraceToSysStream

public java.lang.String getTraceToSysStream()
Deprecated.  

Returns if the driver prints out log messages to System.out

Returns:
if the driver prints to System.out. If not set the value is null.

setTraceToSysStream

public void setTraceToSysStream(java.lang.String trace)
Deprecated.  

Sets if the driver should print log messages to System.out.

Parameters:
trace - true if the driver should print log messages to System.out.

getTracePackets

public java.lang.String getTracePackets()
Returns if the driver prints out a packet dump.

Returns:
if the driver prints out a packet dump. If not set the value is null.

setTracePackets

public void setTracePackets(java.lang.String packet)
Sets if the driver should dump out packets.

Parameters:
packet - true if the driver should dump out packets.

getProgramName

public java.lang.String getProgramName()
Return the program name for a session.

Returns:
program name. If not set the value is null.

setProgramName

public void setProgramName(java.lang.String name)
Set the program name for the session.

Parameters:
name - The program name.

getMapNumbers

public java.lang.String getMapNumbers()
Return if getObject() on numbers returns always a Bigdecimal.

Returns:
if the driver returns always a BigDecimal on number columns. If not set the value is null.

setMapNumbers

public void setMapNumbers(java.lang.String map)
Set if the driver should always return a BigDecimal on number columns.

Parameters:
map - true if the driver should always return a BigDecimal on numbers.

getIgnoreScale

public java.lang.String getIgnoreScale()
Return if getObject() and getBigDecimal(x) should ignore the scale of the column definition.

Returns:
if the driver ignore the scale of the column definition.

setIgnoreScale

public void setIgnoreScale(java.lang.String ignoreScale)
Set if the driver should ignore the scale of the column definition.

Parameters:
ignoreScale - true if the driver should ignore the scale.

getAlterSession

public java.lang.String getAlterSession()
Return if the driver alters the session.

Returns:
if the driver alters the session. If not set the value is null.

setAlterSession

public void setAlterSession(java.lang.String session)
Set if the driver should alter the session depending on the clients locale.

Parameters:
session - true if the driver should alter the session.

getDedicated

public java.lang.String getDedicated()
Return if the connection should be dedicated.

Returns:
if the connection is dedicated. If not set the value is null.

setDedicated

public void setDedicated(java.lang.String dedicated)
Set if the connection should be dedicated.

Parameters:
dedicated - true if the connection should be dedicated.

getTables

public java.lang.String getTables()
Return if the driver uses temporary tables for scrollable resultsets.

Returns:
if the driver use temporary tables. If not set the value is null.

setTables

public void setTables(java.lang.String table)
Set if the driver should use temporary tables for scrollable resultsets.

Parameters:
table - true if the driver should use temporary tables.

getColumnsCaseSensitive

public java.lang.String getColumnsCaseSensitive()
Deprecated. Use getCaseSensitive

Return if the driver treats columns case sensitive.

Returns:
if the driver treats columns and table case sensitive. If not set the value is null.
See Also:
getCaseSensitive()

setColumnsCaseSensitive

public void setColumnsCaseSensitive(java.lang.String sensitive)
Deprecated. Use setCaseSensitive

Set if the driver should treats columns case sensitive.

Parameters:
sensitive - true if the driver should treats columns and table case sensitive.
See Also:
setCaseSensitive(java.lang.String)

getCaseSensitive

public java.lang.String getCaseSensitive()
Return if the driver treats columns case sensitive.

Returns:
if the driver treats columns and table case sensitive. If not set the value is null.

setCaseSensitive

public void setCaseSensitive(java.lang.String sensitive)
Set if the driver should treats columns case sensitive.

Parameters:
sensitive - true if the driver should treats columns and table case sensitive.

getStreamstolob

public java.lang.String getStreamstolob()
Return the value of the property streamstolob.


setStreamstolob

public void setStreamstolob(java.lang.String streamstolob)
Set if the driver should handle streams as BLOB / CLOB. The default value is false.


getTimestampToDate

public java.lang.String getTimestampToDate()
Return the value of the property timestampToDate.


setTimestampToDate

public void setTimestampToDate(java.lang.String timestampToDate)
Set if the driver should handle parameters of type java.sql.Timestamp as Oracle data type DATE.


setInitSQL

public void setInitSQL(java.lang.String initSQL)
Set a SQL expression to init the connection. This expression is execute once per Connection. It is also execute on reconnect with failover.

Parameters:
initSQL - a valid SQL command
See Also:
getInitSQL()

getInitSQL

public java.lang.String getInitSQL()
Get the value of initSQL.

See Also:
setInitSQL(String)

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

getLogging

public java.lang.String getLogging()
Returns if the driver prints logging to System.out.


setLogging

public void setLogging(java.lang.String logging)
Enable the logging of the driver to System.out.

Parameters:
logging - true if the driver should print log messages to System.out.

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.

getQueryTimeout

public int getQueryTimeout()
Returns the timeout for queries.

Returns:
the query timeout. If not set the value is 0.

setQueryTimeout

public void setQueryTimeout(int seconds)
Set the query timeout for statements.

Parameters:
seconds - The query timeout for the connection.

setOpencursors

public void setOpencursors(int number)
Set the maximum size of open cursors for ResultSets. The value is only used if you have no access to the table v$parameter.

Parameters:
number - the maximum size of open cursors for ResultSets. The default value is 300.

getOpencursors

public int getOpencursors()
Returns the maximum number of open cursors.

Returns:
the maximum number of open cursors. If not set, the value is 300.

setFailover

public void setFailover(boolean failover)
Sets if the driver should use the failover mechanism.

Parameters:
failover - if set on "true", driver tries to connect to alternative hosts, if connecting failed.
See Also:
to set alternative connection nodes. See the manual.html for more information.

getFailover

public boolean getFailover()
Returns if failover is enabled.

Returns:
if failover is enabled.

setLoadbalance

public void setLoadbalance(boolean loadbalance)
Sets if the driver should use the failover mechanism.

Parameters:
loadbalance - if set on "true", driver tries to connect to alternative hosts, if connecting failed. The order of target hosts is randomly.
See Also:
to set alternative connection nodes. See the manual.html for more information.

getLoadbalance

public boolean getLoadbalance()
Returns if failover is enabled.

Returns:
if failover is enabled.

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()

setProperty

public void setProperty(java.lang.String keyValuePair)
Set any property of the datasource. The set String must have the following structure:
key=value
An example:
"user=scott"

Parameters:
keyValuePair - the property to be set

setHost1

public void setHost1(java.lang.String host1)
Set the host name for the first failover node. To configure more failover nodes, use the setProperty(String) method.

Parameters:
host1 - the host name of the first failover node.
See Also:
setFailover(boolean), setLoadbalance(boolean), setPort1(String)

getHost1

public java.lang.String getHost1()
Returns the host name of the first failover node.

Returns:
the host name of the first failover node.

setPort1

public void setPort1(java.lang.String port1)
Set the port value for the first failover node. To configure more failover nodes, use the setProperty(String) method.

Parameters:
port1 - the host name of the first failover node.
See Also:
setFailover(boolean), setLoadbalance(boolean), setPort1(String)

getPort1

public java.lang.String getPort1()
Returns the port value of the first failover node.

Returns:
the port value of the first failover node.

setProtocol

public void setProtocol(java.lang.String protocol)
Set the protocol type. Possible values are tcp and tcps.

Parameters:
protocol - the new protocol

getProtocol

public java.lang.String getProtocol()
Get the protocol type.

Returns:
the current value

setProperties

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

Parameters:
properties - The properties of the DataSource.
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 OraDataSource object that has the same significant properties.

Parameters:
obj - the object to compare.

getReference

public javax.naming.Reference getReference()
                                    throws javax.naming.NamingException
Specified by:
getReference in interface javax.naming.Referenceable
Throws:
javax.naming.NamingException

toString

public java.lang.String toString()

i-net JDBC drivers for Oracle Server


copyright by i-net software