• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unable to connect to Data Source

 
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I'm not able to connect to Data Source with different methods.
Really appreciate any suggestions.



With above code I'm getting error
Datasource Error :Cannot instantiate class: com.ibm.Websphere.naming.WsnInitialContextFactory



With this code it is going into exception with not details
Datasource Error :jdbc/ds1
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dilip,
Do you get any error messages when starting up the server? Are you using WSAD or WebSphere (app server) ?
 
Dilip kumar
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the response. Looks like I was getting the above errors because I forgot to save the server configuation when I added the data source. After saving the server I'm getting different error now. I'm running the application on WSAD 5 test application server.

[11/18/04 17:05:20:016 EST] 397eb5a7 ConnectionFac I J2CA0122I: Resource reference jdbc/ds1 could not be located, so default values of the following are used: [Resource-ref settings]

res-auth: 1 (APPLICATION)
res-isolation-level: 0 (TRANSACTION_NONE)
res-sharing-scope: true (SHAREABLE)
res-resolution-control: 999 (undefined)

[11/18/04 17:05:21:375 EST] 397eb5a7 ConnectionFac I J2CA0107I: Component-managed authentication alias not specified for connection factory or datasource DS1.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dilip,
You need to specify the password somewhere. It is prefered to use J2C (java connector) to do this. See the J2C tab on the server. If you want to harcode the password in the datasource itself, this message is expected.
 
Dilip kumar
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeanne,

When I go to "Modify Data Source" screen I don't see any fields for database/host name, User ID and Password. I'm wondering how the data source works without these fields. Looks like I'm missing something here.

Thanks
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They are actually custom properties that you define in the bottom section of the screen. They are not there by default. Presumably because they want to encourage the use of J2C.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

If you go in admin page you will find configuration of Data source. There you can configure data source.(username/password/url/min/max connections etc.)

Milind
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think this problem is occurring, becoz u r using a "Version 5.0 Datasource"
For this version u require to setup a JAAS security Profile. U can set up this profile from the "Security" tab of the server configuration. (Dbl-click the server to open the server configuration). In this tab, go to the table "JAAS Authentication Entries", click on "Add" button, and enter a userid and password.
After u have set up the JAAS profile, u need to go to the "Datasource" tab, select ur datasource, click "Edit" and go to the 2 drop down boxes at the bottom. (These are "Component-managed authentication alias" & "Container-managed authentication alias"). Enter the JAAS userid which u have just created in these 2 boxes.
Now save ur settings and restart the server and try again.
Let me know if that helps.
 
Dilip kumar
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the suggestions. I made the changes you suggested.

In the "Security" tab and under "JAAS Aunthentication Entries:" I now have
Alias:serve1
User ID:server1

In the "Data sources" tab and under "Data source defined in the JDBC provider selected above:"
I could see
Name : DS1
JNDI Name:jdbc/ds1
Type:V5
I have selected serve1 for component-managed and container-managed authentication alias.

In the "J2C" tab and under "J2C Connection Factories:" I could see
Name : DS1_CF
JNDI Name:eis/jdbc/ds1_CMP

But still I'm getting following message

[11/24/04 10:07:04:516 EST] 645ab97b ConnectionFac I J2CA0122I:
Resource reference jdbc/ds1 could not be located,
so default values of the following are used: [Resource-ref settings]

res-auth: 1 (APPLICATION)
res-isolation-level: 0 (TRANSACTION_NONE)
res-sharing-scope: true (SHAREABLE)
res-resolution-control: 999 (undefined)
[ November 24, 2004: Message edited by: Dilip kumar ]
 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Regards to Dilip's second post ---

That by the way is not an error....Its just a message which tells you that you are using the jndi name instead of a resource reference (which WebSphere suggests is the way to go )

Have you created a resource reference in the web.xml ??

If not create a resource reference and use "java:comp/env/ResRefName" in your lookup

In your web.xml go to the References tab, thn go to Resource tab(on the top)
Your ResRefName will be "serve1" since thats the alias tht u have already created. make sure your res ref is called serve1 (case sensitive --as a precaution --since jndi is case sensitive). also enter the jndi name of your datasource which will be jdbc/ds1. Select javax.sql.DataSource as the type. Let the authentication and Sharing remain Container and Shareable respectively.

Also since its a V5 DataSource, you will need to create the Alias in JAAS. This alias should be the same as the resource reference that you create. Select the resource reference in the Container and component managed authentication in the DataSource properties(which you have already done)
and you will not see that message.
[ November 24, 2004: Message edited by: Murtuza Akhtari ]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When creating a connection factory or data source, a JNDI name is given by which the connection factory or data source can be looked up by a component. Generally an "indirect" name with the java:comp/env prefix should be used. This makes any resource-reference data associated with the application available to the connection management runtime, to better manage resources based on the res-auth, res-isolation-level, res-sharing-scope, and res-resolution-control settings.


Also, Refer the website:
http://publib.boulder.ibm.com/infocenter/wasinfo/v5r0/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/rdat_jnditips.html
 
Happily living in the valley of the dried frogs with a few tiny ads.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic