About the JDBC interface
You can access a wide variety of databases via JDBC in PowerBuilder.
This section describes what you need to know to use JDBC connections
to access your data in PowerBuilder.
What is JDBC?
The JDBC API
Java Database Connectivity (JDBC) is a standard application
programming interface (API) that allows a Java application to access
any database that supports Structured Query Language (SQL) as its
standard data access language.
The JDBC API includes classes for common SQL database activities
so that you can open connections to databases, execute SQL commands,
and process results. Consequently, Java programs have the capability
to use the familiar SQL programming model of issuing SQL statements
and processing the resulting data. The JDBC classes are included
in Java 1.1 as the java.sql package.
The JDBC API defines the following:
- A library of JDBC function calls that
connect to a database, execute SQL statements, and retrieve results - A standard way to connect and log on to a DBMS
- SQL syntax based on the X/Open SQL Call
Level Interface or X/Open and SQL Access Group (SAG) CAE
specification (1992) - A standard representation for data types
- A standard set of error codes
How JDBC APIs are implemented
JDBC API implementations fall into two broad categories: those
that communicate with an existing ODBC driver (a JDBC-ODBC bridge)
and those that communicate with a native database API (a JDBC driver
that converts JDBC calls into the communications protocol used by
the specific database vendor). The PowerBuilder JDBC interface can
be used to connect to any database for which a JDBC-compliant driver
exists.
The PowerBuilder JDBC interface
PowerBuilder supports two versions of the JDBC interface: JDM
to run with Microsoft’s Java Virtual Machine and JDS to
run with Sun’s Java Virtual Machine. A Java VM is required
to interpret and execute the bytecode version of a Java program.
You can use the version of the JDBC interface that is most appropriate
for your development and deployment environment.
When you use the JDBC interface
Depending on which product you are using, the use of the JDBC
interface enables you to develop several types of components and/or
applications in PowerBuilder:
- Thin
client/server applications If a client is already running a Java VM (in a running web
browser or inside the operating system), the use of the JDBC interface
to access a database does not require the client-side installation
and administration of a database driver such as what is required
when using ODBC. - DataWindow objects to be used in a
Java application Use of the JDBC interface promotes consistency in data types
and behavior when developing an application that uses a DataWindow
JavaBeans component. - DataWindow objects to be used in a
DataWindow Web control for ActiveX Use of the JDBC interface (in this case JDM is required) does not
require the installation of a database driver on the client, since
the JDBC driver can be downloaded along with the Web control ActiveX
in a CAB file. - Transactional components to be deployed
on Jaguar CTS that access a database via the Jaguar JDBC interface Use of the JDBC interface (in this case JDS is required) allows
a PowerBuilder transactional component to share the same transaction
as a PowerJ component.
Components of a JDBC connection
How a JDBC connection is made
In PowerBuilder when you access a database via the JDBC interface,
your connection goes through several layers before reaching the
database. It is important to understand that each layer represents
a separate component of the connection, and that each component
may come from a different vendor.
Because JDBC is a standard API, PowerBuilder uses the same interface
to access every JDBC-compliant database driver.
The following diagram shows the general components of a JDBC
connection.
The JDBC DLLs
PowerBuilder provides two DLLs for use with the most common
VMs: JDM to run with Microsoft’s Java VM and JDS to run
with Sun’s Java VM.
Restrictions on use If you are developing a DataWindow object to be used in a
DataWindow Web control for ActiveX, you must
use
the JDM version of the JDBC interface. If you are developing a transactional
component to be deployed on Jaguar CTS that will use the Jaguar
JDBC interface, you must
use the JDS version
of the JDBC interface.
PowerBuilder Java package
Along with the DLLs, PowerBuilder includes a small package of
Java classes that gives the JDBC interface the level of error-checking
and efficiency (SQLException catching) found in the other PowerBuilder interfaces.
The package is called classes.zip and is found in Program FilesSybaseSharedPowerBuilder.
The Java VMs
The Java VM is a component of Microsoft’s and Sun’s
Java development software. You must have running on your machine
either the Microsoft VM for Java 2.02 or the Sun Java Runtime Environment
(JRE) 1.1.7.
The JDBC drivers
The JDBC interface can communicate with any JDBC-compliant
driver including Sybase jConnect as well as Oracle’s JDBC
Driver. These drivers are native-protocol all-Java drivers–that
is, they convert JDBC calls into the SQL syntax supported by the
Sybase and Oracle databases.
The JDBC registry entries
When you access data through the PowerBuilder JDBC interface, PowerBuilder uses
an internal registry to maintain definitions of SQL syntax, DBMS-specific
function calls, and default DBParm parameter settings for the backend
DBMS. This internal registry currently includes subentries for Sybase Adaptive Server Anywhere and
Adaptive Server Enterprise databases as well as Oracle.
In most cases you should not need to modify the JDBC entries.
However, if you do need to customize the existing entries or add
new entries, you can make changes to the system registry by editing
the registry directly or executing a registry file. Changes you
introduce in the system registry will override the PowerBuilder internal
registry entries. See the egreg.txt file in Program FilesSybaseSharedPowerBuilder
for an example of a registry file you could execute to change entry
settings.
Supported versionsand platforms for JDBC
Versions
The JDBC interface uses a DLL named either PBJDS70.DLL or PBJDM70.DLL
to access a database via a JDBC driver.
Required Sybase JDBC driver version To use the JDBC interface to access the jConnect driver, use
jConnect Version 4.0 or higher. For information on jConnect, see
your Sybase documentation.
Required Oracle JDBC driver version To use the JDBC interface to access the Oracle JDBC driver,
use Oracle8 JDBC driver Version 8.0.3 or higher. For information
on the Oracle JDBC driver, see your Oracle8 documentation.
Platforms
The JDBC interface is available on Windows 95/98
and Windows NT.
Supported JDBC data types
Like ODBC, the JDBC interface compiles, sorts, presents, and
uses a list of data types that are native to the backend database
to emulate as much as possible the behavior of a native interface.