Package org.hsqldb.sample
Class SqlFileEmbedder
- java.lang.Object
-
- org.hsqldb.sample.SqlFileEmbedder
-
public class SqlFileEmbedder extends java.lang.ObjectSample 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 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 Description voidexecuteFiles(java.lang.String[] fileStrings)Your own classes can use this method to execute SQL files.java.sql.ConnectiongetConn()For applications that use a persistent JDBC connection, this class can be used to encapsulate that connection.static voidmain(java.lang.String[] sa)Run
-
-
-
Constructor Detail
-
SqlFileEmbedder
public SqlFileEmbedder(java.io.File rcFile, java.lang.String urlid) throws java.lang.ExceptionInstantiates 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- Fileurlid- 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.ExceptionRunjava 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.SQLExceptionYour 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 problemsorg.hsqldb.cmdline.SqlToolError- on SQL Tool problemsjava.sql.SQLException- on SQL problems- See Also:
main(String[])
-
-