Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Jboss 4.2.3 how to change the default datasource to oracle ?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.








 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you read this article http://www.jboss.org/community/wiki/ConfigJBossMQDB ??
 
Mark Kin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jaikiran for the response.

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

Here is the web.xml

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Mark Kin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nevermind

Got it resolved

Thank
Amar.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try adding the following to your web.xml:



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

 
It's a pleasure to see superheros taking such an interest in science. And this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic