SAS 9.1.3 Integration Technologies » Developer's Guide


Developing Java Clients
Installation and JRE Requirements
Security
Using the IOM Server
Using the Java Connection Factory
Connecting with Directly Supplied Server Attributes
Connecting with Server Attributes Read from a SAS Metadata Server
Connecting with Server Attributes Read from an LDAP Server
Connecting with Server Attributes Read from the Information Service
Language Service Example
Logging Java Connection Factory Activities
Using Failover
Using Load Balancing
Using Connection Pooling
Pooling with Directly Supplied Server Attributes
Pooling with Server Attributes Read from a Metadata Server
Pooling with Server Attributes Read from the Information Service
Returning Connections to the Java Connection Factory
Using Java CORBA Stubs for IOM Objects
Getting a JDBC Connection Object
Using the Java Workspace Factory
Using SAS Foundation Services
IOM and CORBA Class Documentation
Java Clients

Getting a JDBC Connection Object

Java Database Connectivity (JDBC) defines the standard way for Java programmers to access and manipulate data in a database. The IOM server supports IOM objects that provide all the functionality of a JDBC driver, but, instead of having to learn to program for those IOM objects, SAS Integration Technologies provides you with a JDBC implementation that uses IOM objects internally.

After you have established a connection to an IOM server and obtained a reference to a stub for the workspace component, you can get a java.sql.Connection object for the SAS JDBC Driver, as shown in the following example:

  import java.sql.Connection;
  import java.sql.SQLException;
  import java.util.Properties;
  import com.sas.iom.SAS.IDataService;
  import com.sas.rio.MVAConnection;

  //use workspace factory to get reference to workspace stub
  //IWorkspace sasWorkspace = ...
  IDataService rio = sasWorkspace.DataService();
  Connection sqlConnection = new MVAConnection(rio,new Properties());
     .
     .
     .
     (standard JDBC method calls)
     .
     .
     .

The following example shows you how to release the connection:
     sqlConnection.close();