Win a copy of Penetration Testing Basics this week in the Security forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic


thomas davis
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"/>

I have added JNDI NAME IN datasource in server perspective.
I have added piece of code in web.xml
<resource-ref id="ResourceRef_1125512347889">

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);
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 :

An exception occurred while invoking method setDataSourceProperties on used by resource Data source 1 : java.lang.reflect.InvocationTargetException
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic