Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

de.danet.an.installdb
Class InstallDB  view InstallDB download InstallDB.java

java.lang.Object
  extended byde.danet.an.installdb.InstallDB

public class InstallDB
extends java.lang.Object

This class create a database and can called with three parameters:

java -jar installdb [-v] [-convert <database type>] [<install script> [resource script]]

-v - the SQL statements should be printet on standard out.
-convert - the database type as driver class name(org.hsqldb.jdbcDriver, oracle.jdbc.driver.OracleDriver, ...). It is used for searching a property file with the convert rules of the standard SQL datatypes to the specific datatypes of the vendor-specific database.
install script - contains the path and file name to the file with sql database creating commands.
resource script - contains the path and file name to the file with sql commands creating resources.

Without the install script InstallDB will use the default create script create.sql using the class path.

Following parameters must be set in the jdbc.properties file:
drive - jdbc diver
database - url to the database
user - name of the user
password - the user password


Constructor Summary
InstallDB()
           
 
Method Summary
private  java.sql.Connection connectDatabase()
          This method return the database connection.
private  java.lang.String convertSQLStatement(java.lang.String databaseType, java.lang.String text)
          This method replace the standard SQL datatypes with the special datatypes of the using database.
private  void installDatabase(java.lang.String text, java.sql.Connection con, boolean listToken)
          This method replace the standard SQL datatypes with the special datatypes of the using database.
private  java.io.BufferedReader loadCreateScript(java.lang.String script_file, boolean listToken)
          This method return the BufferedReader to the create script.
private  java.io.BufferedReader loadResourceScript(java.lang.String resource_file, java.lang.String script_file, boolean listToken)
          This method return the BufferedReader to the resource script.
static void main(java.lang.String[] args)
           
private  java.lang.String readFiles(java.io.BufferedReader brc, java.io.BufferedReader brr)
          This method reads the create and resource script.
private  void run(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstallDB

public InstallDB()
Method Detail

main

public static void main(java.lang.String[] args)

run

private void run(java.lang.String[] args)
          throws java.lang.Exception

readFiles

private java.lang.String readFiles(java.io.BufferedReader brc,
                                   java.io.BufferedReader brr)
                            throws java.lang.Exception
This method reads the create and resource script.


loadCreateScript

private java.io.BufferedReader loadCreateScript(java.lang.String script_file,
                                                boolean listToken)
This method return the BufferedReader to the create script.


loadResourceScript

private java.io.BufferedReader loadResourceScript(java.lang.String resource_file,
                                                  java.lang.String script_file,
                                                  boolean listToken)
This method return the BufferedReader to the resource script.


connectDatabase

private java.sql.Connection connectDatabase()
This method return the database connection.


convertSQLStatement

private java.lang.String convertSQLStatement(java.lang.String databaseType,
                                             java.lang.String text)
This method replace the standard SQL datatypes with the special datatypes of the using database.


installDatabase

private void installDatabase(java.lang.String text,
                             java.sql.Connection con,
                             boolean listToken)
                      throws java.sql.SQLException
This method replace the standard SQL datatypes with the special datatypes of the using database.