File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Using database roles in a J2EE application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Using database roles in a J2EE application" Watch "Using database roles in a J2EE application" New topic

Using database roles in a J2EE application

rivka zam

Joined: Feb 22, 2005
Posts: 24
We are going to use a connection pool DataSource on the Websphere application server.

DataSource uses standard JDBC properties to connect to the DB.

In our IDS we use DB roles.

I would like to know if there is a way to use DB roles with this connection pool DataSource?

Generally, I would like to know if database roles are still used in a J2EE application (that uses DataSource objects in order to connect to the DB)? Or is there a general trend to stop using DB roles and move to J2EE roles?
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3753

I would say no, they are not used much these days to provide user-level security although there may be people out there who still use them to a large degree. Usually DB roles are too limited in functionality to be used in any great degree so most db systems I have worked on use the same set of username/passwords for all users with the condition that the J2EE server ultimately protects the database server from unauthorized access (assuming the DB server is not exposed externally).

[OCA 8 Book] [Blog]
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
If you want to use your DB roles, check to see if your DB exports them via an LDAP or similar implementation. You may be able to wrap a JAAS provider around your DB roles that way.

Reid - SCJP2 (April 2002)
I agree. Here's the link:
subject: Using database roles in a J2EE application
It's not a secret anymore!