Also, DataSource is not shared across different VM since DB connection is bounded to process. The alternative way is to use JMX connector for DB connection information, and make a connection to DB to verify it. Here is the code:
import javax.management.ObjectName; import org.jboss.jmx.interfaces.JMXConnector; import org.jboss.jmx.client.RMIClientConnectorImpl; //assuming the test application running on the same machine with JBoss String host = InetAddress.getLocalHost().getHostName(); JMXConnector lConnector = new RMIClientConnectorImpl(host); ObjectName jdbc = new ObjectName("DefaultDomain:service=JdbcProvider"); String driver = (String) lConnector.getAttribute(jdbc,"Drivers"); // asumming the DataSource JNDI name is "mydb" ObjectName db = new ObjectName("DefaultDomain:service=XADataSource,n ame=mydb"); String jdbcURL = (String) lConnector.getAttribute(db,"URL"); String user = (String) lConnector.getAttribute(db,"JDBCUser"); String password = (String) lConnector.getAttribute(db,"Password"); // Connect to the DB with above info to verify it. .... Randy -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Scott M Stark Sent: Saturday, October 13, 2001 5:05 PM To: [EMAIL PROTECTED] Subject: Re: [JBoss-user] JDBC connections through JNDI DataSource from other programs No, nothing under the java: namespace is available outside of the server VM. xxxxxxxxxxxxxxxxxxxxxxxx Scott Stark Chief Technology Officer JBoss Group, LLC xxxxxxxxxxxxxxxxxxxxxxxx ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, October 13, 2001 2:39 PM Subject: [JBoss-user] JDBC connections through JNDI DataSource from other programs > I wrote a little test application to ensure that my > database DataSource was set up correctly and had > successfully connected to the database. My program did > a JNDI lookup on the DataSource and ran some simple SQL > statements. > > I got errors accessing the DataSource from my test > program. When using the JNDI name directly > (ie. "DefaultDS") I got a NameNotFoundException. When > using "java:DefaultDS", or anything like that, I get the > error: javax.naming.ServiceUnavailableException: jnp > [Root exception is java.net.UnknownHostException: jnp]. > > To check I did a lookup on an object listed in the > Global JNDI Namespace as listed in the JNDIView MBean > and got ClassCastExceptions as would be expected. > > Are the DataSource objects just not available outside > the server? Am I doing something wrong here? > > _______________________________________________ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user > _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user