• 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

please help in setting db connection in jboss

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a WAR file which runs fine on IBM websphere, now I want to run it on jboss. I am able to run a static website by putting it in the deploy folder, but for the dynamic website I need to make an oracle connection. Can any one please help where all I need to make changes. I am not using EJB's do I still need jbosscmp-jdbc.xm?

Regards
 
Ranch Hand
Posts: 128
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which JBoss version you are using? For making a connection with database you have to deploy a corresponding *-ds.xml file. See <JBOSS_HOME>\docs\examples\jca.
 
rubbal sandhu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

uttam kumar wrote:Which JBoss version you are using? For making a connection with database you have to deploy a corresponding *-ds.xml file. See <JBOSS_HOME>\docs\examples\jca.



Thanks!!
I am using jboss 5.0.0 I have made changes in hsqldb-ds.xml and standardjbosscmp-jdbc.xml, do I need to make any change in my war file as well
 
uttam kumar
Ranch Hand
Posts: 128
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to deploy oracle-ds.xml for making connection with oracle database. No need to change hsqldb-ds.xml. Are you facing any kind of error while deploying you war? If so, please post the entire error log along with the changes that you have done in JBoss.

Thanks,
Uttam Kumar
 
rubbal sandhu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I am sorry but I am new to jboss, do I need to have oracle-datasource.xml in my WAR file?
Among the long error logs, 'jdbc not bound' caught my eye.
I have made following changes in jboss:
in default/deploy/ hsqldb-ds.xml
I have added,

<jndi-name>jdbc/MYCoreDS</jndi-name>
<connection-url>jdbc:oracle:thin:@192.166.6.115:1521:MYDB</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>

<!-- The login and password -->
<user-name>m_demo</user-name>
<password>m_demo</password>

and in default/conf/ standardjbosscmp-jdbc.xml
<datasource>java:/MYCoreDS</datasource>
I have taken the above elements from datasource file produced by my jdev
Also I have put classes12.jar in jboss lib folder and also in my WAR file.


uttam kumar wrote:You need to deploy oracle-ds.xml for making connection with oracle database. No need to change hsqldb-ds.xml. Are you facing any kind of error while deploying you war? If so, please post the entire error log along with the changes that you have done in JBoss.

Thanks,
Uttam Kumar

 
uttam kumar
Ranch Hand
Posts: 128
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rub sandhu wrote:do I need to have oracle-datasource.xml in my WAR file?


You need to put oracle-ds.xml into <JBOSS_HOME>\server\<SERVER_TYPE>\deploy and corresponding required jar (eg: ojdbc14.jar) into <JBOSS_HOME>\server\<SERVER_TYPE>\lib folder.

Rub sandhu wrote:
I have made following changes in jboss:
in default/deploy/ hsqldb-ds.xml
I have added,

<jndi-name>jdbc/MYCoreDS</jndi-name>
<connection-url>jdbc:oracle:thin:@192.166.6.115:1521:MYDB</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>

<!-- The login and password -->
<user-name>m_demo</user-name>
<password>m_demo</password>

and in default/conf/ standardjbosscmp-jdbc.xml
<datasource>java:/MYCoreDS</datasource>


No need to modify hsqldb-ds.xml or standardjbosscmp-jdbc.xml. There are other services which uses jndi defined in hsqldb-ds.xml. Either you make changes everywhere or better leave it alone.
 
rubbal sandhu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Uttam,

Thanks for your help.
I have put the oracle-ds.xml file in the server\default\deploy
also I have tried putting both ojdbc.jar and classes12.jar in server\default\lib

I am still getting javax.naming.NameNotFoundException: jdbc not bound

here is my oracle-ds.xml file

<?xml version="1.0" encoding="UTF-8"?>

<!-- ===================================================================== -->
<!-- -->
<!-- JBoss Server Configuration -->
<!-- -->
<!-- ===================================================================== -->

<!-- $Id: oracle-ds.xml,v 1.6 2004/09/15 14:37:40 loubyansky Exp $ -->
<!-- ==================================================================== -->
<!-- Datasource config for Oracle originally from Steven Coy -->
<!-- ==================================================================== -->


<datasources>
<local-tx-datasource>
<jndi-name>MYCoreDS</jndi-name>
<connection-url>jdbc:oracle:thin:@192.166.6.115:1521:MYDB</connection-url>
<!--
See on WIKI page below how to use Oracle's thin JDBC driver to connect with enterprise RAC.
-->
<!--
Here are a couple of the possible OCI configurations.
For more information, see http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/toc.htm

<connection-url>jdbc:oracle:oci:@youroracle-tns-name</connection-url>
or
<connection-url>jdbc:oracle:oci:@(description=(address=(host=youroraclehost)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=yourservicename)))</connection-url>

Clearly, its better to have TNS set up properly.
-->
<driver-class>oracle.jdbc.pool.OracleDataSourcer</driver-class>
<user-name>m_demo</user-name>
<password>*****</password>

<min-pool-size>5</min-pool-size>
<max-pool-size>100</max-pool-size>

<!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
<!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->
<!-- Checks the Oracle error codes and messages for fatal errors -->
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>
-->

<!-- sql to call on an existing pooled connection when it is obtained from pool - the OracleValidConnectionChecker is prefered
<check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
-->

<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</local-tx-datasource>

</datasources>




 
uttam kumar
Ranch Hand
Posts: 128
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

model.DBConnector.getDBConnection(DBConnector.java:36)


Looks like in your code, you are searching for JNDI with prefix as "jdbc". Try changing the code. See if it works or not.
 
I carry this gun in case a vending machine doesn't give me my fritos. This gun 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