Home Tutorialhelp Comment facing problem in jdbc

 
 

Comment

phani
facing problem in jdbc,
December 6, 2007 at 7:34 PM


import java.io.*;
import java.lang.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class CheckLogin extends HttpServlet{
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException{
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
String connectionURL = "jdbc:mysql://localhost/empdata";
Connection connection=null;
try{
String dusername;
String dpassword;
String username= request.getParameter("username");
String password = request.getParameter("password");
pw.println(username);
pw.println(password);
Class.forName("org.gjt.mm.mysql.Driver");
connection = DriverManager.getConnection(connectionURL, "root", "admin");
Statement st = connection.createStatement();
String vsql1="select username,password from emplogin where username="+username+"and password="+password;
ResultSet rs = st.executeQuery(vsql1);
while(rs.next())
{


dusername = rs.getString("uname");
dpassword = rs.getString("pass");
System.out.println (" database username is=" + dusername);
System.out.println (" database password is=" + dpassword);
System.out.println("Checking userdata with database");


if(username.equals(dusername)&&password.equals(dpassword))

{

RequestDispatcher rd;
rd= getServletContext().getRequestDispatcher("/welcome.jsp");
System.out.print(rd);
rd.forward(request, response);
}
else
{
pw.println("<a href = \"login.jsp\"> BACK </a>");

}
st.close();
connection .close();
}
}

catch (Exception e){
e.printStackTrace();
}

}
}
in the above if the data is matched with the html data the welcome.jsp will be calle....but forward part is not executning....only else part is executing....pls help me..



View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
Programming Tutorials

index
Jbuilder Tutorials JDBC Tutorials RMI Tutorials 

Java Beginners

jdbc
jdbc  display the records using index in jdbc 

Java Beginners

jdbc
jdbc  I can't run my jdbc program because it has error in this line: public static void main(String[] args) the error is:illegal static declaration in inner class would you please let me whats the problem? regards 

JDBC Questions

jdbc
define transactions  define transactions   Whenever a connection is created by using the JDBC, then by default it is in auto- commit mode...() method. If there arises any problem while committing then the set 

JDBC Questions

JDBC related Problem - JDBC
JDBC related Problem  Hey plz check out the following code... = "jdbc:odbc:" + ds; try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver... connectivity code ...... my problem is... that even after the successful 

JDBC Questions

jdbc problem
jdbc problem   hi my name is mohit...i am making a project in java swings....pls help me how to check that the username and password are correct..."); con = DriverManager.getConnection("jdbc:odbc:mohit"); stmt 

JDBC Questions

JDBC - JDBC
JDBC  i am goint to work on JDBC and i knew oracle but very poor in java is it possoble to me to do JDBC is it so please give me SOME SAMPLE ILLUSTRATIONS to understand the way to do work in JDBC with syntaxes  Hi 

JDBC Questions

jdbc - JDBC
in JSP to create a table. 2)how desc can be written in JDBC concepts  Hi friend, Code to help in solving the problem : import java.sql.... = null; String url = "jdbc:mysql://localhost:3306/"; String db 

JDBC Questions

jdbc - JDBC
."); Connection conn = null; String url = "jdbc:mysql://localhost:3306... what problem you faced and explain it in details and read more information on Netbeans and jdbc visit to : http://www.roseindia.net/jdbc/ http 

JDBC Questions

jdbc - JDBC
primary key solve this problem.. how to drop and delete values from table... = null; String url = "jdbc:mysql://localhost:3306/"; String dbName.... http://www.roseindia.net/jdbc/ Thanks 

JDBC Questions

