RSS Forums RSS
Please support our JSP advertiser: Lunarpages JSP Web Hosting

Connectivity with mydwl using lsp

Join Date: Oct 2007
Posts: 3
Reputation: Rajesh.D.N is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Rajesh.D.N Rajesh.D.N is offline Offline
Newbie Poster

Connectivity with mydwl using lsp

  #1  
Nov 7th, 2007
Hi,
I am new to mysql connectivity using jsp. but i have tried it with MS Access nd it worked out for me.

I have installed jdk1.4, Tomcat5.0, mysql 4.1 and mysql_connector_odbc_3.51.21_win32.msi. For the following code i am getting error code 500..

I have set the Env paths as

path %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\Common Files\Adaptec Shared\System;C:\Program Files\Java\jdk1.5\bin;C:\Program Files\Java\jdk1.5\jre\lib\rt.jar;C:\Program Files\Java\jdk1.5\common\lib\servlet-api.jar;C:\Program Files\Apache Software Foundation\Tomcat 5.0\bin;C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar;C:\Program Files\MySQL\MySQL Server 4.1\bin;C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\Mysql\WEB-INF\lib\mysql-connector-java-3.0.15-ga-bin.jar;

Where Mysqls folder containing files in webapps,

Can u Plz tel me how to solve it. As per i found its error in Driver.Manager statement.



<html>
<head><br><br>
<center>Data retreived from data base(If Retreives)</center><br><hr><br><br>
</head>
<body>

<%@ page language="java" import="java.sql.*, java.io.*" %>
<%
String userName = null;
String Password = null;

userName = request.getParameter("user");
Password = request.getParameter("pswd");


Connection con = null;


try {


Class.forName("org.gjt.mm.mysql.Driver");



con = DriverManager.getConnection("jdbc:mysql://localhost:3306/Rajesh","root","mysql");

Statement statement = con.createStatement();

ResultSet rs = statement.executeQuery("SELECT * FROM prim WHERE name = '"+userName+"'");

while ( rs.next() ) {
%>
<p><h1>Welcome <%= userName %>!</h1></p>
<p>Your no is: <%= rs.getString("no") %></p>
<p>Your setno no.is: <%= rs.getString("setno") %></p>
<%
}

rs.close();
//System.in.read();
}
catch (IOException ioe) {
System.err.println(ioe.getMessage());
ioe.printStackTrace();

}
catch (SQLException sqle) {
System.err.println(sqle.getMessage());
sqle.printStackTrace();
}
catch (ClassNotFoundException cnfe) {
System.err.println(cnfe.getMessage());
cnfe.printStackTrace();
}
catch (Exception e) {
System.err.println(e.getMessage());
e.printStackTrace();
}
finally {
try {
if ( con != null ) {
con.close();
}
}
catch (SQLException sqle) {
System.err.println(sqle.getMessage());
}
}
%>


</body>
</html>


Plz give solution for my problem........
AddThis Social Bookmark Button
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:06 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC