I am trying to register new users to my database using jsp. When i do i get this error java.lang.NullPointerException
From this page i enter the variable to the database
<%@page import="storage.data"%>
<%
String ps="";
String v_name="";
v_name =request.getParameter("vname");
ps=request.getParameter("pass");
data dt=new data();
out.println(v_name + ps);
try{
dt.st=dt.cn.createStatement();
out.println("1");
String insert="insert into voters values(myseq_voters.nextval,'"+v_name+"','"+ps+"',sysdate)";
out.println("2");
dt.st.executeUpdate(insert);
out.println("3");
//response.sendRedirect("adduser.jsp?usad="+1);
}
catch(Exception ex){
out.println(ex);
}
%>
And this is my code to connect it to the database
package storage;
import java.sql.*;
public class data {
public Connection cn;
public Statement st;
public ResultSet rs;
public data()
{
try{
Class.forName("oracle.jdbc.OracleDriver");
//cn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","mustafadb","111");
//jdbc:oracle:thin:@localhost:1521:XE [system on Default schema]
cn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","voter_db","111");
}
catch(Exception ex){}
}
}