org.hsqldb.sample

## Class SqlFileEmbedder

- java.lang.Object
- - org.hsqldb.sample.SqlFileEmbedder

-     public class SqlFileEmbedder
      extends java.lang.Object

  Sample class which executes SQL files, by embedding SqlFile.

  Suitable for using as a template.

  This class also serves as an example of using RCData to allow your application users to store JDBC access information in a convenient text file.

  Author:
    Blaine Simpson (blaine dot simpson at admc dot com)
  See Also:
    `main(String[])`, `SqlFile`, `RCData`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SqlFileEmbedder(java.io.File rcFile, java.lang.String urlid)` Instantiates SqlFileEmbedder object and connects to specified database.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `executeFiles(java.lang.String[] fileStrings)` Your own classes can use this method to execute SQL files.
    `java.sql.Connection` | `getConn()` For applications that use a persistent JDBC connection, this class can be used to encapsulate that connection.
    `static void` | `main(java.lang.String[] sa)` Run

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SqlFileEmbedder

          public SqlFileEmbedder(java.io.File rcFile,
                                 java.lang.String urlid)
                          throws java.lang.Exception

      Instantiates SqlFileEmbedder object and connects to specified database.

      N.b., you do not need to use RCData to use SqlFile. All SqlFile needs is a live Connection. I'm using RCData because it is a convenient way for a non-contained app (i.e. one that doesn't run in a 3rd party container) to get a Connection.

      Parameters:
        `rcFile` - File
        `urlid` - String
      Throws:
        `java.lang.Exception` - on any problem

  - ### Method Detail

    - #### getConn

          public java.sql.Connection getConn()

      For applications that use a persistent JDBC connection, this class can be used to encapsulate that connection. (Just strip out the SqlFile stuff if you don't need that).
      Returns:
        The encapsulated JDBC Connection.

    - #### main

          public static void main(java.lang.String[] sa)
                           throws java.lang.Exception

      Run

           java SqlFileEmbedder

      to see Syntax message.
      Parameters:
        `sa` - String[]
      Throws:
        `java.lang.Exception` - on any problem

    - #### executeFiles

          public void executeFiles(java.lang.String[] fileStrings)
                            throws java.io.IOException,
                                   org.hsqldb.cmdline.SqlToolError,
                                   java.sql.SQLException

      Your own classes can use this method to execute SQL files.

      See source code for the main(String[]) method for an example of calling this method.

      Parameters:
        `fileStrings` - String[]
      Throws:
        `java.io.IOException` - on io problems
        `org.hsqldb.cmdline.SqlToolError` - on SQL Tool problems
        `java.sql.SQLException` - on SQL problems
      See Also:
        `main(String[])`

Copyright © 2001 - 2018 HSQL Development Group.