error oracle database connection?

error oracle database connection?

hi now i am trying to connect oracle database and also insert my data into table, but it's not working.. I created one user registration form. when i give values in the form, i want stored data in oracle table. my table name is logininfoclient_sla. this is my coding:

newuser_db.java

package com.sla;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.PreparedStatement;


import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 * Servlet implementation class newuser_db
 */
public class newuser_db extends HttpServlet {
    private static final long serialVersionUID = 1L;
    PreparedStatement stmt=null;
    Connection con =null;
    ResultSet rs=null;


    /**
     * @see HttpServlet#HttpServlet()
     */
    public newuser_db() {
        super();
        // TODO Auto-generated constructor stub
    }
    @Override
    public void init() throws ServletException {
        // TODO Auto-generated method stub
        super.init();
        try
        {
            Class.forName("sun.Jdbc.Odbc.JdbcOdbcDriver");
        }
        catch (ClassNotFoundException ex)
        {
            ex.printStackTrace();
        }


        try
        {
            con =DriverManager.getConnection("Jdbc:odbc:servletdb","system","balaji");

        }
        catch(SQLException ex)
        {
            ex.printStackTrace();
        }



        // TODO Auto-generated method stub
    }

    @Override
    public void service(ServletRequest arg0, ServletResponse arg1)
            throws ServletException, IOException {
        // TODO Auto-generated method stub
        super.service(arg0, arg1);
        PrintWriter out=arg1.getWriter();
        String s1=arg0.getParameter("USERID");
        String s2=arg0.getParameter("FIRSTNAME");
        String s3=arg0.getParameter("LASTNAME");
        String s4=arg0.getParameter("EMAILID");
        String s5=arg0.getParameter("ORGNAME");
        String s6=arg0.getParameter("MOBILENO");
        String s7=arg0.getParameter("PHONENO");
        String s8=arg0.getParameter("PASSWORD");

        out.println("inserted");
        out.println(s1);




        out.println("inserted1");
        //String sql="insert into userdetails values(ka.nextval,"+s1+","+s2+","+s3+","+s4+","+s5+","+s6+","+s7+",56,'de',01-jan-98)";
        PreparedStatement stmt1;
        try {
            stmt1 = con.prepareStatement("insert into login_info_client_sla values(?,?,?,?,?,?,?,?)");
            stmt1.setString(1,s1);
            stmt1.setString(2,s2);
            stmt1.setString(3,s3);
            stmt1.setString(4,s4);
            stmt1.setString(5,s5);
            stmt1.setString(6,s6);
            stmt1.setString(7,s7);
            stmt1.setString(8,s8);


            //stmt1.executeUpdate();
            out.println("inserted2");
            stmt1.executeUpdate();
            out.println("inserted3");
        } catch (SQLException e1) {
            // TODO Auto-generated catch block
        out.println(e1);

        }


    }
    @Override
    public void destroy() {
        // TODO Auto-generated method stub
        super.destroy();
        try
        {
            if(stmt!=null)
                stmt.close();
            stmt=null;

        }
        catch (SQLException ex)
        {
            ex.printStackTrace();
        }
        try
        {
            if(con!=null)
                con.close();
            con=null;

        }
        catch (SQLException ex)
        {
            ex.printStackTrace();
        }
    }



    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
    }

}

desing jsp page; newuser_reg.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="newuser_db" method="post">
<center><font size="15" color="agenda">SLA Customer Details</font></center>
<table><tr><td>E-Mail id* </td><td>:</td> <td> <input type="text" value="" name="EMAILID"></input></td></tr>
<tr><td>First Name* </td><td>:</td> <td> <input type="text" value="" name="FIRSTNAME"></input></td></tr>
<tr><td>Last Name* </td><td>:</td> <td> <input type="text" value="" name="LASTNAME"></input></td></tr>
<tr><td>Org Name* </td><td>:</td> <td> <input type="text" value="" name="ORGNAME"></input></td></tr>
<tr><td>Password* </td><td>:</td> <td> <input type="text" value="" name="PASSWORD"></input></td></tr>
<tr><td>Mobile No* </td><td>:</td> <td> <input type="text" value="" name="MOBILENO"></input></td></tr>
<tr><td>Phone* </td><td>:</td> <td> <input type="text" value="" name="PHONENO"></input></td></tr>
<tr><td></td><td><input type="submit" value="Add"/></td></tr>
</table>



</form>
</body>
</html>

please help me.....i am new for this application.....

View Answers









Related Tutorials/Questions & Answers:
how to connection jsp to oracle database connections in netbeans ide
how to connection jsp to oracle database connections in netbeans ide
Advertisements
error oracle database connection?
Oracle Database error - JDBC
error in uploading image from jsp to oracle 10g database
maximum limit of database connections have been reached.
maximum limit of database connections have been reached.
storing csv into oracle database
File insertion into oracle database
java with Oracle Database
Spring and Oracle Database
Oracle Database connectivity probem
error occured in oracle - JDBC
oracle insert statement error - JDBC
Connecting Oracle database with struts - Struts
android connection to database oracle 10g
Oracle 9i database problem
About connection database oracle to java
About connection database oracle to java
About connection database oracle to java
About connection database oracle to java
About connection database oracle to java
Oracle Database - Insert System Time
write excel file into the oracle database
Java Connection to Oracle database
oracle database backup using jsp
Database Connectivity Withe Oracle
jsp with database oracle
error at the oracle programm with jsp - JSP-Servlet
Java Barcode Program with Oracle database
How to connect to the database to my application if my database is made up in oracle
store & retrive the image from oracle database
java.sql.SQLException: Network error IOException: No buffer space available (maximum connections reached?): connect
related retrieving value from oracle database
related retrieving value from oracle database
How sql Queries possible in DAO without creating Database connections - Java Beginners
REQ for connection b/w jdbc and oracle database
OCI Connectivity For Oracle Plz Solve This Error
OCI Connectivity For Oracle Plz Solve This Error
Database error - WebSevices
Applet to database error - Applet
Database Error - Hibernate
Error with LogIn with mysql database
java database error - JDBC
connection database error
error log and send Database
unable to get datas from oracle database
insert user session into other oracle database table
How to connect to database to my application if the database is made up in oracle
Dropdown code to retrieve result from oracle database

Ads