aspose file tools*
The moose likes Websphere and the fly likes Datasource could not be located in Websphere5.0 connecting with SQL Server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Datasource could not be located in Websphere5.0 connecting with SQL Server" Watch "Datasource could not be located in Websphere5.0 connecting with SQL Server" New topic
Author

Datasource could not be located in Websphere5.0 connecting with SQL Server

Anbarasan Chandramohan
Greenhorn

Joined: Nov 19, 2003
Posts: 4
Hi
I created one JDBC provider by giving jnetdirect\JSQLConnect\JDBC_2.0_Driver\JSQLConnect.jar in classpath and com.jnetdirect.jsql.JSQLConnectionPoolDataSource as implementation class.

One datasource (Version 5) was created by giving Component-managed Authentication alias and Mapping-Configuration alias. jndi name was given as "MyDataSource"
Datasource was configured with databaseName, portNumber, serverName, URL as Custom Properties.
TestConnection was successful in the Administrative console.
I put my lookup code as:
InitialContext ctx = new InitialContext();
System.out.println("Context is "+ctx);
javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("MyDataSource");
While accessing through the application, i am getting the following exception:
Resource reference MyDataSource 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)
[Other attributes]
isCMP1_x: false (not CMP1.x)
isJMS: false (not JMS)
If i change my jndi name to jdbc/MyDataSource and lookup code as:
javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("java:comp/env/jdbc/MyDataSource");
then i am getting comp/env/jdbc not found in context "java:" exception.
Can anyone get me the solution, if you have.

Thanks in advance,
A.Chandramohan
Mahesh Chalil
Ranch Hand

Joined: Jan 24, 2002
Posts: 147
Hi Chandramohan
Do a reference from your web deployment desciptor editor under the reference tab to make a reference to your datasource.
The name on the left side is the name you give in your source with java:comp/env and jndi name on the right side is the JNDI Name you gave while configuring your Datasource with WSAD.
 
Don't get me started about those stupid light bulbs.
 
subject: Datasource could not be located in Websphere5.0 connecting with SQL Server