users@glassfish.java.net

Re: Accessing JNDI from a client.

From: <glassfish_at_javadesktop.org>
Date: Thu, 25 Oct 2007 19:40:19 PDT

So the problem is how to access some DataSource in glassfish remotely from a standalone java application? Please see glassfish EJB FAQ:

https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html

Some examples:
<code>
private static void testDataSource() throws NamingException, SQLException {
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("jdbc/mysql");
</code>

\jdk6\bin\java -cp classes;%SJSAS_HOME%\lib\*;%SJSAS_HOME%\imq\lib\*;%SJSAS_HOME%\domains\domain1\lib\mysql-java\mysql-connector-java-3.1.13-bin.jar
DataSourceTest

-cheng
[Message sent by forum member 'cf126330' (cf126330)]

http://forums.java.net/jive/thread.jspa?messageID=242256