Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JDBC save data DAO

Have Programming Question? Ask it here!
 
 
 


Mumbai
save data DAO
1 Answer(s)      11 months ago
Posted in : JDBC


how to save data in db


Advertisement
View Answers

May 22, 2013 at 11:21 AM


package com.tcs.ignite.dao;

import com.tcs.ignite.bean.User;
import com.tcs.ignite.connection.Connectiondetails;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author ignite234
 */
public class UserDAO {

    private Connectiondetails connectionDetails;

    public UserDAO() {
        connectionDetails = new Connectiondetails();
    }

    public boolean saveDetails(User user) {
        connectionDetails.openConnection();
        String query2 = "select * from user where Email_id like '%" + user.getEmail() + "%'";
        try {
            ResultSet resultSet = connectionDetails.statement.executeQuery(query2);
            if(resultSet.next()) {
                return false;
            }
        } catch (SQLException ex) {
            Logger.getLogger(UserDAO.class.getName()).log(Level.SEVERE, null, ex);
        }
        String query = "insert into user (Name,Email_id,Password,Gender,Hobby,City) values('" + user.getName() + "','" + user.getEmail() + "','" + user.getPassword() + "','" + user.getGender() + "','" + user.getHobby() + "','"+user.getCity()+"');";
        try {
            int result = connectionDetails.statement.executeUpdate(query);
            if (result == 0) {
                return false;
            }
        } catch (SQLException ex) {
            Logger.getLogger(UserDAO.class.getName()).log(Level.SEVERE, null, ex);
            return false;
        } finally {
            connectionDetails.closeConnection();
        }
        return true;
    }


Related Tutorials/Questions & Answers:
save data DAO
save data DAO  how to save data in db   package com.tcs.ignite.dao; import com.tcs.ignite.bean.User; import com.tcs.ignite.connection.Connectiondetails; import java.sql.ResultSet; import java.sql.SQLException; import
save data in excel
save data in excel  hello sir, i'm new to this field i want to know can i save data in excel by html forms input,means if any one fill up form online then it is save offline in excel how can i do it can you give me solution sir
Advertisements
save data in excel
save data in excel  hello sir, i'm new to this field i want to know can i save data in excel by html forms input,means if any one fill up form online then it is save offline in excel how can i do it can you give me solution sir
Creating Data Access Object (DAO) Design Pattern
Creating Data Access Object (DAO) Design Pattern Data Access Object... to separating the object persistence and data access logic. All the basic data access code contains in  DAO and it provides a simple interface to access the data
dao
+"' and password='"+Password+"'"); // Iterating resultset for the data
How to display data in jsp from dao using java beans?
How to display data in jsp from dao using java beans?  Hi I need to display data in jsp pulling from dao using java beans, Please can anyone give me the sample application with above topics. Any help would be highly appreciated
How to save data - Swing AWT
How to save data  Hi, I have a problem about how to save data ,but first before data save to dababase, data must view in jLisit or Jtable... save data from jList and Jtable(in jList or jTable data will be many).Thank's
How to save database data into excelsheet using hibernate
How to save database data into excelsheet using hibernate  How to save database data into excelsheet using hibernate
Data Access object (DAO) Design Pattern
. The DAO design pattern completely  hides the data access implementation... and some DAO classes to implement those interfaces.   The Data Access object...; } .style3 { background-color: #FFFFCC; } Data Access Object Pattern Data Access
To save table format data in pdf/excel in jsp
To save table format data in pdf/excel in jsp  Hello, I am doing web... table. So my question is ,I want so save this html format data in pdf/excel format... can save html table data in pdf/excel format.Your inputs are valuable to me
Save the input data until user get changed
Save the input data until user get changed  I would like to know how to store the give input data and perform the calculations even after re-opening... and save this amount until he changes it again. Thank You
How can we save a data list in jsf?
How can we save a data list in jsf?  I have a code in jsf that fires a query in Data Base each time it is called, i have added a validation check... it is called again. I tried using save State but it did not help as other functions got
Save the input data until user get changed
Save the input data until user get changed  I would like to know how to store the give input data and perform the calculations even after re-opening... and save this amount until he changes it again. Thank You
Save the input data until user get changed
Save the input data until user get changed  I would like to know how to store the give input data and perform the calculations even after re-opening... and save this amount until he changes it again. 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
save switch data into database - Java Beginners
save switch data into database  switch(menu) { case 1://add a student System.out.print("Enter student ID: "); int ID = scan.nextInt(); System.out.print("Enter your name: "); String name = scan.next(); break
SQLGrammarException while trying to save data in db
SQLGrammarException while trying to save data in db  //hibernate cfg file// <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN
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
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
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 ????? please help
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 ????? please help
How to save data to excel with a 2.1 work sheet format without changing it?
How to save data to excel with a 2.1 work sheet format without changing it?  hi , i have done a program that allows user to inout data through jtable and save it to excel file then read it again .. the problem is , when data
How to save form data to a csv file using jquery or ajax
How to save form data to a csv file using jquery or ajax  Please let...) {// code for IE7+, Firefox, Chrome, Opera, Safari data=new XMLHttpRequest(); } else {// code for IE6, IE5 data=new ActiveXObject
how to save html form data into .csv file using only jsp.
how to save html form data into .csv file using only jsp.  Dear all, I am developing a website only using jsp and html. i need to save the form data...:\\File.xls"); wb.write(fileOut); fileOut.close(); out.println("Data is saved
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
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
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...;/br> <input type="submit" name="Submit" value="Save">
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...;/br> <input type="submit" name="Submit" value="Save">
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...;/br> <input type="submit" name="Submit" value="Save">
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...;/br> <input type="submit" name="Submit" value="Save">
implementing DAO - Struts
. The Data Access Object (DAO) is an important component in business applications... Access Object (DAO) to abstract and encapsulate all access to the data source. The DAO manages the connection with the data source to obtain and store data
spring DAO module turorial
spring DAO module turorial  how to integrate springDAO and spring webMVC
How to download web page table data, export the table records in an excel file and save
be displayed and ask me to save the file. on clicking the save button the data should...How to download web page table data, export the table records in an excel file and save  i have a web page(.jsp) which contains the table of 4 to 5
DAO Layer explained
application.   DAO Layer Explained   DAO stand for Data...;  Data Access Object   The DAO centralize all... class gives the data on which operation is performed. Finally DAO class performs
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... the code that accesses the back-end containing your data. Data Transfer Object (DTO
How to read data from txt file and save to database MySql - Java Beginners
How to read data from txt file and save to database MySql  Please help me again ,my problem right know is how to read data from txt file then data save to database from JButton.Please give me a tutorial and source code
How to Validate JRadioButton and How to Save data from JRadioButton to MS Access Database - Java Beginners
How to Validate JRadioButton and How to Save data from JRadioButton to MS Access Database  Hello Sir I want Store Corse Type that contains Two...(3,g); int i=st.executeUpdate(); JOptionPane.showMessageDialog(null,"Data
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
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
Hibernate save()
This tutorial explain how save() works in hibernate
upload and save the file
upload and save the file  upload and save a file from a computer to specific location of remote computer using jsp
save excel file with save and open dilog box
save excel file with save and open dilog box  following is my jsp code it is working correct.. i want to save excel file throgh jsp bt not by hard...");) user should have freedom to save the file in any location so plz give me
Understanding Spring Struts Hibernate DAO Layer
Hibernate DAO Layer   The Data Access Object for this application is written... Understanding Spring Struts Hibernate DAO Layer... management, updating, insertion and deletion of data very easily.  
How to connect to dao n bean classes with jsp
How to connect to dao n bean classes with jsp  I have made this edao pkg package edao; import java.sql.Connection; import...; public boolean save_add(Add_Village ad) { try
Save Table - SQL
Save Table  Where Oracle Tables or Database is saved? How to see Oracle Tables ? What are the websites to learn step by step Oracle. Help Me
How to save value in JSP
How to save value in JSP  Employee Name Time-IN Time-OUT Date t1 9 7 2012-12-12 t2... 324 2012-12-12 save i want to save dis value jsp to action ...how
 

 

 

DMCA.com