ASP.NET Example Application

JChem Version 5.1.2

Purpose of the example
Functions of the application
Requirements
Setting up the example application
Using the example application

Purpose of the example

The ASP.NET example demonstrates

model

Functions of the application

The example application allows you to do the following:

Inserting a new structure into the database

model


Specifying the criteria for structure search

model


Requirements

In addition to the tools mentioned in the Developers' Guide, you also need a database server with both ODBC and JDBC capability. The ASP.NET sample JChem application has been extensively tested with Microsoft SQL Server, but it should work with most of the well known database servers (Oracle, DB2, MySql) as well. Depending on the ODBC specific features of the database, you may need to apply minor changes to the routines involving ODBC handling in the sample ASP.NET application.


Setting up the example application

  1. Install the required Java Tools
  2. Create a JChem structure table to hold the test structures
  3. Populate the structure table (optional)
  4. Make sure that Internet Information Server is set up correctly
  5. Create a web application for JChem in Internet Information Server
  6. Configure the JChem ASP.NET application
  7. Copy the required DDLs
  8. Build the assembly supporting the JChem ASP.NET application


  1. Install the required Java Tools

    Install the Java Runtime Environment (JRE) and the JNBridge runtime if you have not done so yet.
  2. Create a JChem structure table to hold the test structures

    The example can be used with a JChem structure table (created by JChemManager or via the JChem Java API). In addition to the standard JChem table columns (cd_...), the following columns must be present:

    1. name of type VARCHAR
    2. stock of type NUMERIC
    3. comments of type VARCHAR

    Note that the word comments is reserved in many database servers, so you may have to enclose it in double quotes in SQL statements. Use the INTEGER datatype for the stock column when using Microsoft SQL Server.

  3. Populate the structure table (optional)

    You can test the JChem ASP.NET application with an empty JChem structure table containing the extra columns described above: use the insert function of the application to add structures in the table.

    If you wish to test with a large dataset (for example to test speed and stability), you can either

    In either case, you can import the test data using JChemManager. After importing the data, you may want to generate values for the user defined columns (name, stock and comments), but this is not strictly necessary.


  4. Make sure that Internet Information Server is set up correctly

    Make sure that Internet Information Server is set up correctly for use with ASP.NET. This includes --in case of IIS 6.0-- setting the status of ASP.NET to "Allowed" in the Web Service extensions menu of the IIS Manager.

  5. Create a web application for JChem in Internet Information Server

    1. Open the IIS Manager
    2. Create a virtual directory for the default web site
    3. Alias: jchem
    4. Path: JChem's home directory
    5. In the Virtual Directory properties dialog box apply the following settings:
      • In the "Virtual Directory" tab
        1. mark all checkboxes except for the "Write" permission;
        2. select "Scripts and Executables" for the "Execute Permissions" setting;
        3. when selecting the application pool, consider the following:
          JChem's structure search engine will cache the structure information found in the structure table. With large datasets the structure cache size may be very large. (For a detailed description of how to caclulate the exact memory requirement of the search cache, see the FAQ.) One instance of the structure cache will be built up in each ASP.NET worker process. The structure cache should fit into physical memory, otherwise performance will be very poor. Consequently, when working with large datasets, you may want to create a dedicated application pool for a JChem ASP.NET application with only one worker process allowed. (See Application Pool Properties / Performance Tab / Web garden / Maximum number of worker process setting in IIS Manager.)
      • In the "Directory Security" tab make sure that "Authentication and access control settings" are such that IIS is able to read and execute the files under the JChem directory tree.
    See Internet Information Server's documentation for more details on creating web applications.

  6. Configure the JChem ASP.NET application

    1. If you haven't done yet so, execute the following command after unpacking the JNBridge files:
      registrationTool.exe /n /SE
      
      in order to register JNBridge in the Standard Edition mode. (There is one registrationtool.exe in the 1.x-targeted and one in the 2.0-targeted directory. You have to pick the one corresponding to your .NET version.)
    2. Review the settings in the examples/ChemAxon.NET/ASP.NET/web.config file and change the values, where necessary, to match your environment.

      The tag configuration/jnbridge/dotNetToJavaConfig contains information JNBridge needs in order to know how to channel calls made to the JChem .NET proxies. You have to set the attributes of the configuration/jnbridge/dotNetToJavaConfig tag as follows:

      • scheme: leave it sharedmem as is;
      • jvm: should point to the bin\server\jvm.dll file in the JRE directory;
      • jnbcore: should point to jnbcore.jar under the JNBridge installation directory;
      • bcel: should point to bcel-5.1-jnbridge.jar under the JNBridge installation directory;
      • classpath: should include a semicolon-separated list of the directory path to the required Java libraries:
        1. jchem.jar in the lib directory of the uncompressed JChem installation package;
        2. dom4j.jar in the same directory as jchem.jar;
        3. the JDBC driver for the database used.
      The tag configuration/jnbridge/appSettings contains the configuration for the JChem ASP.NET application proper. You have to set the following key-value pairs with add attributes of the configuration/jnbridge/appSettings element:
      • odbc.dsn: the ODBC data source name of the database containing the test structure table;
      • jdbc.driver: the Java class name of the JDBC driver. Please, consult the documentation of the JDBC driver documentation for information on the appropriate value. You can find this information for the JDBC driver of the best known databases here. Please, note that the format of the JDBC configuration for Microsoft SQL Server 2005 is different from that of earlier Microsoft SQL Server versions.
      • jdbc.url: the connection URL of the database as understood by the JDBC driver. Please, consult the documentation of the JDBC driver documentation for information on the appropriate value. You can find this information for the JDBC driver of the best known databases here. Please, note that the format of the JDBC configuration for Microsoft SQL Server 2005 is different from that of earlier Microsoft SQL Server versions.
      • db.schema: the name of the schema containing the test structure table;
      • db.username: the login name of the user which will be used to connect to the database.
      • db.password: the password of the user which will be used to connect to the database.
      • struct.table.name: the name of the test structure table.
  7. Copy the required DDLs

    The following DLLs has to be copied to the bin directory of your JChem installation
  8. Build the assembly supporting the JChem ASP.NET application

    1. Find the init.bat batch file in the examples/ChemAxon.NET directory and modify the values of the PROCESSOR_TYPE environment variable to match your environment.
    2. Open a Command Prompt window and call the sdkvars.bat batch file located in the Bin directory of your .NET SDK installation to set the required environment variables.
    3. Change your current working directory in the Command Prompt window to the examples/ChemAxon.NET/ASP.NET directory.
    4. Run the build.bat batch file to compile the .NET assembly containing the supporting routines for the JChem ASP.NET example application.

Using the example application

Point your WEB-browser to the URL: http://<hostname>:<port>/jchem/examples/ChemAxon.NET/ASP.NET/index.aspx. The WEB page at this URL will contain the necessary menus to insert, update and search in the test table.