473,468 Members | 1,334 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Help needed.....

Hi,
I have created servlet program using Netbeans.I have also written the
JDBC connectivity.But FileNotFoundException is arising.Can someone help
me?

Nov 12 '05 #1
8 1559

"revathi" <rs************@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi,
I have created servlet program using Netbeans.I have also written the
JDBC connectivity.But FileNotFoundException is arising.Can someone help
me?


I haven't used Netbeans but I have written some servlets that access DB2
and/or MySQL. I don't think you can get a FileNotFoundException as a result
of database access or JDBC activities. Therefore, I don't think a DB2
newsgroup is the best place to ask this question.

Why not try comp.lang.java.databases?

Rhino
Nov 12 '05 #2
I guess you are using TYPE-2 jdbc driver. Is it the case?

"revathi" <rs************@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi,
I have created servlet program using Netbeans.I have also written the
JDBC connectivity.But FileNotFoundException is arising.Can someone help
me?

Nov 12 '05 #3
iam usig DB2 ODBC Driver.

Nov 12 '05 #4
Iam sending u the code for Login Form:

/*
* login.java
*
* Created on February 24, 2005, 2:25 PM
*/

package sourcecode;

import java.io.*;
import java.net.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class login extends HttpServlet{

public void init(ServletConfig config) throws ServletException {
super.init(config);

}

public void processRequest (HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("<html><title>Login Form</title><body
background=C:/img/ibmclean.JPG >");
out.println("<form name='lo' method='post'>");
out.println("<img src=C:/img/ibmlogo.JPG height=70
align=right>");
out.println("<br><br><br><br>");
out.println("<center><TABLE border=0><TR><TD
STYLE=filter:glow(strength=5,color=red)><font face='Monotype corsiva'
size=15>Welcome! Please Login</font><td><img
src=c:/img/ig/leftmenu4.gif alt='Login'></td></TABLE>");
out.println("<center>");
out.println("<table border=0 cellspacing=5 rowspan=2
colspan=2><tr>");
out.println("<tr><td valign=center>MAIL ID</td>");
out.println("<td ><input type=text name='mailid'
width=20></td>");
out.println("</tr><br>");
out.println("<tr>");
out.println("<td valign=center>PASSWORD</td>");
out.println("<td ><input type=password name='passwd'
width=20></td>");
out.println("</tr>");
out.println("</table>");
out.println("</center>");
out.println("<center>");
out.println("<table>");
out.println("<tr><td><h5><a
href=http://localhost:8084/Reporting/changepassword><br>Change
Password?</a></h5></td><td><input type='submit' name=submit
value=SUBMIT onClick=mail()></td><td><input type=button name=reset
value=RESET></td></tr>");
out.println("</table>");
out.println("</center>");

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:dbname" ,"","");
Statement st=con.createStatement();
String s1=req.getParameter("mailid");
String s2=req.getParameter("passwd");
ResultSet rs=st.executeQuery("Select mailid,pass from login
where mailid=''+s1'' and pass=''+s2+'' ");
String s;
String l;
while(rs.next())
{
l=(rs.getString("mailid"));
s=(rs.getString("pass"));
if(l.equals("'+s1+'"))
{
if(s.equals("'+s2+'"))
{
out.println("Welcome!");//a
href=http://localhost:8084/Reporting/viewusersform");
}
else
{
out.println("Password incorrect,Check password");
// out.println("<a
href=javascript:history.back(1)>back</a>");
}
}
}
}
catch(SQLException e)
{
out.println("e.getMessage()");
}
out.println("</form>");
out.println("</body></html>");
out.close();
}
protected void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}

public void doPost(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
processRequest(request, response);
}

}
Then i created the DSN name and ODBC connectivity...
While compiling i have no error.While running Exception is raised and
the file login is not available,Such errors are arising.

Nov 12 '05 #5
Iam sending u the code for Login Form:

/*
* login.java
*
* Created on February 24, 2005, 2:25 PM
*/

package sourcecode;

import java.io.*;
import java.net.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class login extends HttpServlet{

public void init(ServletConfig config) throws ServletException {
super.init(config);

}

public void processRequest (HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("<html><title>Login Form</title><body
background=C:/img/ibmclean.JPG >");
out.println("<form name='lo' method='post'>");
out.println("<img src=C:/img/ibmlogo.JPG height=70
align=right>");
out.println("<br><br><br><br>");
out.println("<center><TABLE border=0><TR><TD
STYLE=filter:glow(strength=5,color=red)><font face='Monotype corsiva'
size=15>Welcome! Please Login</font><td><img
src=c:/img/ig/leftmenu4.gif alt='Login'></td></TABLE>");
out.println("<center>");
out.println("<table border=0 cellspacing=5 rowspan=2
colspan=2><tr>");
out.println("<tr><td valign=center>MAIL ID</td>");
out.println("<td ><input type=text name='mailid'
width=20></td>");
out.println("</tr><br>");
out.println("<tr>");
out.println("<td valign=center>PASSWORD</td>");
out.println("<td ><input type=password name='passwd'
width=20></td>");
out.println("</tr>");
out.println("</table>");
out.println("</center>");
out.println("<center>");
out.println("<table>");
out.println("<tr><td><h5><a
href=http://localhost:8084/Reporting/changepassword><br>Change
Password?</a></h5></td><td><input type='submit' name=submit
value=SUBMIT onClick=mail()></td><td><input type=button name=reset
value=RESET></td></tr>");
out.println("</table>");
out.println("</center>");

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:dbname" ,"","");
Statement st=con.createStatement();
String s1=req.getParameter("mailid");
String s2=req.getParameter("passwd");
ResultSet rs=st.executeQuery("Select mailid,pass from login
where mailid=''+s1'' and pass=''+s2+'' ");
String s;
String l;
while(rs.next())
{
l=(rs.getString("mailid"));
s=(rs.getString("pass"));
if(l.equals("'+s1+'"))
{
if(s.equals("'+s2+'"))
{
out.println("Welcome!");//a
href=http://localhost:8084/Reporting/viewusersform");
}
else
{
out.println("Password incorrect,Check password");
// out.println("<a
href=javascript:history.back(1)>back</a>");
}
}
}
}
catch(SQLException e)
{
out.println("e.getMessage()");
}
out.println("</form>");
out.println("</body></html>");
out.close();
}
protected void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}

public void doPost(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
processRequest(request, response);
}

}
Then i created the DSN name and ODBC connectivity...
While compiling i have no error.While running Exception is raised and
the file login is not available,Such errors are arising.

Nov 12 '05 #6
Hi,
Can you just post the actual expection? So that we can more
information...

Cheers,
Thiru.
WantedToBeDBA

Nov 12 '05 #7
Hi,
A very good code for SQL injection... Enjoy Hackers... If you don't
consider security yet then ok. Else make sure your code is not
vulnerable to attack...

Handle the Strings S1 and S2 with atmost care to avoid SQL Injection..

Cheers,
Thiru.
WantedToBeDBA.
WantedToBeDBA at gmail dot com

Nov 12 '05 #8
Hi
I am not getting ur point correctly. "While running Exception is
raised and
the file login is not available,Such errors are arising.". What it
means?

Can u exactly copy and paste the exception here. So i can understand
clearly and help u further.
regards
Guru


revathi wrote:
Iam sending u the code for Login Form:

/*
* login.java
*
* Created on February 24, 2005, 2:25 PM
*/

package sourcecode;

import java.io.*;
import java.net.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class login extends HttpServlet{

public void init(ServletConfig config) throws ServletException { super.init(config);

}

public void processRequest (HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("<html><title>Login Form</title><body
background=C:/img/ibmclean.JPG >");
out.println("<form name='lo' method='post'>");
out.println("<img src=C:/img/ibmlogo.JPG height=70
align=right>");
out.println("<br><br><br><br>");
out.println("<center><TABLE border=0><TR><TD
STYLE=filter:glow(strength=5,color=red)><font face='Monotype corsiva'
size=15>Welcome! Please Login</font><td><img
src=c:/img/ig/leftmenu4.gif alt='Login'></td></TABLE>");
out.println("<center>");
out.println("<table border=0 cellspacing=5 rowspan=2
colspan=2><tr>");
out.println("<tr><td valign=center>MAIL ID</td>");
out.println("<td ><input type=text name='mailid'
width=20></td>");
out.println("</tr><br>");
out.println("<tr>");
out.println("<td valign=center>PASSWORD</td>");
out.println("<td ><input type=password name='passwd'
width=20></td>");
out.println("</tr>");
out.println("</table>");
out.println("</center>");
out.println("<center>");
out.println("<table>");
out.println("<tr><td><h5><a
href=http://localhost:8084/Reporting/changepassword><br>Change
Password?</a></h5></td><td><input type='submit' name=submit
value=SUBMIT onClick=mail()></td><td><input type=button name=reset
value=RESET></td></tr>");
out.println("</table>");
out.println("</center>");

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:dbname" ,"","");
Statement st=con.createStatement();
String s1=req.getParameter("mailid");
String s2=req.getParameter("passwd");
ResultSet rs=st.executeQuery("Select mailid,pass from login where mailid=''+s1'' and pass=''+s2+'' ");
String s;
String l;
while(rs.next())
{
l=(rs.getString("mailid"));
s=(rs.getString("pass"));
if(l.equals("'+s1+'"))
{
if(s.equals("'+s2+'"))
{
out.println("Welcome!");//a
href=http://localhost:8084/Reporting/viewusersform");
}
else
{
out.println("Password incorrect,Check password");
// out.println("<a
href=javascript:history.back(1)>back</a>");
}
}
}
}
catch(SQLException e)
{
out.println("e.getMessage()");
}
out.println("</form>");
out.println("</body></html>");
out.close();
}
protected void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}

public void doPost(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
processRequest(request, response);
}

}
Then i created the DSN name and ODBC connectivity...
While compiling i have no error.While running Exception is raised and
the file login is not available,Such errors are arising.


Nov 12 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical...
7
by: ChadDiesel | last post by:
Hello everyone, I'm having a problem with Access that I need some help with. The short version is, I want to print a list of parts and part quantities that belong to a certain part group---One...
7
by: Tina | last post by:
I have an asp project that has 144 aspx/ascx pages, most with large code-behind files. Recently my dev box has been straining and taking long times to reneder the pages in the dev environment. ...
10
by: Mae Lim | last post by:
Dear all, I'm new to C# WebServices. I compile the WebService project it return no errors "Build: 1 succeeded, 0 failed, 0 skipped". Basically I have 2 WebMethod, when I try to invoke the...
2
by: trihanhcie | last post by:
I m currently working on a Unix server with a fedora 3 as an os My current version of mysql is 3.23.58. I'd like to upgrade the version to 5.0.18. After downloading from MYSQL.COM the package on...
2
by: Steve K | last post by:
I got a bit of a problem I like some help on. I'm designing an online training module for people that work in food processing plants. This is my target audience. These workers have little or no...
3
by: Kitana907 | last post by:
Hi- I'm attempting to write a module that uses and updates info from two tables and does the following: Opens the recordset of a table called "tblstoreinv" If the Needed Field in the...
9
by: smartbei | last post by:
Hello, I am a newbie with python, though I am having a lot of fun using it. Here is one of the excersizes I am trying to complete: the program is supposed to find the coin combination so that with...
2
by: rookiejavadude | last post by:
I'm have most of my java script done but can not figure out how to add a few buttons. I need to add a delete and add buttong to my existing java program. Not sure were to add it on how. Can anyone...
32
by: =?Utf-8?B?U2l2?= | last post by:
I have a form that I programmatically generate some check boxes and labels on. Later on when I want to draw the form with different data I want to clear the previously created items and then put...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.