• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jboss 4.2.3 how to change the default datasource to oracle ?

 
Mark Kin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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.








 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks Jaikiran for the response.

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

Here is the web.xml

 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Nevermind

Got it resolved

Thank
Amar.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic