JChem Class Library is a collection of Java classes, which provides the functionality of handling JChem structure tables in relational database management systems (RDBMS-s) for Java applications.
In order to develop applications using JChem Class Library the following software need to be installed:
Most servlet servers can also handle Java Server Pages (JSP) scripts that are HTML pages with embedded Java code running on the server. Moreover, separate JSP engines that can be connected to servlet servers are also available.
If you are going to develop an ASP application, then Microsoft's Internet Information Server is needed to be set up. ASP scripts can access JChem through a .
To let Java applications use the JChem Class Library, set classpath to include
<JChem home>/lib/jchem.jar. See the
jcman batch file or shell script in the
jchem/bin directory as examples for setting classpath. (See the warning to avoid problems.)
Then add your account info in
If you are developing a web application (running servlets and/or JSP), see the documentation of your servlet engine for details on setting classpath for servlets. (Click here for Tomcat instructions.)
The following table summarizes the technical details of JChem Base:
The system is built in Java
|Portable and high performance|
It uses JDBC technology to store and retrieve structures in relational databases.
|Java modules are supplied for chemical structure searching.|
|Structure input/update/display by the Marvin Java Applets and JavaBeans.||Convenient and interactive user interfaces for|
|Java application for table creation and SDF/Molfile/SMILES import/export.||Communication with other chemical applications.|
Please note that there are other possibilities for invoking substructure searching, which might better suit your demands.
Before starting the development of a system that uses JChem to access structure tables in RDBMS-s, run JChemManager to initialize the database for structure handling:
JChemPropertiestable automatically by invoking JChemManager the first time. This table stores information on the database and the structure tables.
See the documentation of JChemManager for more details.
To support drawing and displaying chemical structures in standalone, rich-client or Java Web Start applications, JChem is bundled with MarvinBeans.
Marvin applets are recommended for applying in the interface of chemical web applications. Development issues and examples of using these tools are available in the . However, you can also apply other chemical GUIs that import and export structure file formats recognized by JChem.
Java classes in JChem may use
java.sql.Connection class passed as a parameter to connect to a database.
Examples for opening a connection using
The driver can be defined as a built-in constant for the specified database server. See the DatabaseConstants class Example, if the database server is Oracle:
Cache identifiers are introduced in JChem 5.3.2 in order to better scale search and database performance and improve safe and efficient structure cache load. Caches - or more precisely, cache pools - are identified with a cache ID. All the caches get the same cache ID if they belong to the same cache pool. This way the cache ID identifies the cache pool or - what is equivalent to this - the JVM. By default all cache pools get a random cache ID (this ID can be modified in case of permanent caches - see #3 ).
In order to run a well performing search application, the cache ID must be registered before the first search. The registration process inserts a record into the cache registration database table (its default name is [JChemProperties table name]+"_CR", eg. JChemProperties_CR). If an application hasn't been registered before the first search is performed, it tries to register itself automatically but it may fail if the database connection is used in a transaction.
Before closing your application (quitting the JVM) please always unregister your cache!
There is only one exception to this rule: if your cache is permanently registered you may restart your application and simply set the previously registered cache ID (see #3 ). No re-registration is needed in this case.
The registration of a temporarily registered cache may be deleted automatically after 1 day of inactivity (that is, no searches have been initiated by the cache pool in the last day). After deletion, the cache should be registered again. The default cache registration is temporary.
Permanent cache registrations do not expire and can be unregistered only via the API (#4 , #5 ). Permanent registration needs a unique cache ID that can be set or can be given at registration (#2 , #3 ). Please use permanent registration only if your application is continuously running (e.g. server applications).
CacheRegistrationUtil is designed to handle registration process. For registration operations a connected ConnectionHandler (ch in the examples) is needed in almost every case - except when setting a permanent cache ID (see #3 ).
By default the registration will be temporary, using the default random cache ID. If a permanent cache ID (see #3) was set before, the registration will be permanent, using the given ID.
The last line has two effects:
a) Changes the default cache ID to
identifier as permanent cache ID.
The second line changes the default cache ID to
identifier and sets the cache registration type to permanent, so subsequent calls to
registerCache() (see #1) will register the cache as permanent!
Unregisters the current cache's cache ID.
Unregisters the given cache ID (temporary or permanent).
Structure tables used by JChem reside in databases of RDBMS-s. See the administration guide for more details on managing these tables.
To access a structure table, a JDBC connection has to be built between the application and database. The tables can be handled by
java.sql.Connectionobject, usually contained in a
cduser.structures). If you are unsure about the name, check the content of the
JChemPropertiestable in the database. Though structure tables can be manipulated without using JChem's classes, you must be careful not to harm the integrity of the database. Only custom data fields of jchem tables are allowed to be manipulated directly by SQL statements - otherwise the JChem API must be used.