Hello, I have configured my data source on OC4J standalone version. Given below are snippets from the relevant files:
In my data-sources.xml , I have <data-source class="com.evermind.sql.DriverManagerDataSource" name="TestDS" location="jdbc/OracleCoreDS" xa-location="jdbc/xa/OracleXADS" ejb-location="jdbc/TestDS" connection-driver="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@servername:1521:test" username="username" password="password" min-connections="5" max-connections="20" inactivity-timeout="30" /> I "lookup" this data source in a DatabaseServlet, which is loaded on server startup, and intialize a static variable in my "DBConnection" class, which manages database connections. I use the code below: <snip> InitialContext ic = new InitialContext(); DataSource ds = (DataSource)ic.lookup("jdbc/TestDS"); .............. DBConnection.dataSource=ds; //initializeDataSource in the DBConnection class <snip> In my DBConnection class, I have methods like openConnection(), closeConnection() et al to handle connections from the data source. <snip> public Connection openConnection() { Connection con=null; try { con = dataSource.getConnection(); } catch(Exception e) { System.out.println("Error: Unable to get connection " + e.getMessage()); } return con; } <snip> In order to load the DatabaseServlet on starup, I have the following in the web.xml file: <servlet> <servlet-name>database</servlet-name> <servlet-class>obs.application.DatabaseServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> HTH, Shyam --- Janice <[EMAIL PROTECTED]> wrote: > Hi There, > > I'm getting ready to ship off my application and I'm > trying to use the > application server (standalone oc4j) to hold the > data source information > instead of having it in struts-config.xml. Is this > possible? > > When jDeveloper deploys to the server it builds me a > data-sources.xml file > which I presume is correct. When I test the > connection, its fine. > > In web.xml I entered: > > <resource-ref> > <res-ref-name>jdbc/bartCoreDS</res-ref-name> > <res-type>javax.sql.DataSource</res-type> > <res-auth>Container</res-auth> > </resource-ref> > > Where "jdbc/bartCoreDS" matches the "location" entry > of the data-source in > data-sources.xml. > > Then I took out the data-sources from > struts-config.xml. I'm not terribly > surprised that now my application can't find the > database. The problem is I > don't know where to look for instructions on how to > do this or if its even > possible. Is there a way to put a data-source > configuration in > struts-config.xml that tells it to look at the > container, so that the > username and password aren't in it?? > > If I can provide more information, I will. Time is > running a bit short, so > I'd really, really appreciate a quick response. > > Janice > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __________________________________ Do you Yahoo!? Yahoo! Mail - More reliable, more storage, less spam http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]