Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7819451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:57:28+00:00 2026-06-02T06:57:28+00:00

How can I create ConnectionPool/JDBC in JBoss without change any code in my application?

  • 0

How can I create ConnectionPool/JDBC in JBoss without change any code in my application? I already have the deploy file (.WAR).

For example, in tomcat I just needed to add a new resource to the server.xml file. Something like that:

...
<GlobalNamingResources>
    ...
    <Resource driverClassName="com.mysql.jdbc.Driver" name="testDBConnectionPool" password="root" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/testDB" username="root"/>
    ...
</GlobalNamingResources>
...

How to do it in JBoss? As I can understand, JBoss uses mysql-ds.xml file for that but we need to call it in the code. Am I right?

Is there any similar approach like Tomcat in JBoss?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T06:57:29+00:00Added an answer on June 2, 2026 at 6:57 am

    add required info in mysql-ds.xml and put it in $JBOSS_HOME/dirserver/default/deploy .

    If your datasource name is jdbc/MySQLDS , then you can call it like

    javax.naming.Context ic = new javax.naming.InitialContext();
    javax.naming.Context ctx = (javax.naming.Context) ic.lookup("java:");
    javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup("jdbc/MySQLDS");
    java.sql.Connection con = ds.getConnection();
    

    update:

    you need to make sure mysql-ds.xml has the exact values which are there in server.xml of tomcat.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how can create a windows move maker like application in vb.net.... if we want
I can create function pointers in Fortran 90, with code like real, external ::
I can create .o file with g++ -c test.cpp -std=c++0x , but cant link
I can create the desired date sequences using the following code: DateTwoWeeks1 <- seq(as.Date(2010/8/6),
In my J2EE 5 application I have a JDBC Realm based security with Form
I can create a confirm box in Ext JS like this: with this code:
You can create a class reference with the following code: Class M = [NSMutableString
I can create a contact that is not mail enabled, but how do I
How can create a view with mutiple images, something similiar to the photo app
One can create an anonymous object that is initialized through constructor parameters, such as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.