ello,

Thanks to Ravi Reddy, I found the answer. The trick is not to make the data
source pooled in the data-sources.xml file (i.e., leave out the xa-location,
ejb-location and pooled-location fields).

But what is the rationale for this?

cheers
romen

-----------------------------------------
Original Message:
-----------------------------------------
ello,

I have seen the same question asked a few times in the mail archive, but no
answers. Now I am faced with the same question.

Am I supposed to access my datasource from an application client in
J2EE/Orion?

I have the following files setup with the correct values (I believe):
* $orion/config/data-sources.xml (using
class="com.evermind.sql.ConnectionDataSource" and Sybase driver
"com.sybase.jdbc2.jdbc.SybDriver")
* application-client.xml of the client app
* jndi.properties file of the client app
* manifest.mf of the client app

When I do the following in my client app, a NullPointerException will be
thrown when I try to prepare a statement or do anything useful with the
connection:

        InitialContext ctx = new InitialContext();
        DataSource ds = (DataSource) ctx.lookup("jdbc/MyDS");
        Connection con = ds.getConnection("OpenBill","OpenBill");
        // up to this point, nether ds or con are null, which is fine.
        con.prepareStatement("SELECT * FROM MyTable");  //
NullPointerException happens here.

The same code works fine in a servlet (my web.xml also setup correctly). 

cheers
romen



Reply via email to