Class SQLLoader

java.lang.Object
com.softwaremining.jcl.SQLLoader

public class SQLLoader extends Object
Used for executing SQL statements
usage
   java com.softwaremining.jcl.SQLLoader -file=filename.sql
 or 
   java com.softwaremining.jcl.SQLLoader SQL-Statement  [e.g. java com.softwaremining.jcl.SQLLoader DELETE * FROM TABLE-1
 
Notes
  • the system will pick up the database credentials from db.properties file
  • when using the file=filename.sql option, the system will look for file in class path (softwaremining.properties DATA_DIR is ignored)
  • when executing an SQL Select statement - the results will be writing to console (System.out.print) it is upto the JCL script to redirect to SYSPRNT or other files .
  • when using the file=filename.sql option, the file may contain several SQL statements, each separated by ";" e.g.
             SELECT * FROM TABLE-1;
             DELETE FROM TABLE-1;
             INSERT into table-1 (COLUMN1, COLUMN2) values ('A' , 'B') ;
             INSERT into table-1 (COLUMN1, COLUMN2) values ('C' , 'D') ;
       
  • unless db.properties has assigned auto-commit=true, the system "commits" after executing every SQL statement
  • Field Details

    • baseObject

      protected com.softwaremining.jcl.SQLLoader.ESQLTest baseObject
    • sqlProcessor

      protected ESQLProcessor sqlProcessor
  • Method Details

    • getInstance

      public static SQLLoader getInstance()
    • setDBUrl

      public void setDBUrl(String dbUri)
    • executeSQLStatement

      public void executeSQLStatement(String sql)
    • executeSQLFile

      public void executeSQLFile(String fileAndPathName)
    • main

      public static void main(String[] args)