don't understand what you are trying to do with the "?=call"  ??
Your Syntax is wrong!

try changing your preparecall statement, something like this ought to do it:

con.prepareCall("call headitemcode (?) ");


-----Original Message-----
From: Suresh kumar K Badiga [mailto:[EMAIL PROTECTED]]
Sent: 11 December 2000 12:03
To: [EMAIL PROTECTED]
Subject: help on CallableStatement


Hi All

When i execute this bellow code it is giveing the bellow error. plese tell
me how to comeout from this....

Could not EXECUTE procedure.... java.sql.SQLException: [Microsoft][ODBC SQL
Server Driver]Syntax error or access violation Could not EXECUTE
procedure....
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Syntax error or
access
violation

And one more thing is it is executin only one   String query1 , String
query2  rest of things are not executing.

Thanks in advance
-Suresh

my jsp page is
****************************************************************************
****************************
<html>
<head>
</head>
<%@ page language="java" import="java.sql.*" %>
<body>
<%
try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
   }
   catch(java.lang.ClassNotFoundException ex) { }
   String headitem_name      = request.getParameter("headitem_name");
   String clasi_name1        = request.getParameter("clasi_name1");
   String clasi_name2        = request.getParameter("clasi_name2");
   String clasi_name3        = request.getParameter("clasi_name3");
   String clasi_name4        = request.getParameter("clasi_name4");
   String clasi_name5        = request.getParameter("clasi_name5");
   String headitem_code = "";
   String clasi_code1 = "";
   String clasi_code2 = "";
   String clasi_code3 = "";
   String clasi_code4 = "";
   String clasi_code5 = "";
   String url="jdbc:odbc:Inventory";
   Connection con=DriverManager.getConnection(url, "sa", "");
   Statement stmt = con.createStatement();
       try
       {
 CallableStatement CStmt = con.prepareCall("{?=call headitemcode[?]}");
 CStmt.registerOutParameter(1,java.sql.Types.VARCHAR);
        CStmt.setString(1,headitem_name);
 CStmt.executeUpdate();
 headitem_code = CStmt.getString(1);

       }
       catch (Exception e)
       {
         out.println("Could not EXECUTE procedure....");
         out.println(e.toString());
       }
        try
       {
        CallableStatement CStmt1 = con.prepareCall("{?=call
subitemcode[?,?,?,?,?]}");
 CStmt1.registerOutParameter(1,java.sql.Types.VARCHAR);
 CStmt1.registerOutParameter(2,java.sql.Types.VARCHAR);
 CStmt1.registerOutParameter(3,java.sql.Types.VARCHAR);
 CStmt1.registerOutParameter(4,java.sql.Types.VARCHAR);
 CStmt1.registerOutParameter(5,java.sql.Types.VARCHAR);
 CStmt1.setString(1,clasi_name1);
 CStmt1.setString(2,clasi_name2);
 CStmt1.setString(3,clasi_name3);
 CStmt1.setString(4,clasi_name4);
 CStmt1.setString(5,clasi_name5);
 CStmt1.executeUpdate();
 clasi_code1 = CStmt1.getString(1);
 clasi_code2 = CStmt1.getString(2);
 clasi_code3 = CStmt1.getString(3);
 clasi_code4 = CStmt1.getString(4);
 clasi_code5 = CStmt1.getString(5);
        }
       catch (Exception e)
       {
         out.println("Could not EXECUTE procedure....");
         out.println(e.toString());
       }
 String query1 ="insert into
dbo.head_item1(headitem_code,headitem_name,clasification_name,clasification_
code)";
 String query2 ="values('" +headitem_code+"','" +headitem_name+ "','"
+clasi_name1+ "','" +clasi_code1+ "')";

 String query3 ="insert into
dbo.head_item1(headitem_code,headitem_name,clasification_name,clasification_
code)";
 String query4 ="values('" +headitem_code+ "','" +headitem_name+ "','"
+clasi_name2+ "','" +clasi_code2+ "')";

 String query5 ="insert into
dbo.head_item1(headitem_code,headitem_name,clasification_name,clasification_
code)";
 String query6 ="values('" +headitem_code+ "','" +headitem_name+ "','"
+clasi_name3+ "','" +clasi_code3+ "')";

 String query7 ="insert into
dbo.head_item1(headitem_code,headitem_name,clasification_name,clasification_
code)";
 String query8 ="values('" +headitem_code+ "','" +headitem_name+ "','"
+clasi_name4+ "','" +clasi_code4+ "')";

 String query9  ="insert into
dbo.head_item1(headitem_code,headitem_name,clasification_name,clasification_
code)";
 String query10 ="values('" +headitem_code+ "','" +headitem_name+ "','"
+clasi_name5+ "','" +clasi_code5+ "')";

   int rowsAffected =
stmt.executeUpdate(query1+query2+query3+query4+query5+query6+query7+query8+q
uery9+query10);

   if (rowsAffected ==1)
   {

%>

  <H1> Successful Addition of Head Item </h1>

<% }
   else
      {
%>

  <H1> Sorry , Head Item Addition has failed. </h1>

<%

      }
   stmt.close();
   con.close();

%>

</body>
</html>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to