dao

dao

package com.ilp.tsi.um.dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import com.ilp.tsi.um.constant.BankConstant;
public class BankDao {
    public static Connection createconnection() {
        Connection conn = null;
        try 
        {
            Class.forName(BankConstant.DRIVER).newInstance();
            conn = DriverManager.getConnection(BankConstant.DBURL,BankConstant.DBUSER, BankConstant.DBPASS);

        } 
        catch (ClassNotFoundException ce) 
        {
            ce.printStackTrace();
        } 
        catch (SQLException e) 
        {
            e.printStackTrace();
        } 
        catch (InstantiationException e)
        {
            e.printStackTrace();
        } 
        catch (IllegalAccessException e) 
        {
            e.printStackTrace();
        }
        return conn;
    }

}

//bean:

package com.ilp.tsi.um.bean;

public class BankBean {

private String userName;
private String password;

public String getUsername(){
    return userName;

}
public void setUsername(String username){
    userName=username;
}
public String getPassword(){
    return password;

}
public void setPassword(String password){
    this.password=password;
}
}

//service:

package com.ilp.tsi.um.service;


    import java.sql.Connection;

    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;

    import com.ilp.tsi.um.bean.BankBean;

    public class BankService {
         //To Perform login authentication of Administrator
        public boolean authenticate(BankBean loginBean, Connection connection)
                throws SQLException {

            try {
                String Username = loginBean.getUsername();
                String Password = loginBean.getPassword();

                Statement statement = connection.createStatement();
                // Executing required select query using Statement
                ResultSet rs = statement.executeQuery("select * from adminlogin  where username='"+Username+"' and  password='"+Password+"'");
                // Iterating resultset for the data from table
                if (rs.next()) {
                    return true;
                    // end if 
                } else {
                    return false;
                } // end else

            } catch (SQLException sqle) {
                sqle.printStackTrace();
                connection.close();

            } // end catch 
            catch (Exception e) {
                e.printStackTrace();
                connection.close();
            }// end catch 
            finally
            {
            connection.close();}
            return false;
        }// end finally


    }
View Answers









