Here is another code snippet showing how we connect to our data source.
Note the "jdbc" in the JNDI name string.
Also note that we are retrieving a DataSource object not a String.
try
{
System.setSecurityManager( new RMISecurityManager() );
InitialContext ctx = new InitialContext( );
DataSource ds =
DataSource)ctx.lookup( "java:comp/env/jdbc/BYUDSSData" );
}
catch( Exception e )
{
System.out.println("Failed to retrieve DataSource!");
}
"BYUDSSData" is the name of the data source as we defined it in the JRun
Management Console.
Once you have retrieved the DataSource object you can use it to generate
database connections.
-----Original Message-----
From: Christophe Marchand [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 02, 2001 10:50 AM
To: JRun-Talk
Subject: init-properties in ejb
Hi all !
In my ejb-jar.xml, I define this :
<entity>
...
<env-entry>
<env-entry-name>datasource</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>FRMWK</env-entry-value>
</env-entry>
...
</entity>
When I deploy my JAR file, JRun doesn't recognize values for
env-entries. Well, I can do it manually... next step :
In my bean contrustor, I want to load this env-entries : here is my code
Context ctx = new InitialContext();
datasourceName = (String)ctx.lookup("java:comp/env/datasource");
This always throws a Naming exception...
Do I forget something ?
Thanks a lot in advance
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists