aspose file tools
The moose likes JBoss and the fly likes Defining Datasource in JBoss4.x 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 "Defining Datasource in JBoss4.x" Watch "Defining Datasource in JBoss4.x" New topic
Author

Defining Datasource in JBoss4.x

Anand Bhatt
Ranch Hand

Joined: May 30, 2007
Posts: 187
Hi
In which file in JBoss can I define my own datasource for MySQl database,and what varions properties I have set?
Patricia Samuel
Ranch Hand

Joined: Sep 12, 2007
Posts: 300
<?xml version="1.0" encoding="UTF-8"?>

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

<!-- ==================================================================== -->
<!-- Datasource config to be copied in Location where to keep this file jboss-4.0.4.GA\server\default\deploy -->
<!-- ==================================================================== -->


<datasources>
<local-tx-datasource>
<jndi-name>jdbc/testDS</jndi-name>
<connection-url>jdbc racle:thin:@url:1521:schema</connection-url>
<driver-class>driver class - jdbc.</driver-class>
<user-name>user</user-name>
<password>password</password>
<!-- 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>
<check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>

</local-tx-datasource>

</datasources>



Name this file after the name of your project. Like if your project name is test then name it like testDS.
and keep this file under location - \jboss-4.0.4.GA\server\default\deploy

Hope this would help. If you face any problem, kindly post a comment.
[ October 27, 2008: Message edited by: Patricia Samuel ]
Anand Bhatt
Ranch Hand

Joined: May 30, 2007
Posts: 187
Thanks for early reply,but where can i find this datasource config file and what is the name of that file to be copied?
Thanks
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 8143
    
  52

See these wiki articles:

Config DataSources

-ds.xml

You can find example datasource files in %JBOSS_HOME%\docs\examples\jca folder.


[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Defining Datasource in JBoss4.x
 
Similar Threads
How to integrate SQL server with JBOSS
J2ee application and JNDI in a Servlet
Isolation Level
Getting GenericJDBCException
Struts Connection pool (please help)