It's not a secret anymore!
The moose likes Servlets and the fly likes Database Connection String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Database Connection String" Watch "Database Connection String" New topic

Database Connection String

Greg Bowie

Joined: Jun 30, 2010
Posts: 6
Hi all,

Firstly - I'm a newbie to Java so this post may not be in the correct place.

I'm need to move a Java Servlet from using a MySQL backend to Oracle. No major problems there - although I'm searching this servlet and I can't for the of me find the current connection string in order to change it.

I've used the IDE search functionality and a text based searcher - I know the name of the current connection.

One thing that is unfamilar to me is it appears to be using persistence (e.g. annotations like @PersistenceContext, @Entity and @Table(name="dbtable")) - does this entity stuff store the db connection string hidden away somewhere? Is there a good guide out on the internet for this terminology where I can play around and follow some tutorials?

Once again, apologises if this is in the wrong place or is lacking information - please let me know and I'll be happy to amend, and give further details...

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63350

This likely means that the application is properly structured -- where database concerns have no business being n the UI layers.

If the app is using Hibernate or JPA, the connection details are likely ensconced in a properties file.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Or it is i Server setup - and the application is only calling a JNDI name??

Regards, Rene Larsen
Dropbox Invite
Greg Bowie

Joined: Jun 30, 2010
Posts: 6
Hi - quick thank you to both of you.

Think its using JNDI, and therefore I'm assuming its set-up on the server somewhere.

Typical - got nowhere in office all day, get home, fire-up a laptop and start seeing stuff that I hadn't seen before.

Thanks for you help guys - think I now need to wait until the morning to have a look at the JNDI properties on the server.
I agree. Here's the link:
subject: Database Connection String
jQuery in Action, 3rd edition