DBA > Job Interview Questions > DERBY Java Database FAQs

How to enable database class loading with a prop

More DBA job interview questions and answers at http://dba.fyicenter.com/Interview-Questions/

(Continued from previous question...)

How to enable database class loading with a property?

Once you have added one or more jar files to a database, you must set the database jar "class path" by including the jar file or files in the derby.database.classpath property to enable Derby to load classes from the jar files. This property, which behaves like a class path, specifies the jar files to be searched for classes and resources and the order in which they are searched. If Derby does not find a needed class stored in the database, it can retrieve the class from the user's class path. (Derby first looks in the user's class path before looking in the database.)

* Separate jar files with a colon (:).
* Use two-part names for the jar files (schema name and jar name). Set the property as a database-level property for the database. The first time you set the property, you must reboot to load the classes.

Example:
CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY(
'derby.database.classpath',
'APP.ToursLogic:APP.ACCOUNTINGLOGIC')

Note:
Derby's class loader looks first in the user's class path for any needed classes, and then in the database. To ensure class loading with the database class loader, remove classes from the class path.

(Continued on next question...)

Other Job Interview Questions