Use JNDI to connect to DB

I have a process set up to continuously run sql scripts to the database using the idea from the link below 

How can I replace the JDBC connection with JNDI in the pom.xml
gaurav sharmaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gaurav sharmaAuthor Commented:
I am using the below implementation of maven to execute scripts to oracle database.
This is a sql-maven plugin that connects to the database using the configuration like below.

      The username and password cannot be put in here when building to personal identification schemas.
      Hence a JNDI connection is being created to connect to the DB.
      How can I use the JNDI connection in the pom.xml ?
mccarlIT Business Systems Analyst / Software DeveloperCommented:
Reading the documentation for the sql-maven-plugin it appears that it just doesn't support retrieving a connection via JNDI. So either you could try to find a different plugin (I don't know of one), write one yourself or just use the current plugin as is.

The username and password cannot be put in here

That's fine, so what you can do is using "properties" to specify the username/password. Have a read of this section of maven documentation ( You specify placeholders for the username and password and then (depending on your choice) you can specify the values for those placeholders within the users settings.xml file, or have them pass them as system parameters or have them set as environment variables. The POM stays that same for everyone, but the values can be different per user.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.