Use the Sample Code to Test the Data Access API
Use the supplied sample code to test the API and verify that you have the JDK and Apache Ant set up correctly.
- Make sure SuperSTAR is running, and that the sample Retail Banking database is available on your system.
- Open a command prompt and navigate to the Data Access API samples directory.
Run Ant to compile the sample code, by typing:
CODEant
This step is not strictly necessary to run the sample code, because there is already a pre-compiled .jar file supplied in the samples directory.
However, this is a good way to check that Ant is installed and configured correctly on your system. If Ant is configured correctly it will use the settings in build.xml to recompile the sample code and replace the supplied version of dataAccessAPISamples.jar.- Run runSamples.bat. This batch file executes the sample code SimpleTxdQuery, which uses the TXD file provided in the samples directory (txd01.txd) to submit a query to the database and return the output in CSV format.
If you encounter any issues, check the Troubleshooting section below. Once you have confirmed that the sample code is working, you might want to try the following additional tests:
Additional Tests
Use Your Own TXD File
- Go to SuperCROSS and generate your own TXD file.
- Open runSamples.bat in a text editor.
Locate the line that executes the sample code:
CODEjava -Djava.endorsed.dirs="%ENDORSED_DIR%" -DdataAccessAPI.data="%DATA_DIR%" au.com.str.samples.query.SimpleTxdQuery -tn txd01.txd
Change the final parameter (
-tn
) to point to your TXD file. For example:CODEjava -Djava.endorsed.dirs="%ENDORSED_DIR%" -DdataAccessAPI.data="%DATA_DIR%" au.com.str.samples.query.SimpleTxdQuery -tn MyTXDFile.txd
- Run the sample code again and check the output.
Run the Other Samples
- Open runSamples.bat in a text editor.
Locate the line that executes the sample code:
CODEjava -Djava.endorsed.dirs="%ENDORSED_DIR%" -DdataAccessAPI.data="%DATA_DIR%" au.com.str.samples.query.SimpleTxdQuery -tn txd01.txd
Change this to execute one of the other code samples by replacing
au.com.str.samples.query.SimpleTxdQuery
with the path to one of the other samples. For example:CODEjava -Djava.endorsed.dirs="%ENDORSED_DIR%" -DdataAccessAPI.data="%DATA_DIR%" au.com.str.samples.schema.SinglebranchNavigation
Troubleshooting
The following are some errors you might encounter running the sample code.
Error | Indicates that... |
---|---|
'ant' is not recognized as an internal or external command, | Either Ant is not installed or you have not set your Path environment variable to include the location of the Ant executable. Add Ant to your Path and try again. Any changes you make to your system environment variables through the Windows Control Panel will not be picked up immediately by any running command prompt. You will need to close and reopen the command prompt to access the updated system environment variables. |
Error occurred during initialization of VM | This error typically occurs if your Path system environment variable is not properly configured to point to the JDK. Note that the Data Access API requires the full Java Development Kit (JDK), not just the Java Runtime Environment (JRE). |
Exception in thread "main" | This error indicates that the Data Access API was unable to log in to SuperADMIN. This is most likely to be because the user credentials specified in the code are not valid for your system. For example, SimpleTxdQuery uses the default administrator account to login. If you have changed the account password or removed this account from your system then you will need to update the credentials in SimpleTxdQuery.java and recompile:
|
Exception in thread "main" | This error indicates that the Data Access API has attempted to use a database that does not exist. In this case, the code is attempting to connect to a database with the ID census that does not exist. To resolve this issue:
|