didn't take the first time...resend -----Original Message----- From: The elephantwalker [mailto:[EMAIL PROTECTED]] Sent: Monday, November 26, 2001 3:57 PM To: Orion-Interest Subject: RE: Using JDBC resource from application client
Romen, In you application-client.xml file, you will need to put in the jdbc resource after any ejb resources...like this: <resource-ref> <description>description</description> <res-ref-name>jdbc/MyDataSource</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> <-- this can be container or application </resource-ref> Then from your client app, you should be able to get the resource in the normal way: InitialContext ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup("jdbc/MyDataSource"); etc. regards, the elephantwalker www.elephantwalker.com Take a walk on the wild side, and join us at the elephantwalker! -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Romen Law Sent: Monday, November 26, 2001 3:03 PM To: Orion-Interest Subject: Using JDBC resource from application client 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