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

  • SEARCH
  • Home
  • 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 7623515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:43:33+00:00 2026-05-31T04:43:33+00:00

I have a situation where I am on a server with a valid DataSource

  • 0

I have a situation where I am on a server with a valid DataSource file (reproduced below) for connection to a local database which works fine. I also have a host of other machines with the exact same credentials except their ip addresses are different (which I also have). I would like to read in my localhost DataSource object and update the connection url with a different ipaddress. How do I do this? I’m using JBoss 4.2.3 for my deployment (which I cannot change).

Here is the method that I would like to create

/**
 * This gets a DataSource for a specified IP address using pacsDS as a template.
 * @param ipaddress
 * @return 
 */
public static DataSource getDataSource(Context context, String ipaddress) throws NamingException {
    DataSource ds = (DataSource)context.lookup("java:/pacsDS");
    // Update ds to make use of supplied ipaddress
    // ...
    return ds;
}

Here is the data source xml file

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

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

<!-- $Id: pacs-postgres-ds.xml 5174 2007-09-26 21:05:41Z gunterze $ -->
<!-- ==================================================================== -->
<!--  Datasource config for Postgres                                      -->
<!-- ==================================================================== -->


<datasources>
    <local-tx-datasource>
        <jndi-name>pacsDS</jndi-name>
        <connection-url>jdbc:postgresql://localhost/pacsdb</connection-url>
        <driver-class>org.postgresql.Driver</driver-class>
        <user-name>postgres</user-name>
        <password></password>
        <!-- sql to call when connection is created.  Can be anything, select 1 is valid for PostgreSQL
        <new-connection-sql>select 1</new-connection-sql>
        -->

        <!-- sql to call on an existing pooled connection when it is obtained from pool.  Can be anything, select 1 is valid for PostgreSQL
        <check-valid-connection-sql>select 1</check-valid-connection-sql>
        -->

        <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
        <metadata>
            <type-mapping>PostgreSQL 7.2</type-mapping>
        </metadata>
    </local-tx-datasource>
</datasources>
  • 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-05-31T04:43:34+00:00Added an answer on May 31, 2026 at 4:43 am

    You can parameterize your JBoss config files.

    See https://community.jboss.org/wiki/SystemPropertiesInConfigFiles?_sscc=t

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

Sidebar

Related Questions

I have an unusual situation to model in a MS SQL Server database: the
I have situation in which I read a record from a database. And if
I have a client server situation in which I receive data using read(socket, char_buf,
I have a situation when some clients see the server by its local IP
I have a situation where I want to use several server side controls, which
I have a situation when server creates an encrypted URL which is passed to
I have a situation here. I have a redundant TCP server setup which takes
I am using SQL Server 2000, I have a situation where I am copying
Do T-SQL queries in SQL Server support short-circuiting? For instance, I have a situation
Common situation: I have a client on my server who may update some of

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.