Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - Programming » JDBC support » Data access using JDBC

 

Preparing for the JDBC examples

The code fragments in the following sections are taken from the complete class in %SQLANYSAMP16%\SQLAnywhere\JDBC\JDBCExample.java. In preparation for these sections, the sample Java application is compiled and installed into the database.

Prérequis

A Java Development Kit (JDK) must be installed.

To install a class, you must have the MANAGE ANY EXTERNAL OBJECT system privilege.

 Task
  1. Compile the JDBCExample.java source code.

  2. Connect to the database from Interactive SQL.

  3. Install the JDBCExample.class file into the sample database by executing the following statement in Interactive SQL:

    INSTALL JAVA NEW
    FROM FILE 'JDBCExample.class';

    If the database server was not started from the same directory as the class file and the path to the class file is not listed in the database server's CLASSPATH, then you will have to include the path to the class file in the INSTALL statement.

    You can also install the class using Sybase Central. While connected to the sample database, open the Java subfolder under External Environments and click File » New » Java Class. Follow the instructions in the wizard.

Résultat

The JDBCExample class file is installed in the database and ready for demonstration.