JDBC - JDBC
JDBC connection to database and show results  Check if the database... problem will get solved...("oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection("jdbc:oracle:thin 

JDBC Questions

jdbc - JDBC
jdbc  jdbc Expert:Ramakrishna Statement st1=con.createStatement... table; " here rs10.getString(1) " is the only primary key solve this problem... Deletion Example"); Connection con = null; String url = "jdbc:mysql://localhost 

JDBC Questions

jdbc - JDBC
(Exception l) { d.println(l); } } } For any more problem on JDBC...("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc:mysql://localhost.... but actually i didnt close the resultset object. this is my problem    

JDBC Questions

JDBC - JDBC
friend, For solving the problem some step to be rememeber : 1.Code to insert 

JDBC Questions

jdbc and swing problem in netbeans
jdbc and swing problem in netbeans  i reteived the table from database in a jdbc program. next i want to do is place the table as it is in a jpanel.. i am using netbeans IDE can u tel me how to do that one?? urgent 

JDBC Questions

jdbc and swing problem in netbeans
jdbc and swing problem in netbeans  i reteived the table from database in a jdbc program. next i want to do is place the table as it is in a jpanel.. i am using netbeans IDE can u tel me how to do that one?? urgent 

Java Beginners

problem in jdbc connection
problem in jdbc connection  when i am trying to insert into apache derby databse using java in netbeans an exceprion is thrown at run time like this:- java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver....what 

JDBC Questions

dsn problem - JDBC
me how to create dsn (jdbc ) at run time . when we will give our project... to remember to create dsn (jdbc): 1.Create an ODBC DSN Using the Windows... the driver To load the JDBC driver by calling the forName() static method 

JDBC Questions

JDBC in JSP - JDBC
JDBC in JSP   Sir, This is the code showing the problem. regards sreejith 

JDBC Questions

JDBC in JSP - JDBC
JDBC in JSP   Sir, This is the code showing the problem. regards sreejith 

JDBC Questions

Servlet problem - JDBC
but however. It gives problem sometimes while at others it works perfectly. I m using jdbc-odbc driver. Can anybody help me plzzzz!!!!   Hi Friend 

JDBC Questions

jdbc oracle connectivity problem
jdbc oracle connectivity problem  Hi All, I am trying to connect my swing application to oracle DB . but class.forname is giving error. Please suggest me if there is some different way to connect swing application to oracle 

Ajax Questions

Facing - Ajax
Facing   Hello All, i m using ajax in my application i m fetching data from db using ajax method and returning response in xml format. But when... the problem. once check u r xml response format. xml response should be like 

JDBC Questions

LOGIN PROBLEM - JDBC
LOGIN PROBLEM   sir iam harikrishna studying B.Tech Fourth year sir... and passowrd then my problem is how can we write the code for validating the userid... with JSP AND JDBC can u plz.........send me the code for checking username 

JDBC Questions

JDBC ODBC related problem
JDBC ODBC related problem  i WANT HELP RELATED TO JDBC CONNECTIVITY... con; con = DriverManager.getConnection("jdbc:odbc:Digambar... THE ERROR PART...... THE QUESTION N PROBLEM IS I WANT TO SELECTE PERTICULAR PAPER FROM 

JDBC Questions

mysql problem - JDBC
= "jdbc:mysql://localhost:3306/test"; Connection con=null; try 

JDBC Questions

java programming problem - JDBC
java programming problem  Hi, Request you to provide the source code in Java for the following programming problem : upload .csv file data into oracle database. please send the solution to raichallp@yahoo.in 

JDBC Questions

java programming problem - JDBC
java programming problem  Hi, Request you to provide a solution ( analysis & design & unit test plan & code & test criteria ) to the following problem to the following mail id : Problem : upload excel file data into oracle 

JDBC Questions

Sequence generator problem - JDBC
,but problem is that when i insert a values it will work and inserted the values.this one i am showing in a table ,but problem is a that it is also created a new 

JDBC Questions

jdbc compilation error - JDBC
jdbc compilation error  java.lang.Exception: Problem in call_select when i am executing the program i am getting the above error. how can i.... Read for more information. http://www.roseindia.net/jdbc/ Thanks 

JDBC Questions

mysql problem - JDBC
mysql problem   hai friends i have some problem with image storing in mysql. i.e while i am using image(blob) for insert the image it says out of bound of size error. please provide the logic for storing normal maxi size 

JDBC Questions

database problem - JDBC
 

JDBC Questions

mysql installation problem - JDBC
 

JDBC Questions

Jsp,JDBC - JDBC
Jsp,JDBC  Write a Program using Servlet,JSP, JDBC and XML to create a web application for a courier company to provide an online help in tracking the delivery status of items.  Hi friend, For solving the problem 

JDBC Questions

export data from database to excel sheet - JDBC
export data from database to excel sheet  I am facing a problem about... = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root", "root..."); rowhead.createCell((short) 4).setCellValue("Grade"); int index=1; while 

JDBC Questions

JDBC in JSP - JDBC
JDBC in JSP  Sir, I got a problem in my jsp page which contains a delete query to delete the fields from MySql DB. The delete query is working successfully when we insert the values manuely to the table. When we insert values 

JDBC Questions

jdbc code - JDBC
jdbc code  Dear Sir, i have created one jsp with two fields 1.username 2.password and i have connected to database...; Hi friend, For solving the problem visit to : http 

JDBC Questions

regarding jdbc - JDBC
code and details having the error to solve the Problem. Thanks  ... = DriverManager.getConnection("jdbc:mysql://localhost:3306/yourdatabase", "your username", "your 

JDBC Questions

jdbc mysql - JDBC
jdbc mysql  import java.sql.*; public class AllTableName...=DriverManager.getConnection("jdbc:mysql://localhost:3306/ram","root","root... be problem in your mySql, the above code is working fine. first you check 

Java Beginners

jdbc
jdbc  Hai , Give a steps for jdbc connectivity 

JDBC Questions

JDBC
JDBC  why we use batch in jdbc 

XML Questions

Problem facing in SAX Parsing - XML
Problem facing in SAX Parsing  I have facing the issue in SAX Parsing like i have got the xml and the xml structure is like below. - -   M.T.C ALUPACK(MOHAMED ALTURK & CO)   06684209932   BH   06684 

XML Questions

Problem facing in SAX Parsing - XML
Problem facing in SAX Parsing  I have facing the issue in SAX Parsing like i have got the xml and the xml structure is like below. - - M.T.C ALUPACK 06684209932 BH 06684 - AL HASSANAIN 

JDBC Questions

Connecting JTable to database - JDBC
interface in which i have used JTables.. Now my problem is I dont know how to how...; int index=1; int count=table.getRowCount(); try{ Class.forName...("jdbc:odbc:access"); for(int i=0;i  Hi Friend, Make one change 

JDBC Questions

JDBC
JDBC  How to add set of queries in a single query in JDBC 

JDBC Questions

about jdbc - JDBC
about jdbc  Hi folks, my previous question was when "i have a table with primary key then when i enter a value which is already there will cause a problem how to solve it." i know to retrieve all the attributes 

JDBC Questions

checking index in prepared statement
checking index in prepared statement  If we write as follows: String... = con.prepareStatement(query); then after query has been prepared, can we check the index... links: http://www.roseindia.net/jdbc/prepared-statement-insert.shtml http 

JDBC Questions

JDBC connection
JDBC connection  ![alt text][1]I got exception in Connecting to a MySQL Database in Java. The exception is ClassNotFoundException:com.mysql.jdbc.Driver wat is the problem 

Java Beginners

Jdbc
Jdbc  A java program with jdbc connectivity with insert,delete,update options for name,regno,mark1,mark2,total 

JDBC Questions

jdbc
jdbc  why do we need to load jdbc drivers before connecting to database 

JDBC Questions

JDBC
JDBC  can u send me the code of jdbc how to join two tables that are in relation 

Java Beginners

jdbc
jdbc  is it possible to use doget & dopost method with jdbc to call in a servlet programe 

Development process Questions

JDBC
JDBC  in class.forname which driver name we are writing for the connection from jdbc to sqlserver 2008 

Java Beginners

JDBC
JDBC  how to set classpath for eclipse, java, where to copy jdbc connector 

Java Beginners

jdbc
jdbc   how to write program to save data and retrieve data from the form in Java 

JDBC Questions

jdbc
jdbc  please tell me sir.i dont know JDBC connection and how to create table in database 

JDBC Questions

jdbc
jdbc define batch updates  define batch updates?exp   JDBC... links: http://www.roseindia.net/jdbc/Jdbc-batch-update.shtml http://www.roseindia.net/tutorial/java/jdbc/batchupdateresultsetexample.html 

JDBC Questions

jdbc
jdbc  Write a web based student registration application where the students can register online with their enrollment no. You are required to use JSP, Servelet and JDBC 

JDBC Questions

JDBC
JDBC save a data in the database  I need a code to save a data... between java and mysql using JDBC and saves the data into the database. import... con = null; String url = "jdbc:mysql://localhost:3306/"; String db 

JDBC Questions

JDBC
JDBC code to save a data in the database  I need a code to save... the connection between java and mysql using JDBC and saves the data into the database...!"); Connection con = null; String url = "jdbc:mysql://localhost:3306/"; String db 

JDBC Questions

jdbc
how can we set transaction level through jdbc api  how can we set transaction level through jdbc api   Use Connection.setTransactionIsolation(int) to set the desired tansaction level, which takes one of the 5 arguments 

JDBC Questions

jdbc
how can we call stored procedure using jdbc  how can we call stored procedure using jdbc   Call a Stored Procedure using...(); For more information, visit the following link: JDBC call Stored Procedure 

JDBC Questions

jdbc
jdbc  hey sir i just wanna have some ppt on jdbc coz have my exams next week and i have not attended any classes coz of job... I m studyng frm niit 

Java Beginners

jdbc
jdbc  how to update int values of ms-access in jdbc program?   In MS Access database, use Number data type for int values. import... =DriverManager.getConnection("jdbc:odbc:access","",""); Statement st=null; st 

JDBC Questions

jdbc
how can we set transaction level through jdbc api  how can we set transaction level through jdbc api   Use Connection.setTransactionIsolation(int) to set the desired tansaction level, which takes one of the 5 arguments 

JDBC Questions

jdbc
(); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost... information, visit the following link: JDBC Tutorials 

JDBC Questions

jdbc
jdbc  i had written jdbc connection in method and i need to get connection in another class?   import java.sql.*; class... driver = "com.mysql.jdbc.Driver"; String url = "jdbc:mysql://localhost:3306/test 

JDBC Questions

jdbc
using jdbc connection   import java.sql.*; public class CreateTable... = DriverManager.getConnection("jdbc:odbc:student"); Class.forName 

JDBC Questions

JDBC - JDBC
JDBC - limitations of jdbc  What are the limitations of JDBC 

JDBC Questions

jdbc - JDBC
Why JDBC   JDBC used for what 

SQL Question

JDBC
retrieve the value from database into dropdown list using JDBC SQL 2005  How to retrieve the value from database into dropdown list using JDBC &...").newInstance(); String connectionURL = "jdbc:mysql://localhost:3306/test";; Connection 

JDBC-Tutorials

JDBC Training, Learn JDBC yourself
JDBC Training       JDBC Training - Learn JDBC yourself: In this section we are providing free JDBC training material online. You can learn JDBC at your own 

JDBC Questions

JDBC
JDBC  write a JDBC program to display the result of any query on a student table in a JTable component.   import java.awt....").newInstance(); Connection con = DriverManager.getConnection("jdbc:mysql://localhost 

JDBC Questions

jdbc
oracle.jdbc.driver.OracleDriver()); Connection con=DriverManager.getConnection("jdbc:oracle:thin 

JDBC Questions

jdbc
the Connection.setTransactionIsolation(int level) method isolation level can be set in JDBC. the method can 

JDBC Questions

Enhydra Shark Workflow problem - JDBC
 

JDBC Questions

Enhydra Shark Workflow problem - JDBC
 

Framework Questions

facing problem plz help me out - Framework
Facing problem plz help me out  hi i am new to servlet i deployed... the web.xml file too parallel to the classes folder now i am facing this problem.plz tell me what to do... error:The requested resource (Servlet servlet 

JDBC Questions

jdbc
logical group of data with a number of columns. JDBC ResultSet Example Stored 

JDBC Questions

jdbc
level can be set in JDBC. the method can accept any of the arguments listed below 

JDBC Questions

jdbc
("jdbc:odbc:student"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver 

JDBC Questions

jdbc
what are different type of locks  what are different type of locks   Types of locks in JDBC: Row and Key Locks:: It is useful when updating the rows (update, insert or delete operations), as they increase concurrency 

SQL Question

JDBC
= DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root 

Java Beginners

jdbc
{ Connection con; con=DriverManager.getConnection("jdbc:odbc:student 

SQL Question

JDBC
("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql 

Java Beginners

jdbc
= DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root 

JDBC Questions

jdbc - JDBC
Loading JDBC driver at runtime  How to load JDBC Driver at runtime 

JDBC Questions

JDBC - JDBC
JDBC -statement types in jdbc  statement types in jdbc 

JDBC Questions

JDBC - JDBC
JDBC Select Count Example   Need an example of count in JDBC 

JDBC Questions

jdbc - JDBC
Java JDBC application  Database Application in Java JDBC 

JDBC Questions

Update - JDBC
("jdbc:odbc:Biu"); stat = con.prepareStatement("Update Biu SET itemcode... source code to solve the problem. For more information visit to : http://www.roseindia.net/jdbc/jdbc-mysql/UpdatesRecords.shtml Thanks   

JDBC Questions

no driver - JDBC
no driver  i am having problem connecting to DB2 database fro... = "jdbc:db2:r_m"; String url = "jdbc:db2://localhost:50000/r_m... the program: run: SQL Exception: No suitable driver found for jdbc:db2 

JDBC Questions

java - JDBC
java  I am using sessions (in JSP) in my project,for login and other purposes. I am using tomcat 5.0,oracle,jsp in my project. Project coding is going well , but i am facing problems with the life time of sessions 

JDBC Questions

jdbc run time error - JDBC
jdbc run time error  i m creating the table using thin driver...=DriverManager.getConnection("jdbc:opracle:thin:@ptpl:1521:oracle","scott","tiger...(); con.close(); } } so please suggest me what may be the problem. thanking 

JDBC Questions

creating jdbc sql statements - JDBC
)   Hi friend, i think, connection problem. i am sending jdbc...creating jdbc sql statements  I had written the following program...=DriverManager.getConnection("jdbc:odbc:second"); stmt=con.createStatement 

JSP Servlet Questions

JDBC-SERVLET
JDBC-SERVLET  *while doing connectivity of jdbc with servlet I m...=DriverManager.getConnection("jdbc:odbc:{Microsoft Access Driver(*.mdb.... Database Connectivity in Servlet Thanks.   Hi problem with url this url 

JDBC Questions

JDBC
 

JDBC Questions

JDBC
 

JDBC Questions

JDBC
 

JDBC Questions

JDBC
 

Advertisements Advertisements
 

 

 

DMCA.com