Win a copy of Kotlin in Action this week in the Kotlin forum!
    Bookmark Topic Watch Topic
  • New Topic

Connect to websphere data source from external application  RSS feed

Rahul Chaitanya
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Report post to moderator

I wrote the following code for connecting to the websphere datasource from external application:

Properties prop = new Properties();


InitialContext init = new InitialContext(prop);

DataSource ds = (DataSource) init.lookup("jdbc/testDS");

//Connection conn = ds.getConnection("USER NAME","PASSWORD");
Connection conn = ds.getConnection();

If, I give the username/pwd while retrieving the connection it is working but it is not working if i don't give them.

For resolving the above problem, I tried setting up the authentication alias(custom properties for the data source) and tried to access it through them. But no luck.

Is it possible to connect through the custom proerties ? I set up them with the names: "user and password" and used them while getting the connection. Do I need to create the properties with different names ?

Any suggestions will be a lot helpful.

Paul Clapham
Posts: 22472
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Report post to moderator
That's just a duplicate of this post as far as I can see. Please don't post duplicate questions.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!