hi kanifar,
thanks for ur help!!
i tried to use the following JSP to connect to a DB2 database..but it gives me an error
"Class loading error".. i know the problem is with class not found but how can i handle this
error also i am using Websphere 5.1 application developer to create this JSP file..
any place where i am missing anything w.r.t path ..thanks
JSP FILE:
------------
<html>
<head>
<%@ page
import = "java.io.*"
import = "java.lang.*"
import = "java.sql.*"
%>
<title>
JSP Example 2
</title>
</head>
<body>
<h1>JSP Example 3</h1>
<%
String place;
Connection dbconn;
ResultSet results;
PreparedStatement sql;
try
{
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver"
try
{
String code,desc;
boolean doneheading = false;
dbconn = DriverManager.getConnection("jdbc:db2:SABITDAT","sbdev","sbtdev"
sql = dbconn.prepareStatement("SELECT * FROM SBDATA.EM_STATE"
results = sql.executeQuery();
while(results.next())
{
if(! doneheading)
{
out.println("<table border=2>"
doneheading = true;
}
code = results.getString(1);
desc = results.getString(2);
out.println("<tr><td>" + code);
out.println("<td>" + desc);
}
if(doneheading)
{
out.println("</table>"
}
else
{
out.println("No matches for "
}
}
catch (SQLException s)
{
out.println("SQL Error<br>"
}
}
catch (ClassNotFoundException err)
{
out.println("Class loading error"
}
%>
</body>
</html>
thanks for ur help!!
i tried to use the following JSP to connect to a DB2 database..but it gives me an error
"Class loading error".. i know the problem is with class not found but how can i handle this
error also i am using Websphere 5.1 application developer to create this JSP file..
any place where i am missing anything w.r.t path ..thanks
JSP FILE:
------------
<html>
<head>
<%@ page
import = "java.io.*"
import = "java.lang.*"
import = "java.sql.*"
%>
<title>
JSP Example 2
</title>
</head>
<body>
<h1>JSP Example 3</h1>
<%
String place;
Connection dbconn;
ResultSet results;
PreparedStatement sql;
try
{
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver"
try
{
String code,desc;
boolean doneheading = false;
dbconn = DriverManager.getConnection("jdbc:db2:SABITDAT","sbdev","sbtdev"
sql = dbconn.prepareStatement("SELECT * FROM SBDATA.EM_STATE"
results = sql.executeQuery();
while(results.next())
{
if(! doneheading)
{
out.println("<table border=2>"
doneheading = true;
}
code = results.getString(1);
desc = results.getString(2);
out.println("<tr><td>" + code);
out.println("<td>" + desc);
}
if(doneheading)
{
out.println("</table>"
}
else
{
out.println("No matches for "
}
}
catch (SQLException s)
{
out.println("SQL Error<br>"
}
}
catch (ClassNotFoundException err)
{
out.println("Class loading error"
}
%>
</body>
</html>