Making database connections

The connection process

The Web ActiveX and Transaction Object controls make database connections using JDBC. Their Java classes interact with the Java classes of the database vendor’s JDBC interface. The vendor’s classes interact with the database.

JDBC driver from a database vendor

The classes for the JDBC database driver you plan to use must be available to the user’s browser. If the user does not have them installed already, you can set up the Web page so that they are downloaded and installed just as you do for the Web ActiveX.

To have the JDBC driver classes installed automatically, you can:

  1. Convert the database vendor’s Java classes into a CAB file. You can use a Microsoft utility called CABARC to do the conversion. The classes can be in a ZIP archive or directory tree.

  2. Add an Object element with a CODEBASE attribute for the CAB file to the Web page.

The browser downloads the CAB file and adds the classes to its internal class path. There is no change made to the CLASSPATH environment variable.

If you want to use the JDBC driver when you are defining DataWindow objects, you need to do some additional installation, such as putting the JDBC driver classes on the system class path.

For more information, see Connecting to Your Database or the online Help for PowerBuilder.

Connection properties

The connection information for the Transaction Object or Web ActiveX is set as Param elements enclosed in the Object element. Whether you use a separate Transaction object or the internal connection properties of the Web ActiveX, the connection properties are the same:

Table 8-1: Connection properties of the Transaction Object and Web ActiveX controls

Param name

Meaning

Typical value

LogID

The ID needed to log in to the database.

dba (default ID for ASA databases)

LogPass

The password needed to log in to the database.

sql (default password for ASA databases)

dbParm

A string specifying the Java classes for the driver and the URL for the database.

For the JConnect driver: Driver='com.sybase.jdbc3.jdbc.SybDriver',URL='jdbc:sybase:Tds:199.1.1.1:9999/mydatabase'

Lock

The isolation level of the connection.

Vendor-specific values

AutoCommit

Whether a commit occurs immediately after the database is updated.

False (default)

About dbParm

For JDBC drivers, the dbParm property specifies essential connection information. Its value is a string that contains at least two values. Those values identify the driver you want to use and the URL of the database, in a format understood by the driver.

The format is:

Driver='JDBCclassname',URL='database_url '

To find the class name for Driver and the format of the database URL, check the documentation from the DBMS vendor.

For examples of setting these properties in Param elements, see “Properties and Param elements”.

JConnect in the development environment

If you want to use JConnect when you define DataWindow objects, put the Java classes for JConnect on the class path.