javatools.sql
Class ScriptExecutor

java.lang.Object
  |
  +--javatools.sql.ScriptExecutor

public class ScriptExecutor
extends java.lang.Object

It's an abstract class for use in executing a script for a DBMS.


Constructor Summary
ScriptExecutor()
          Creates new ScriptExecutor
 
Method Summary
 void execScript()
          Executes the loaded script.
 void execScript(java.lang.String scriptFileName)
          Loads and executes a specified script file.
 DbDatabase getDatabase()
          Returns a reference to the DbDatabase object used.
 java.lang.String getDBMS()
          Returns the name of the DBMS used.
 java.lang.String getPassword()
          Returns the password used for connection.
 java.lang.String getUserName()
          Returns the username.
 void loadScript(java.lang.String scriptFileName)
          Loads the script to be executed.
 void setAccess(java.lang.String user, java.lang.String pass)
          Sets access information for communication with DBMS.
 void setDatabase(DbManager manager, java.lang.String name, java.lang.String driver, java.lang.String connectString, java.lang.String userName, java.lang.String password)
          Sets the database to use.
 void setDBMS(java.lang.String dbmsName)
          Sets the name of the DBMS to be used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptExecutor

public ScriptExecutor()
Creates new ScriptExecutor

Method Detail

setDBMS

public void setDBMS(java.lang.String dbmsName)
Sets the name of the DBMS to be used. Not implemented yet!

Parameters:
dbmsName - The name of DBMS to be used.

getDBMS

public java.lang.String getDBMS()
Returns the name of the DBMS used. Not implemented yet!

Returns:
The name of the DBMS used.

setDatabase

public void setDatabase(DbManager manager,
                        java.lang.String name,
                        java.lang.String driver,
                        java.lang.String connectString,
                        java.lang.String userName,
                        java.lang.String password)
Sets the database to use.

Parameters:
manager - The DbManager to use for getting properties.
name - Name of DBMS.
driver - Name of JDBC driver class.
connectString - Connection string to the database.
userName - User name to connect to DBMS. It must not be included into connectString!
password - Password to connect to DBMS. It must not be included into connectString!

getDatabase

public DbDatabase getDatabase()
                       throws DbException
Returns a reference to the DbDatabase object used.

Returns:
The reference to DbDatabase object used
Throws:
DbException - If DbDatabase object is null.

loadScript

public void loadScript(java.lang.String scriptFileName)
                throws java.io.FileNotFoundException
Loads the script to be executed.

Parameters:
scriptFileName - Path to the file to be loaded.
Throws:
java.io.FileNotFoundException - If the file is not found.

execScript

public void execScript()
                throws DbException
Executes the loaded script.

Throws:
DbException - If the execution caused a fault.

execScript

public void execScript(java.lang.String scriptFileName)
                throws java.io.FileNotFoundException,
                       DbException
Loads and executes a specified script file.

Parameters:
scriptFileName - Path to the file to be executed.
Throws:
DbException - If the execution caused a fault.
java.io.FileNotFoundException - If the file is not found.

setAccess

public void setAccess(java.lang.String user,
                      java.lang.String pass)
Sets access information for communication with DBMS. Not implemented yet!

Parameters:
user - Username. You can use an empty string if you want to use no username.
pass - Password.

getUserName

public java.lang.String getUserName()
Returns the username. Not implemented yet!

Returns:
Username used. It's empty if no username is specified.

getPassword

public java.lang.String getPassword()
Returns the password used for connection. Not implemented yet!

Returns:
Password used. It's empty if no username is specified.