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 9037385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:14:03+00:00 2026-06-16T09:14:03+00:00

I have a Java project that runs from the command line. It is using

  • 0

I have a Java project that runs from the command line. It is using Spring. At the current time my project is mySQL. Use can see from the config.xml below

<bean id="mysqldataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="mysqldataSource.url" />
    <property name="username" value="mysqldataSource.username" />
    <property name="password" value="mysqldataSource.password" />
</bean>

My firm is asking me to change the project from using MySQL to use a JNDI Data source.

Below is my java code with you can see is using jdbcTemplate:

public class DisasterReliefMySQLImpl extends JdbcTemplate implements
        DisasterReliefMySQL {

    private static Log log = LogFactory.getLog(DisasterReliefMySQLImpl.class
            .getName());

    String querySQL;
    int counter = 0;

    public int getCounter() {
        return counter;
    }

    private String getQuerySQL() {
        return querySQL;
    }

    private void setQuerySQL(String querySQL) {
        this.querySQL = querySQL;
    }

    DisasterReliefMySQLImpl(DataSource ds) {
        super(ds);
    }


    DisasterReliefMySQLImpl(DataSource ds, String querySQL) {
        super(ds);
        setQuerySQL(querySQL);
    }

    public int updateDonation(String id) {
        Long eTime = System.currentTimeMillis() / 1000;

        String updateSQL = "update uft_donation set sent_to_mbs="
                + eTime.toString() + " where  donation_id =" + id;

        return (int) this.update(updateSQL);
    }

    public List<Donation> returnResults() {
        log.debug("Starting returnResults...");

        List<Donation> Donations = new ArrayList<Donation>();

        List<Map<String, Object>> rows = this.queryForList(getQuerySQL());

        counter = 0;

        for (Map row : rows) {
            Donation d = new Donation();

            d.setDonationID((Long) row.get("donation_id"));
            d.setCCTransactionNumber((String) row.get("txn_id"));
            d.setProgramCode((String) row.get("gl_code"));
            d.setLastName((String) row.get("billing_last_name"));
            d.setFirstName((String) row.get("billing_first_name"));
            d.setAmount((String) row.get("mc_gross"));
            d.setAddressLine1((String) row.get("billing_street1"));
            d.setAddressLine2((String) row.get("billing_street2"));
            d.setCity((String) row.get("billing_city"));
            d.setState((String) row.get("zone_code"));
            d.setZipCode((String) row.get("billing_postal_code"));
            d.setCountry((String) row.get("country_name"));

            Donations.add(d);
            counter++;
        }

        log.debug(counter + " Donation(s) loaded");
        return Donations;
    }

}

Can someone please tell me how to change this to use a JNDI datasource. Also do I need a JNDI service somewhere for the database pooling?? We have JBoss AS7 with datasources in it can I use that from outside JBoss??

Thanks

  • 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-16T09:14:04+00:00Added an answer on June 16, 2026 at 9:14 am

    Found this searching the web for “jboss external jndi”

    http://www.engfers.com/2008/08/07/exposing_accessing-jboss-jndi-objects_datasources-from-an-external-jvm/

    Looks like what you’re after. It’s amazing what you can find with your favorite search engine 😉

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

Sidebar

Related Questions

I have a Java project that I build using an Ant script. I am
I have recently just created Java project using Eclipse that requires 2 JAR files
I have got a project that is using jni to connect java wrapper and
I have a Java application that is managed using Maven. The project involves the
I have a Java Eclipse project, but I don't run it from the command
I created a new PlayN project from the 1.2 archetype using the command line
I have a multi module Spring project that I set up using Maven: my-root
I have a Java servlet project in Eclipse that includes the use of jQuery
In eclipse I have a java project that runs an external program (a .exe)
I have a java project that uses JPA 2/Hibernate 3.5.6 for data access and

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.