File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Anbarasan Chandramohan
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 147
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic