Using the JDBC Connector
The JDBC adapter for the SAP Enterprise Portal 6.0 is a connector framework implementation based on JDBC.
There are two basic ways to get a connection using the JDBC Connector:
● Via the Connector Service—this approach being faster, simpler, and benefits from the portal’s user mapping from the system
● Direct connection using the J2EE JNDI
Example for a connection to a JDBC system using the connector service:
IConnection connection = null; String jdbcSystem = "pubs"; PortalRuntime.getRuntimeResources().getService(IConnectorService.KEY); ConnectionProperties cp = new ConnectionProperties(portalRequest.getLocale(), portalRequest.getUser()); try { } catch (Exception e) { try { if (connection != null) { connection.close(); } } catch (ResourceException re) { } } |
Example for a connection to a JDBC system using the J2EE JNDI:
// physical connection env.put("domain", "true");
initctx.lookup("deployedAdapters/JDBCFactory/shareable/JDBCFactory"); try { if (connection != null) { connection.close(); } } catch (ResourceException re) { } } |
See also
Prerequisites for using a connector