my dog learned polymorphism*
The moose likes Websphere and the fly likes Datasource 4 Datasource 5 in WebSphere5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Datasource 4 Datasource 5 in WebSphere5" Watch "Datasource 4 Datasource 5 in WebSphere5" New topic
Author

Datasource 4 Datasource 5 in WebSphere5

Srinivas Rao Marri
Greenhorn

Joined: Jun 07, 2006
Posts: 11
Hi,

I am using datasource 4 in websphere5, which will take default userid and password along with jndi name. In my program i can directly lookup the jndi and access database data without giving any credential(userid, password) details.

My web application using servlet filters, which is not able to connect to datasource 4 because of servlet version 2.3.

If i want to connect to new datasource 5, is there any way where i can give default userid and password like how we did in datasource 4.

I hope in datasource 4 server is taking care of encrypting the credential details. I am looking for similar feature in datasource 5, instead of providing userid/passwd in properties file in an encrypted form.

Regards
Srinivas
Brian Hennessy
Ranch Hand

Joined: Oct 24, 2005
Posts: 57
Hi
For WAS and WebSPhere Studio the same methods apply.

For version 5 Datasources you need to create a j2c authentication alias , in here you'll specify your username and password. In the admin console =>Security=>JAAS configuration =>J2C Authentication Data.

Then when you create the datasource there are two options Component-managed Authentication Alias/Container Managed Authentication. Depending on the way you have written your app you can select the j2c alias you have created earlier from the drop downs lists for these two options. In a Network deployment environment I've had to restart WebSphere to successfully test the Datasource connection (don't know why). This set up is important especially if you're using XA datasources.

As for how the password are stored I don't think they are encrypted , I think they may be encoded using base 64 encoding and written to the secuirty.xml file. So really you should be locking down access to this file on your WAS environment.

Hope this helps
[ June 09, 2006: Message edited by: hennesb hennesb ]
Srinivas Rao Marri
Greenhorn

Joined: Jun 07, 2006
Posts: 11
Hi,

Thanks for the reply. I have some queries here:

1. For J2C authentication alias do we need to give database userid/password??

2. After defining alias, i used container managed option for the datasource5, and i tried to execute a JSP by connecting to database using this datasource, i am getting the below given exception:

com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurre
d while the JNDI NamingManager was processing a javax.naming.Reference object. [Root exception is java.lang.Exception: Attempted
to use a 5.0 DataSource outside of a 2.3 servlet]

Regards
Srinivas
Brian Hennessy
Ranch Hand

Joined: Oct 24, 2005
Posts: 57
Hi


1. For J2C authentication alias do we need to give database userid/password?? Yes if your database has a username and password you supply the values in here.

2. In your web.xml are you referencing the XML DTD for the Servlet 2.2 deployment descriptor

 
Don't get me started about those stupid light bulbs.
 
subject: Datasource 4 Datasource 5 in WebSphere5