de.suse.lib.sqlmap.drivers
Class GenericDriver

java.lang.Object
  extended by de.suse.lib.sqlmap.drivers.GenericDriver
All Implemented Interfaces:
DBConnectionDriver
Direct Known Subclasses:
ApacheDerbyEmbeddedDriver, H2EmbeddedDriver, H2EmbeddedServerDriver, PgSQLDriver

public abstract class GenericDriver
extends java.lang.Object
implements DBConnectionDriver

Base driver operator.


Field Summary
protected  ConnectionCallback callback
           
protected  java.sql.Connection connection
           
 
Constructor Summary
GenericDriver(java.sql.Connection conn)
          Create connection directly from already opened connection.
GenericDriver(java.lang.String url)
          Create a connection from an URL.
 
Method Summary
 void close()
           
 GenericDriver connect(java.lang.String user, java.lang.String password)
          Connect to the database.
 java.sql.Connection getConnection()
           
protected  java.lang.String getDatabase()
           
protected  java.lang.String getHost()
           
protected  java.lang.String getPort()
           
protected  java.lang.String getUrl()
           
 boolean isConnected()
          Check if driver is connected at the moment.
protected  void parseURL()
          Parse URL for connect.
 void setConnectionCallback(ConnectionCallback callback)
           
protected  void setDatabase(java.lang.String database)
           
protected  void setHost(java.lang.String host)
           
protected  void setPort(java.lang.String port)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connection

protected java.sql.Connection connection

callback

protected ConnectionCallback callback
Constructor Detail

GenericDriver

public GenericDriver(java.sql.Connection conn)
Create connection directly from already opened connection.

Parameters:
conn -

GenericDriver

public GenericDriver(java.lang.String url)
              throws java.net.URISyntaxException,
                     java.sql.SQLException,
                     java.lang.Exception
Create a connection from an URL.

Parameters:
url -
Throws:
java.net.URISyntaxException
java.sql.SQLException
java.lang.Exception
Method Detail

parseURL

protected void parseURL()
                 throws java.sql.SQLException
Parse URL for connect.

Throws:
java.sql.SQLException

connect

public GenericDriver connect(java.lang.String user,
                             java.lang.String password)
                      throws java.lang.Exception
Connect to the database.

Specified by:
connect in interface DBConnectionDriver
Returns:
Throws:
java.lang.Exception

isConnected

public boolean isConnected()
Check if driver is connected at the moment.

Specified by:
isConnected in interface DBConnectionDriver
Returns:

getDatabase

protected java.lang.String getDatabase()

setDatabase

protected void setDatabase(java.lang.String database)

getHost

protected java.lang.String getHost()

setHost

protected void setHost(java.lang.String host)

getPort

protected java.lang.String getPort()

setPort

protected void setPort(java.lang.String port)

getUrl

protected java.lang.String getUrl()

close

public void close()
Specified by:
close in interface DBConnectionDriver

getConnection

public java.sql.Connection getConnection()
Specified by:
getConnection in interface DBConnectionDriver

setConnectionCallback

public void setConnectionCallback(ConnectionCallback callback)
Specified by:
setConnectionCallback in interface DBConnectionDriver