SqlFileEmbedder (HSQLDB 2.4.0 API)
Date: 2017-04-09

org.hsqldb.sample

## Class SqlFileEmbedder

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

-     public class SqlFileEmbedder
      extends 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(File rcFile, 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(String[] fileStrings)` Your own classes can use this method to execute SQL files.
    `Connection` | `getConn()` For applications that use a persistent JDBC connection, this class can be used to encapsulate that connection.
    `static void` | `main(String[] sa)` Run

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

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

- - ### Constructor Detail

    - #### SqlFileEmbedder

          public SqlFileEmbedder(File rcFile,
                                 String urlid)
                          throws 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:
        `Exception` - on any problem

  - ### Method Detail

    - #### getConn

          public 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(String[] sa)
                           throws Exception

      Run

           java SqlFileEmbedder

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

    - #### executeFiles

          public void executeFiles(String[] fileStrings)
                            throws IOException,
                                   org.hsqldb.cmdline.SqlToolError,
                                   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:
        `IOException` - on io problems
        `org.hsqldb.cmdline.SqlToolError` - on SQL Tool problems
        `SQLException` - on SQL problems
      See Also:
        `main(String[])`

Copyright © 2001 - 2017 HSQL Development Group.