org.hsqldb.sample
Class SqlFileEmbedder

java.lang.Object
  extended by 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
SqlFileEmbedder(File rcFile, String urlid)
          Instantiates SqlFileEmbedder object and connects to specified database.
 
Method Summary
 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.

Throws:
Exception
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.

Throws:
Exception

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.

Throws:
IOException
org.hsqldb.cmdline.SqlToolError
SQLException
See Also:
main(String[])


Copyright © 2001 - 2010 HSQL Development Group.