Handling JDBC references

www.altova.com このトピックを印刷 前のページ 1つ上のレベル 次のページ

ホーム >  Code Generator > Generating Java code >

Handling JDBC references

If the mapping connects to a database through JDBC, ensure that the JDBC drivers used by the mapping are installed on your system (see Creating a JDBC connection). To view the current JDBC settings of any database component, click it, and then select Component | Properties from the menu.


Additionally, if you build JAR files from generated Java code, add the "Class-Path" attribute for your database driver to the build.xml file. This ensures that the reference to the database driver is available in the manifest (MANIFEST.MF) file after you build the project.



To add the "Class-Path" attribute:

1.Add to the build.xml file a reference to the JAR file of the database driver, as a new "Class-Path" attribute. For example, for MySQL 5.1.16, the value of the "Class-Path" attribute looks as follows:


<attribute name="Class-Path" value="mysql-connector-java-5.1.16-bin.jar"/>


The manifest element of the build.xml file now looks similar to the screen shot below.


2.Copy the JAR file of the JDBC driver to the folder that contains the JAR file of the generated application.

(C) 2019 Altova GmbH