my dog learned polymorphism*
The moose likes Websphere and the fly likes JNDI DATASOURCE PROBLEM WITH WSAD Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "JNDI DATASOURCE PROBLEM WITH WSAD" Watch "JNDI DATASOURCE PROBLEM WITH WSAD" New topic
Author

JNDI DATASOURCE PROBLEM WITH WSAD

thomas davis
Ranch Hand

Joined: Feb 01, 2003
Posts: 207
I am facing a problem of getting connection.
I have done changes in ibm-web-bnd.xml(<resRefBindings xmi:id="ResourceRefBinding_1125512347889" jndiName="jdbc/session_borg">
<bindingResourceRef href="WEB-INF/web.xml#ResourceRef_1125512347889"/>
</resRefBindings>)

I have added JNDI NAME IN datasource in server perspective.
I have added piece of code in web.xml
<resource-ref id="ResourceRef_1125512347889">
<res-ref-name>jdbc/session_borg</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</web-app>

My code for accessing the connection is as follows:
boolean ret =false;
InitialContext ic=new InitialContext();
DataSource ds =(DataSource) ic.lookup("java:comp/env/jdbc/sample");
Connection con = (Connection) ds.getConnection();
Statement stmt = null;
ResultSet rs = null;
try {
stmt = con.createStatement();
rs= stmt.executeQuery(GET_SQL);
while(rs.next()){
System.out.println("Login Detaile "+rs.getString(1)+" "+rs.getString(2));
if(rs.getString(1).equals(loginId)&& rs.getString(2).equals(password))
{ret =true;
return ret;}
}
}



I am getting an exception as follows :
Exception

An exception occurred while invoking method setDataSourceProperties on com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl used by resource Data source 1 : java.lang.reflect.InvocationTargetException
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNDI DATASOURCE PROBLEM WITH WSAD
 
Similar Threads
JNDI in Servlets
struts 1.3 Data base connection pool
making connection pool in Glassfish v3
Reuse of Data Source
Problem in Jndi LooK up in Was6.1 for MySql Data Source