Related Tutorials/Questions & Answers:
DAO Classes
DAO Classes  login page code for Dao classes
DAO Example
DAO Example  Dear Friends Could any one please give me any example of DAO application in struts? Thanks & Regards Rajesh
Advertisements
DAO in Struts
DAO in Struts  Can Roseindia provide a simple tutorial for implementation of DAO with struts 1.2? I a link already exits plz do tell me. Thank you
DAO - JDBC
DAO  what is dao ? and how to use it?  Hi Friend, The DAO is a pattern that provides a technique for separating object persistence and data access logic from any particular persistence mechanism or API. Thanks
doubt on DAO's
doubt on DAO's  hai frnds.... can anyoneexplain about how... our own plugin????? and please help me. how to use dao s while integrating struts with hibernate..??? actually what is the purpose of dao's
doubt on DAO's
doubt on DAO's  hai frnds.... can anyoneexplain about how... our own plugin????? and please help me. how to use dao s while integrating struts with hibernate..??? actually what is the purpose of dao's
dao pack
dao pack  package com.tsi.dao; import java.sql.*; import com.tsi.constants.*; public class DaoPack { public static Connection conn = null; public static Connection createConnection() { try
dao pack
dao pack  package com.tsi.dao; import java.sql.*; import com.tsi.constants.*; public class DaoPack { public static Connection conn = null; public static Connection createConnection() { try
dao
ModuleNotFoundError: No module named 'dao'
ModuleNotFoundError: No module named 'dao'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'dao' How to remove the ModuleNotFoundError: No module named 'dao' error
ModuleNotFoundError: No module named 'dao'
ModuleNotFoundError: No module named 'dao'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'dao' How to remove the ModuleNotFoundError: No module named 'dao' error
CRUD DAO
CRUD DAO  how to create dao for create,read,update and delete?   /* *ConnectionManager * * *Version:1.0 * *Date:25-Nov-2011 * */ package com.student.dao; import java.sql.*; import org.apache.log4j.Logger
spring DAO module turorial
spring DAO module turorial  how to integrate springDAO and spring webMVC
Version of spring>spring-dao dependency
List of Version of spring>spring-dao dependency
Version of springframework>spring-dao dependency
List of Version of springframework>spring-dao dependency
Version of co.jufeng>jufeng-dao dependency
List of Version of co.jufeng>jufeng-dao dependency
Version of com.aoindustries>ao-dao dependency
List of Version of com.aoindustries>ao-dao dependency
Version of com.butor>butor-dao dependency
List of Version of com.butor>butor-dao dependency
Version of com.ibatis>ibatis-dao dependency
List of Version of com.ibatis>ibatis-dao dependency
Version of com.smartitengineering>smart-dao dependency
List of Version of com.smartitengineering>smart-dao dependency
Version of com.enterprisemath>em-dao dependency
List of Version of com.enterprisemath>em-dao dependency
What is the DAO Layer in any application?
What is the DAO Layer in any application?  Hi, What is the use of the DAO layer in any application and how to develop it. Explain with the example code. Thanks   The DAO layer is also known as data access layer
ModuleNotFoundError: No module named 'worm-dao'
ModuleNotFoundError: No module named 'worm-dao'  Hi, My Python... 'worm-dao' How to remove the ModuleNotFoundError: No module named 'worm-dao... to install padas library. You can install worm-dao python with following
ModuleNotFoundError: No module named 'dao-deploy'
ModuleNotFoundError: No module named 'dao-deploy'  Hi, My Python... 'dao-deploy' How to remove the ModuleNotFoundError: No module named 'dao... have to install padas library. You can install dao-deploy python
ModuleNotFoundError: No module named 'SQLAlchemy-Dao'
ModuleNotFoundError: No module named 'SQLAlchemy-Dao'  Hi, My... named 'SQLAlchemy-Dao' How to remove the ModuleNotFoundError: No module named 'SQLAlchemy-Dao' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'worm-dao'
ModuleNotFoundError: No module named 'worm-dao'  Hi, My Python... 'worm-dao' How to remove the ModuleNotFoundError: No module named 'worm-dao... to install padas library. You can install worm-dao python with following
ModuleNotFoundError: No module named 'dao-deploy'
ModuleNotFoundError: No module named 'dao-deploy'  Hi, My Python... 'dao-deploy' How to remove the ModuleNotFoundError: No module named 'dao... have to install padas library. You can install dao-deploy python
implementing DAO - Struts
, exam in 3 days, and just now i found out our lecturer post a demo on DAO... divided into DAO factory Impl,employeeDAOImpl,DAOFactory,EmployeeDAO. "I strongly... writing DAO Implementation classes." This is her advice. But as a beginner who just
DAO DTO design pattern
DAO DTO design pattern  Hi,using dao and dto i want to perform insert,update and delete operation.and the data should navigate from 1 frame 2 another.that page should b smthng like this: <%@ page language="java" import
DAO DTO design pattern
DAO DTO design pattern  Hi,using dao and dto i want to perform insert,update and delete operation.and the data should navigate from 1 frame 2 another.that page should b smthng like this: <%@ page language="java" import
DAO DTO design pattern
DAO DTO design pattern  Hi,using dao and dto i want to perform insert,update and delete operation.and the data should navigate from 1 frame 2 another.that page should b smthng like this: <%@ page language="java" import
DAO DTO design pattern
DAO DTO design pattern  Hi,using dao and dto i want to perform insert,update and delete operation.and the data should navigate from 1 frame 2 another.that page should b smthng like this: <%@ page language="java" import
how to create dao
how to create dao   code1: package com.dao; import java.sql.*; import com.beans.*; public class DbAccess { public void createStudent(SampleBean sampleBean) throws SQLException { Connection con=null; try
Version of com.butor>butor-auth-dao dependency
List of Version of com.butor>butor-auth-dao dependency
Version of com.butor>butor-attrset-dao dependency
List of Version of com.butor>butor-attrset-dao dependency
Version of com.butor>butor-portal-dao dependency
List of Version of com.butor>butor-portal-dao dependency
Version of com.erudika>para-dao-mongodb dependency
List of Version of com.erudika>para-dao-mongodb dependency
Version of com.gammapeit>generic-injected-dao dependency
List of Version of com.gammapeit>generic-injected-dao dependency
Version of com.smartitengineering>smart-abstract-dao dependency
List of Version of com.smartitengineering>smart-abstract-dao dependency
DAO Layer explained
DAO Layer explained       In this section we will explain you the DAO Layer of our application.   DAO Layer Explained  ADS_TO_REPLACE_1 DAO
DAO,DTO,VO Design patterns
DAO,DTO,VO Design patterns  explain dao,dto,vo design patterns in strut 1.3?   Data Access Object (DAO) pattern is the most popular design patterns. It is used when you want to separate your presentation code from
ModuleNotFoundError: No module named 'rds-data-dao'
ModuleNotFoundError: No module named 'rds-data-dao'  Hi, My Python... 'rds-data-dao' How to remove the ModuleNotFoundError: No module named 'rds-data-dao' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'rds-data-dao'
ModuleNotFoundError: No module named 'rds-data-dao'  Hi, My Python... 'rds-data-dao' How to remove the ModuleNotFoundError: No module named 'rds-data-dao' error? Thanks   Hi, In your python
how to login form through spring dao module
how to login form through spring dao module  here i want to chek user details in database through form by using spring dao module.please give me some reference example to me
Maven Dependency spring-dao >> 1.0.2
You should include the dependency code given in this page to add Maven Dependency of spring >> spring-dao version1.0.2 in your project
Maven Dependency spring-dao >> 1.0
You should include the dependency code given in this page to add Maven Dependency of springframework >> spring-dao version1.0 in your project
Maven Dependency spring-dao >> 1.0.1
You should include the dependency code given in this page to add Maven Dependency of springframework >> spring-dao version1.0.1 in your project
Maven Dependency spring-dao >> 1.0-rc1
You should include the dependency code given in this page to add Maven Dependency of springframework >> spring-dao version1.0-rc1 in your project
Maven Dependency spring-dao >> 1.1
You should include the dependency code given in this page to add Maven Dependency of springframework >> spring-dao version1.1 in your project
Maven Dependency spring-dao >> 1.1.1
You should include the dependency code given in this page to add Maven Dependency of springframework >> spring-dao version1.1.1 in your project

Ads