Results 1 to 2 of 2
  1. #1
    vknehra10 is offline Senior Member
    Join Date
    Dec 2016
    Rep Power

    Default values are not store in Database

    Java Code:
            <title>TODO supply a title</title>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <form action="Register" method="post">
                enter user <input type="text" name="user" value="" /><br/>
                Password <input type="password" name="passwd" value="" />
                <!-- <input type="submit" name="" value="Go" /> -->
                <button onclick="window.location.href='Register'">GO</button>

    Java Code:
    public void doPost(HttpServletRequest req,HttpServletResponse res)throws IOException,ServletException{
            PrintWriter pw=res.getWriter();
              String us="vknehra10";
            String ps="vivek";  
            String u=req.getParameter("user");
            String p=req.getParameter("passwd");
    Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","password");
    PreparedStatement pst=con.prepareStatement("insert into registered_user values(?,?,?,?,?)");
    int i=pst.executeUpdate();
    pw.println("You r registered");
    catch(Exception ex){


    java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    at org.apache.catalina.loader.WebappClassLoaderBase.l oadClass(
    at org.apache.catalina.loader.WebappClassLoaderBase.l oadClass(
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(
    at Register.doPost(
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:648)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:729)
    at ternalDoFilter(
    at Filter(
    at org.apache.tomcat.websocket.server.WsFilter.doFilt er(
    at ternalDoFilter(
    at Filter(
    at org.netbeans.modules.web.monitor.server.MonitorFil ter.doFilter(
    at ternalDoFilter(
    at Filter(
    at org.apache.catalina.core.StandardWrapperValve.invo ke(
    at org.apache.catalina.core.StandardContextValve.invo ke(
    at org.apache.catalina.authenticator.AuthenticatorBas e.invoke(
    at org.apache.catalina.core.StandardHostValve.invoke(
    at org.apache.catalina.valves.ErrorReportValve.invoke (
    at org.apache.catalina.valves.AbstractAccessLogValve. invoke(
    at org.apache.catalina.core.StandardEngineValve.invok e(
    at org.apache.catalina.connector.CoyoteAdapter.servic e(
    at org.apache.coyote.http11.AbstractHttp11Processor.p rocess(
    at org.apache.coyote.AbstractProtocol$AbstractConnect ionHandler.process(
    at$SocketProce ssor.doRun(
    at java.util.concurrent.ThreadPoolExecutor.runWorker(
    at java.util.concurrent.ThreadPoolExecutor$ (
    at org.apache.tomcat.util.threads.TaskThread$Wrapping

    what's the issue


  2. #2
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    The Netherlands
    Rep Power

    Default Re: values are not store in Database

    It's in the first line of your stacktrace: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    Your server can't find the Oracle driver (See how that's right in there?). Add the ojdbc7.jar tor whatever driver jar you got from Oracle to the server's classpath. Read your server's manual to find out what's the preferred way to add a library. (Wildfly for example works with modules, which is a bit more work than just throwing a jar in a directory)

    Oh and setting the location with the button does not post the data to the server. Having a mix between the default button behaviour and setting onClick might lead to unexpected results.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

Similar Threads

  1. Replies: 3
    Last Post: 11-13-2014, 09:23 AM
  2. Replies: 43
    Last Post: 05-23-2014, 02:26 PM
  3. Read xml data with multiple attributes and store values
    By LiveStrong-2011 in forum New To Java
    Replies: 4
    Last Post: 06-08-2011, 01:45 AM
  4. Store values in arrays
    By ŖΫ ỏ Ңόρę in forum New To Java
    Replies: 1
    Last Post: 03-21-2010, 08:53 AM
  5. How to store extracted xml values in a database?
    By palanikumark in forum Advanced Java
    Replies: 6
    Last Post: 05-30-2008, 01:14 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts