Class Hierarchy Previous Next Index
Class COM.cloudscape.util.DBClassLoad
java.lang.Object
|
+----COM.cloudscape.util.DBClassLoad
- public class DBClassLoad
- extends java.lang.Object
Copyright © 1998-2000, Informix Software, Inc. All rights reserved.
Utility methods that allow application code to be stored in a database,
and/or allow access to classes loaded from cloudscape.database.classpath.
Similar to java.rmi.server.RMIClassLoader
- See Also:
- java.rmi.server.RMIClassLoader
invokeMain(Connection, String, String[])
- Invoke the main method of a class stored in a database, using the passed
in java.sql.Connection to connect to the database.
invokeRun(Connection, String)
- Create an instance of a class stored in a database that implements Runnable
and invoke its run method, using the passed
in java.sql.Connection to connect to the database.
loadClass(Connection, String)
- Load a class from a Cloudscape system using a connection to that system.
main(String[])
- Invoke the main method of a class stored in a Cloudscape database.
main
public static void main(java.lang.String args[]) throws java.sql.SQLException, java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.Throwable
Invoke the main method of a class stored in a Cloudscape database.
The first argument
is a JDBC database connection URL to the Cloudscape database system that contains the class.
It can be any database in the Cloudscape system, it need not be the
databse that contains the jar that contains the class.
The second argument is the name of the class that contains the main()
method to be run. This is the class that you normally use on the command line.
The remaining arguments are passed to the main() method.
java COM.cloudscape.util.DBClassLoad jdbc_url main_class_name [args ...]
replaces
java main_class_name [args ...]
e.g.
java COM.cloudscape.util.DBClassLoad jdbc:cloudscape:photsdb COM.acme.DisplayImage BayBridge.gif
instead of
java COM.acme.DisplayImage BayBridge.gif
Invoking this method results in these steps:
- Booting the JDBC driver (and thus Cloudscape) associated with the JDBC URL
- Connecting to the database using the JDBC URL
- Loading the class within Cloudscape
- Closing the connection
- Invoking the main method outside of Cloudscape
Note that this method will work and behave normally even if the main class is
loaded from the local classes by Cloudscape and not from cloudscape.database.classpath
- Throws:
- java.sql.SQLException - Error connecting to the database, or thrown during execution of main method
- java.lang.ClassNotFoundException - Error loading the associated JDBC driver, or thrown during execution of main method
- java.lang.InstantiationException - Error loading the associated JDBC driver, or thrown during execution of main method
- java.lang.NoSuchMethodException - No main method exists in the class, or thrown during execution of main method
- java.lang.IllegalAccessException - The main method is not public, or thrown during execution of main method
- java.lang.IllegalArgumentException - Thrown during execution of main method
- java.lang.Throwable - Thrown during execution of main method
invokeMain
public static void invokeMain(java.sql.Connection conn,
java.lang.String mainClassName,
java.lang.String args[]) throws java.sql.SQLException, java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.Throwable
Invoke the main method of a class stored in a database, using the passed
in java.sql.Connection to connect to the database. The connection
can be to any database in the Cloudscape system, it need not be the
database that contains the jar that contains the class.
Invoking this method results in these steps:
- Loading the class within Cloudscape
- Invoking the main method outside of Cloudscape.
Note that this method will work and behave normally even if the main class is
loaded from the local classes by Cloudscape and not from cloudscape.database.classpath
- Throws:
- java.sql.SQLException - Error connecting to the database, or thrown during execution of main method
- java.lang.NoSuchMethodException - No main method exists in the class, or thrown during execution of main method
- java.lang.IllegalAccessException - The main method is not public, or thrown during execution of main method
- java.lang.IllegalArgumentException - Thrown during execution of main method
- java.lang.Throwable - Thrown during execution of main method
invokeRun
public static void invokeRun(java.sql.Connection conn,
java.lang.String runnableClassName) throws java.sql.SQLException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassCastException
Create an instance of a class stored in a database that implements Runnable
and invoke its run method, using the passed
in java.sql.Connection to connect to the database. The connection
can be to any database in the Cloudscape system, it need not be the
database that contains the jar that contains the class.
The class must have a public no-arg constructor.
Invoking this method results in these steps:
- Loading the class within Cloudscape
- Creating an instance of the class outside of Cloudscape.
- Invoking the run method of this object outside of Cloudscape.
Note that this method will work and behave normally even if the class is
loaded from the local classes by Cloudscape and not from cloudscape.database.classpath
- Throws:
- java.sql.SQLException - Error connecting to the database, or thrown during execution of run method
- java.lang.InstantiationException - An error was thrown while creating an instance of the class
- java.lang.IllegalAccessException - The no-arg constructor is not public
- java.lang.ClassCastException - The class does not implement java.lang.Runnable
- See Also:
- java.lang.Runnable
loadClass
public static java.lang.Class loadClass(java.sql.Connection conn,
java.lang.String className) throws java.sql.SQLException
Load a class from a Cloudscape system using a connection to that system. The connection
can be to any database in the Cloudscape system, it need not be the
database that contains the jar that contains the class.
- Throws:
- java.sql.SQLException - Error connecting to the database or class does not exist.
Class Hierarchy Previous Next Index