If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Please help me to solve this COM.ibm.db2.jdbc.app.DB2Driver error?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-13-10, 13:20
Viruthagiri Viruthagiri is offline
Registered User
 
Join Date: Feb 2010
Posts: 1
Please help me to solve this COM.ibm.db2.jdbc.app.DB2Driver error?

Friends I'm using Rational application developer 7.0 and db2express c. I connected the database in RAD using new data connection wizard. I imported db2jcc.jar file too. I'm using Websphere application server community edition.
But while running the page this error displayed in every page.

ERROR : COM.ibm.db2.jcc.DB2Driver

I built the path too. My coding is as follows

<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" %>
<%
try
{
Class.forName("COM.ibm.db2.jcc.DB2Driver");
Connection con = DriverManager.getConnection("jdbc:db2:d1");
String username,password,usertype,query;
ResultSet rs=null;
PreparedStatement ps=null;
username = request.getParameter("username");
password=request.getParameter("password");
usertype=request.getParameter("usertype");
query="select * from login where username='"username"'and usertype="usertype"";
ps=con.prepareStatement(query);
rs=ps.executeQuery();
if (rs.next())
{
if (rs.getString("password").equals(password))
{

session.setAttribute("userid", rs.getString("userid"));
session.setAttribute("usertype", rs.getString("usertype"));
session.setAttribute("loginstatus", "1");

if(rs.getString("userid").equals("0"))
{
%>
<jsp:forward page="adminhome.jsp"></jsp:forward>
<%

}
if(rs.getString("usertype").equals("2"))
{

String query1="select designation from emp_work_profile where userid="session.getAttribute("userid")"";
ResultSet rs1=null;
PreparedStatement ps1=null;
ps1=con.prepareStatement(query1);
rs1=ps1.executeQuery();
while(rs1.next())
{
session.setAttribute("empdesig",rs1.getString("des ignation"));

if(rs1.getString("designation").equals("6")||rs1.g etString("designation").equals("7"))
{
%>
<jsp:forward page="ration/rationhome.jsp"></jsp:forward>
<%
}
else {%>
<jsp:forward page="employee/employeehome.jsp"></jsp:forward>
<% }

}

}
if(rs.getString("usertype").equals("1")) {
%>
<jsp:forward page="citizenhome.jsp"></jsp:forward>
<%}
if(rs.getString("usertype").equals("3")) {
%>
<jsp:forward page="hospital/hospital_main.jsp"></jsp:forward>
<%}
if(rs.getString("usertype").equals("4")) {
%>
<jsp:forward page="schoolhome.jsp"></jsp:forward>
<%}
}
else
{
%>
<jsp:forward page="wronguser.jsp"></jsp:forward>
<%

}
}
else
{
%><jsp:forward page="wronguser.jsp"></jsp:forward><%
}
con.close();
}
catch(Exception e)
{
out.println("Error "+e.getMessage());
}

%>

Please solve this error. i'll be thankful to you all
Reply With Quote
  #2 (permalink)  
Old 02-15-10, 01:57
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
Hmm.. this javascript right? Dunno about that. When it were java I'd say:
take this code as an example Java Program Name for DB2 | db2ude
there are 3 'crititcal' things going on in 1 try/catsch block. Why not not 3 of those blocks:
1 for the class-load
1 for the connect
1 for the query
This makes it more easy to pinpoint the error.
Reply With Quote
  #3 (permalink)  
Old 02-15-10, 09:56
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
It would also help if you had more diagnostic information about the error.

Andy
Reply With Quote
  #4 (permalink)  
Old 02-16-10, 16:13
schintala schintala is offline
Registered User
 
Join Date: Apr 2005
Location: USA
Posts: 119
Looks to me you are missing the jar files. In RAD did you specify correct SQLLIB path of DB2. BTW what version of DB2 and it's OS.
Reply With Quote
Reply

Tags
db2

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On