title: SQLException : Missing defines in servlet
body: <p>I am working on a web application using jsp and servlet using oracle.jdbc.OracleDriver.This code,working fine on my PC,but when trying to deploy build of application on other server,i am getting Exception like this. </p>
  
  <pre><code>java.sql.SQLException: Missing defines
  at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:158)
  at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)
  at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:305)
  at oracle.jdbc.driver.OracleStatement.prepareAccessors(OracleStatement.java:793)
  at oracle.jdbc.driver.T4CResultSetAccessor.getCursor(T4CResultSetAccessor.java:235)
  at oracle.jdbc.driver.ResultSetAccessor.getObject(ResultSetAccessor.java:95)
  at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:1947)
  at org.apache.tomcat.dbcp.dbcp.DelegatingCallableStatement.getObject(DelegatingCallableStatement.java:143)
  at cwep.Login.processRequest(Login.java:127)
  at cwep.Login.doPost(Login.java:198)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
  at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:852)
  at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:584)
  at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1508)
  at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>After debugging my application,i found that when I am calling database(Oracle 10g) procedure on server side and getting cursor using <code>callableStatement.registerOutParameter(1,OracleTypes.CURSOR)</code>, I am getting  above Exception at 
      <code>callableStatement.execute();</code> statement.</p>
  
  <pre><code>protected void doPost(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
  static String CNPOOL = "cnpool";//Getting CNPOOL correctly for database connection
   CallableStatement cs = null;
   static DataSource dataSource;//Declared as global
          response.setContentType("text/html;charset=UTF-8");
  
              PrintWriter out = response.getWriter();
              CallableStatement cs = null;
              String str = conectionPool;
              System.out.println(str);
              try {
              InitialContext initContext = new InitialContext();
              Context context = (Context) initContext.lookup("java:/comp/env");
              dataSource = (DataSource) context.lookup(str);
              System.out.println(" CxN Pool " + str);
              String username = request.getParameter("username");
              String password = request.getParameter("password");
              ecode = Integer.parseInt(username);
              System.out.println(" eCode " + ecode);
              try {
                  con = ConnectionBean.getConnection(dataSource);
                  System.out.println(" CxN " + con.toString());
              } catch (Exception e) {
                  System.out.println(" Opening the Cxn 1st Time" + e);
              }
              if(con!=null)
              {
              System.out.println(" Before Calling proc_user_login " + ecode);
              cs = con.prepareCall("{call proc_user_login(?,?,?,?,?)}");
              cs.setInt(1, empcode);
              cs.setString(2, password);
              cs.registerOutParameter(3, Types.NUMERIC);
              cs.registerOutParameter(4, Types.NUMERIC);
              cs.registerOutParameter(5, Types.VARCHAR);
              try {
                  cs.execute();
              } catch (Exception e) {
                  System.out.println("--------------------After executing first proc----------------------- ");
              }
              int message = cs.getInt(3);
  
              if (message == 0) {
  
                  cs = con.prepareCall("{call proc_get_XXXlist(?,?)}");
                  cs.setInt(1, empcode);
                  cs.registerOutParameter(2, OracleTypes.CURSOR);
                  try {
                       System.out.println("Before executing XXXList proc ");
                      cs.execute();      //GETTING EXCEPTION AT THIS STATEMENT
                      System.out.println("After executing XXXList");
                  } catch (Exception e) {
                      System.out.println("exception in After executing secod proc ");
                  }
                  ResultSet rset = (ResultSet) cs.getObject(2);
                  Vector v1 = new Vector();
                  Vector v2 = new Vector();
                  Vector v3 = new Vector();
                  while (rset.next()) {       
                      v1.addElement(rset.getString(1));
                      v2.addElement(rset.getString(2));
                      v3.addElement(rset.getString(3));
                  }
                  //rset.last();
                  String[] str1 = new String[v1.size()];
                  String[] str2 = new String[v2.size()];
                  String[] str3 = new String[v3.size()];
                  v1.copyInto(str1);
                  v2.copyInto(str2);
                  v3.copyInto(str3);
  
                  request.setAttribute("ecode", Integer.toString(ecode));
                  request.setAttribute("clientid", str1);
                  request.setAttribute("constring", str2);
                  request.setAttribute("URL", str3);
                  RequestDispatcher rd = request.getRequestDispatcher("XXX.jsp");
  
                  rd.forward(request, response);
                  //response.sendRedirect("XXX.jsp");
              } else {
                  response.sendRedirect("index.jsp?val=" + message);
              }
  
              }
          } catch (Exception e) {
              e.printStackTrace();
              System.out.println("EEE---" + e);
              Utility.log("FinalExceptionToServlet.namelookup:", e.toString(), "SERVER", "E");
          }
      }
  </code></pre>
  
  <p>In this code,First database login_usr procedure execute properly,but when trying to execute 2nd procedure,which returns a cursor as outparameter,i'm getting above exception.If same code working fine on my PC,then why it throws exception when trying to execute callablestatement after Serverside deployment.Here I'm using Ojdbc14.jar and classes12.jar.Is there is any .jar missmatch..???</p>
  
  <p>Thanks in advance.</p>