com.caucho.db.jdbc
Class DataSourceImpl

java.lang.Object
  extended by com.caucho.db.jdbc.DataSourceImpl
All Implemented Interfaces:
java.sql.Wrapper, javax.sql.CommonDataSource, javax.sql.DataSource

public class DataSourceImpl
extends java.lang.Object
implements javax.sql.DataSource

Non-pooled data source.


Constructor Summary
DataSourceImpl()
          Creates a new data source
DataSourceImpl(Path path)
          Creates a new data source
 
Method Summary
 void close()
           
protected  void finalize()
           
 java.sql.Connection getConnection()
          Driver interface to create a new connection.
 java.sql.Connection getConnection(java.lang.String user, java.lang.String password)
          Driver interface to create a new connection.
 int getLoginTimeout()
           
 java.io.PrintWriter getLogWriter()
           
 void init()
          Initialize the data source.
 boolean isWrapperFor(java.lang.Class<?> iface)
           
 void setCreateDatabase(boolean create)
          If true, creates the database on init.
 void setFlushDirtyBlocksOnCommit(boolean isFlush)
           
 void setLoginTimeout(int foo)
           
 void setLogWriter(java.io.PrintWriter log)
           
 void setPath(Path path)
          Sets the path to the database.
 void setRemoveOnError(boolean remove)
          If true, removes bad tables on init.
 java.lang.String toString()
           
<T> T
unwrap(java.lang.Class<T> iface)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataSourceImpl

public DataSourceImpl()
Creates a new data source


DataSourceImpl

public DataSourceImpl(Path path)
               throws java.sql.SQLException
Creates a new data source

Throws:
java.sql.SQLException
Method Detail

setPath

public void setPath(Path path)
Sets the path to the database.


setCreateDatabase

public void setCreateDatabase(boolean create)
If true, creates the database on init.


setRemoveOnError

public void setRemoveOnError(boolean remove)
If true, removes bad tables on init.


setFlushDirtyBlocksOnCommit

public void setFlushDirtyBlocksOnCommit(boolean isFlush)

init

public void init()
          throws java.sql.SQLException
Initialize the data source.

Throws:
java.sql.SQLException

getLoginTimeout

public int getLoginTimeout()
Specified by:
getLoginTimeout in interface javax.sql.CommonDataSource

setLoginTimeout

public void setLoginTimeout(int foo)
Specified by:
setLoginTimeout in interface javax.sql.CommonDataSource

getLogWriter

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

setLogWriter

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

getConnection

public java.sql.Connection getConnection(java.lang.String user,
                                         java.lang.String password)
                                  throws java.sql.SQLException
Driver interface to create a new connection.

Specified by:
getConnection in interface javax.sql.DataSource
Throws:
java.sql.SQLException

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Driver interface to create a new connection.

Specified by:
getConnection in interface javax.sql.DataSource
Throws:
java.sql.SQLException

close

public void close()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

unwrap

public <T> T unwrap(java.lang.Class<T> iface)
         throws java.sql.SQLException
Specified by:
unwrap in interface java.sql.Wrapper
Throws:
java.sql.SQLException

isWrapperFor

public boolean isWrapperFor(java.lang.Class<?> iface)
                     throws java.sql.SQLException
Specified by:
isWrapperFor in interface java.sql.Wrapper
Throws:
java.sql.SQLException