unable to validate username and password from ms acess database
//this code is not working! please help me to find error.
thanks.
<%@ page import="java.sql.*" %>
<%
Connection con=null;
String user=request.getParameter("userid");
session.putValue("userid",user);
String pwd=request.getParameter("pwd");
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
con = DriverManager.getConnection("jdbc:odbc:mydb","","");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from table1 where userid='"+user+"' and pwd='"+pwd+"'");
int i=0;
while(rs.next()){
i++;
}
if(i>0){
out.println("welcome " +user);
}
else{
response.sendRedirect("login.html");
}
}
catch(Exception e){
System.out.println(e);
}
%>
View Answers
November 3, 2012 at 4:31 PM
Follow these steps:
1)Go to the start->Control Panel->Administrative Tools-> data sources.
2)Click Add button and select the driver Microsoft Access Driver(*.mdb).
3)After selecting the driver, click finish button.
4)Then give Data Source Name and click ok button.
5)Your DSN will get created.
6) Restart your server and run your jsp/servlet code
Ads
Related Tutorials/Questions & Answers:
Advertisements
validating username and password from database
validating
username and
password from database Hello sir, i am developing a login page. i want that when i fill data in text fields. it
validate data
from database. if enter data is match
from database. page goes to next page
Acess Record from database.
Acess Record
from database. How to access records
from database and how to display it on view page, with the help of hibernate
how to check username & password from database using jsp
how to check
username &
password from database using jsp Hello,
I have created 1 html page which contain
username,
password & submit button.
in my oracle10G
database already contain table name admin which has name,
password
Username password
that will
validate usernames and passwords
from a
database. I need help with the validation, so that if the
username and
password match it will continue...=st.executeQuery("select *
from login where
username='"+value1+"' and
password='"+value2
unable to get datas from oracle database
unable to get datas
from oracle database Dear Sir,
I am again struck in my project..
i want to display data
from oracle
database but i get...=con.prepareStatement("select *
from departments");
ResultSet rs
username and password in servlet
username and
password in servlet i'm usng eclipse luna(java programming)
Sevlet and apache tomcat8.0
i need to do a login page
then after login... in:
Please Enter Your User Name:
Please Enter Your
Password
encrypt the username and password using PHP
encrypt the
username and
password using PHP How can we encrypt the
username and
password using PHP?
Hi friends,
You can use the MySQL
PASSWORD() function to encrypt
username and
password. For example,
INSERT
unable to connect database in java
unable to connect
database in java Hello Everyone! i was trying to connect
database with my application by using java but i am
unable to connect...
i was using this code....
try
{
Driver d=(Driver)Class.forName
unable to insert data into database
unable to insert data into
database hello.i have a problem... the eid based on ename and the other is inserting data into
database based... = Database.getConnection();
ps1=con.prepareStatement("select eid
from employee
unable to insert data into database
unable to insert data into
database hello.i have a problem... the eid based on ename and the other is inserting data into
database based... = Database.getConnection();
ps1=con.prepareStatement("select eid
from employee
unable to insert data into database
unable to insert data into
database hello.i have a problem... the eid based on ename and the other is inserting data into
database based... = Database.getConnection();
ps1=con.prepareStatement("select eid
from employee
unable to insert data into database
unable to insert data into
database hello.i have a problem... the eid based on ename and the other is inserting data into
database based... = Database.getConnection();
ps1=con.prepareStatement("select eid
from employee
unable to connect database in java
unable to connect
database in java Hello Everyone! i was trying to connect
database with my application by using java but i am
unable to connect...
i was using this code.
try
{
Driver d=(Driver)Class.forName
Unable to store the image into database
Unable to store the image into database Hello,
I have created below program and program is throwing FileNotFound exception when I pressed the submit...);
}
Hi,
Please check the thread How to Insert image into
database