/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package cmc;
import java.sql.*;
/**
*
* @author Sahil
*/
public class signup {
String fn,ln,un,pwd,cpwd,dob,sex,email,sec,secans;
String emp,colg,skul,relstat,fammem,fam,con,country,state,city,pin;
Connection cn;
Statement st;
int i,j,k;
public int getI() {
return i;
}
public int getJ() {
return j;
}
public int getK() {
return k;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getColg() {
return colg;
}
public void setColg(String colg) {
this.colg = colg;
}
public String getCon() {
return con;
}
public void setCon(String con) {
this.con = con;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getCpwd() {
return cpwd;
}
public void setCpwd(String cpwd) {
this.cpwd = cpwd;
}
public String getDob() {
return dob;
}
public void setDob(String dob) {
this.dob = dob;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getEmp() {
return emp;
}
public void setEmp(String emp) {
this.emp = emp;
}
public String getFam() {
return fam;
}
public void setFam(String fam) {
this.fam = fam;
}
public String getFammem() {
return fammem;
}
public void setFammem(String fammem) {
this.fammem = fammem;
}
public String getFn() {
return fn;
}
public void setFn(String fn) {
this.fn = fn;
}
public String getLn() {
return ln;
}
public void setLn(String ln) {
this.ln = ln;
}
public String getPin() {
return pin;
}
public void setPin(String pin) {
this.pin = pin;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
public String getRelstat() {
return relstat;
}
public void setRelstat(String relstat) {
this.relstat = relstat;
}
public String getSec() {
return sec;
}
public void setSec(String sec) {
this.sec = sec;
}
public String getSecans() {
return secans;
}
public void setSecans(String secans) {
this.secans = secans;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getSkul() {
return skul;
}
public void setSkul(String skul) {
this.skul = skul;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getUn() {
return un;
}
public void setUn(String un) {
this.un = un;
}
public boolean insert()
{
boolean b=false;
if((fn!=null)&&(ln!=null)&&(un!=null)&&(pwd!=null)&&(cpwd!=null)&&(dob!=null)&&(sex!=null)&&(email!=null)&&(sec!=null)&&(secans!=null)&&(emp!=null)&&(con!=null)&&(country!=null)&&(state!=null)&&(city!=null)&&(pin!=null))
{
try
{
Class.forName("com.mysql.jdbc.Driver");
cn = DriverManager.getConnection("jdbc:mysql://localhost:3307/sns?user=root&password=iaminusit");
st=cn.createStatement();
int i=st.executeUpdate("insert into logdata values('"+fn+"','"+ln+"','"+un+"','"+pwd+"','"+dob+"','"+email+"','"+sec+"','"+secans+"')");
System.out.println(i);
cn = DriverManager.getConnection("jdbc:mysql://localhost:3307/sns?user=root&password=iaminusit");
st=cn.createStatement();
int j=st.executeUpdate("insert into contact values('"+con+"','"+country+"','"+state+"','"+city+"','"+pin+"')");
System.out.println(j);
cn = DriverManager.getConnection("jdbc:mysql://localhost:3307/sns?user=root&password=iaminusit");
st=cn.createStatement();
int k=st.executeUpdate("insert into personal values('"+dob+"','"+sex+"','"+emp+"','"+colg+"','"+skul+"','"+relstat+"','"+fammem+"','"+fam+"')");
System.out.println(k);
if(i==1&&j==1&&k==1)
{
b=true;
}
}
catch(Exception e)
{
System.out.print(e);
}
}
return b;
}
}
This is my bean class where query is executed??
Backslashes are added automatically in database,might be a string problem....plz help