aspose file tools
The moose likes JBoss and the fly likes Jboss 4.2.3 how to change the default datasource to oracle ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » JBoss
Reply Bookmark "Jboss 4.2.3 how to change the default datasource to oracle ?" Watch "Jboss 4.2.3 how to change the default datasource to oracle ?" New topic
Author

Jboss 4.2.3 how to change the default datasource to oracle ?

Mark Kin
Greenhorn

Joined: Jun 20, 2009
Posts: 5
Jboss-4.2.3 GA
To configure the oracle datasource copied the oracle-ds.xml from jboss-as\docs\examples\jca folder to jboss-as\server\default\deploy folder and updated following info highlighted red

<jndi-name>TestOracleDatasource</jndi-name>
<connection-url>jdbc: o racle:thin:@youroraclehost:1521:yoursid</connection-url>
<driver-class>oracle.jdbc.driver . O racleDriver</driver-class>
<user-name>x</user-name>
<password>y</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor . O racleExceptionSorter</exception-sorter-class-name>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>


And following code is used to lookup the datasource

InitialContext context = new InitialContext();
DataSource ds = (DataSource) context.lookup("java:/comp/env/jdbc/TestOracleDatasource");
if (con == null)
{ con = ds.getConnection();
System.out.println("----con 1---->"+con.getMetaData().getIdentifierQuoteString());
System.out.println("----con 2---->"+con.getMetaData().getUserName());
System.out.println("----con 3---->"+con.getMetaData().getURL());
System.out.println("----con 4---->"+con.getMetaData().getDriverName());
}



here is what it printed in the logs
INFO [STDOUT] ----con 1---->"
01:45:55,842 INFO [STDOUT] ----con 2---->SA
01:45:55,842 INFO [STDOUT] ----con 3---->jdbc:hsqldb:C:\seamsetup\jboss-4.2.3.GA\server\default\data\hypersonic\localDB
01:45:55,842 INFO [STDOUT] ----con 4---->HSQL Database Engine Driver


I am sure the above details are from server/deploy/hsqldb-ds.xml, and I noticed several forums mentioneing HSQL DB is the default datasource.

So how do we change the default datasource from HSQL DB to Oracle. What configuration we need to change ?

Thanks
Amar.








Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 8142
    
  52

Post the contents of your jboss-web.xml and web.xml. Looks like the datasource is incorrectly mapped in ENC to point to the DefaultDS instead of your oracle datasource


[My Blog] [JavaRanch Journal]
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Have you read this article http://www.jboss.org/community/wiki/ConfigJBossMQDB ??


Regards, Rene Larsen
Dropbox Invite
Mark Kin
Greenhorn

Joined: Jun 20, 2009
Posts: 5
Thanks Jaikiran for the response.

Do you mean jboss-service.xml and web.xml ?

Here is the web.xml

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35239
    
    7
Amarnatha Konatham wrote:Here is the web.xml

Please refrain from posting large chunks of text using colors. Those are meant to highlight small pieces of text.


Android appsImageJ pluginsJava web charts
Mark Kin
Greenhorn

Joined: Jun 20, 2009
Posts: 5
Nevermind

Got it resolved

Thank
Amar.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5536

Try adding the following to your web.xml:



and create a WEB-INF/jboss-web.xml file and place this in it:



JBoss In Action
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Jboss 4.2.3 how to change the default datasource to oracle ?
 
Similar Threads
can not deploy application!!!!
Steps to change from Hypersonic to Oracle DB in jboss4.2.3
Jboss Migration from 4.0.5 to 4.2.3 (getting context.lookup = NULL)
configuring persistence
Name Not Bound Exception