12.11.2014 Views

web server - Borland Technical Publications

web server - Borland Technical Publications

web server - Borland Technical Publications

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Other Considerations<br />

■<br />

Adapter can be deployed to an application <strong>server</strong> without incident, it cannot be<br />

deployed to JNDI outside the aegis of an application <strong>server</strong>, as a non-managed<br />

Connector. Also, including a javax.naming.spi.ObjectFactory implementation source<br />

Adapter with backup mechanism for JNDI Reference-based connection factory<br />

lookup.<br />

The Resource Adapter which specifies an connection factory or connection interface<br />

while not implementing that interface in its connection factory or connection class,<br />

respectively. Section 10.6 “Resource Adapter XML DTD” in the Connectors spec<br />

discusses the related requirements. To illustrate, let's say that in the ra.xml of a<br />

particular Resource Adapter, you have the following elements:<br />

//...<br />

java.sql.Connection<br />

com.shme.shmeAdapter.ShmeConnection<br />

//...<br />

But your implementation of ShmeConnection is as follows:<br />

package shme;<br />

public class ShmeConnection<br />

{<br />

private ShmeManagedConnection mc;<br />

public ShmeConnection( ShmeManagedConnection mc )<br />

{<br />

System.out.println( "In ShmeConnection" );<br />

this.mc = mc;<br />

}<br />

}<br />

Any attempt to invoke getConnection() on this Resource Adapter's connection<br />

factory will result in a java.lang.ClassCastException, as you're indicating to the<br />

app<strong>server</strong> in ra.xml that connection objects returned by the Resource Adapter are to<br />

be cast to java.sql.Connection.<br />

Working with a Poor Resource Adapter Implementation<br />

To work around a poor Resource Adapter implementation, perform the following:<br />

Extend the connection factory and/or connection class of the Connector, and have the<br />

extension correctly implement the poorly implemented code. For example, when<br />

dealing with a connection factory which implements Serializable, and doesn't<br />

implement Referenceable the idea is to extend the original connection factory to<br />

implement Referenceable, which means implementing getReference() and<br />

setReference().<br />

Chapter 27: Using VisiConnect 279

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!