Hi

Thanks for your reply now i removed SQL stuff . My problem is I had created
one Procedure in MS SQL it will take one String after that it will give one
string. suppose if user inputs string like ddsd dsdsds then it will give
like ddsd_dsdsds. so my procedure name is headitemcode,So please tell me how
to do this.....

<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 url="jdbc:odbc:Inventory";
   Connection con=DriverManager.getConnection(url, "sa", "");
   Statement stmt = con.createStatement();
  /* till here above code is ok*/

  /*bellow i am calling the procedure here i wanted to pass user inputted
string(headitem_name)
     then procedure will give the result string fdfff_ffdf this one i want
to insert into the table  */

    please tell me how pass the user input string like  fdfff ffdf  to
CallableStatement
    and how get the result string which is given by procedure fdfff_ffdf
and then how to insert
    this in to table

    CallableStatement cstmt1 = con.prepareCall("{call headitemcode(?)}");

 /* here is the insert statement  in the bellow insted of +@s6 this i ahve
to pass the result string fdfff_ffdf  */

  String query1 ="insert into
dbo.head_item1(headitem_code,headitem_name,clasification_name,clasification_
code)";
  String query2 ="values('" +@s6+"','" +headitem_name+ "','" +clasi_name1+
"')";
  int rowsAffected = stmt.executeUpdate(query1+query2);

Thanks in advance
-Suresh


> Wow, that's quite a mess. (no pun intended). It seems you have mixed up
> MSSQL TSQL and JDBC stuffs altogether in a JSP file.
> I think you should create a Stored Procedure first, then in your JSP file
> call it using CallableStatement.execUpdate().
> Or remove the TSQL stuffs (like declare, select @var, begin..end
> combination) and replace them with valid JSP/Java stuffs
>
> Just my 2 cents. ;)
>
> Mio Nino P. Marquez
> (JSP/Servlet/Java Newbie)
>
> ----- Original Message -----
> From: "Suresh kumar K Badiga" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, December 11, 2000 1:51 PM
> Subject: Re: help on JSP
>
>
> > Hi MJ
> >
> > These are the errors i am getting plese help me ......
> >
>
****************************************************************************
> > ***************************
> > Error: 500
> >
> > Location: /jspproj/addheaditem.jsp
> >
> > Internal Servlet Error:
> >
> > org.apache.jasper.JasperException: Unable to compile class for
> >
>
JSPC:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspad
> > dheaditem_jsp_0.java:94: ';' expected.
> >                         declare
> >                                ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:95: Invalid character in input.
> >                         @s1 varchar(100),
> >                         ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:96: Invalid character in input.
> >                         @s2 varchar(100),
> >                         ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:97: Invalid character in input.
> >                         @s3 varchar(100),
> >                         ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:98: Invalid character in input.
> >                         @s4 varchar(100),
> >                         ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:99: Invalid character in input.
> >                         @s5 varchar(100),
> >                         ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:100: Invalid character in input.
> >                         @s6 varchar(100),
> >                         ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:101: Invalid character in input.
> >                         @count int
> >                         ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:103: Invalid character in input.
> >                         select @count = 0
> >                                ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:104: Invalid character in input.
> >                         select @s1 = '%clasi_name1%'
> >                                ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:104: Invalid character constant.
> >                         select @s1 = '%clasi_name1%'
> >                                      ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:105: Invalid character in input.
> >                         select @s3 = '%clasi_name3%'
> >                                ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:105: Invalid character constant.
> >                         select @s3 = '%clasi_name3%'
> >                                      ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:106: Invalid character in input.
> >                         select @s4 = '%clasi_name4%'
> >                                ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:106: Invalid character constant.
> >                         select @s4 = '%clasi_name4%'
> >                                      ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:107: Invalid character in input.
> >                         select @s5 = '%clasi_name5%'
> >                                ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:107: Invalid character constant.
> >                         select @s5 = '%clasi_name5%'
> >                                      ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:108: Invalid character in input.
> >                         select @s6 = '%headitem_name%'
> >                                ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:108: Invalid character constant.
> >                         select @s6 = '%headitem_name%'
> >                                      ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:110: Invalid character in input.
> >                         declare @i6 int
> >                                 ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:111: Invalid character in input.
> >                         select @i6 = 1
> >                                ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:117: Invalid character in input.
> >                         String query2 ="values('" +@s6+"','"
> +headitem_name+
> > "','" +clasi_name1+ "','" +@s1+ "')";
> >                                                    ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:117: Invalid character in input.
> >                         String query2 ="values('" +@s6+"','"
> +headitem_name+
> > "','" +clasi_name1+ "','" +@s1+ "')";
> >
> > ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:120: Invalid character in input.
> >                         String query4 ="values('" +@s6+ "','"
> > +headitem_name+ "','" +clasi_name2+ "','" +@s2+ "')";
> >                                                    ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:120: Invalid character in input.
> >                         String query4 ="values('" +@s6+ "','"
> > +headitem_name+ "','" +clasi_name2+ "','" +@s2+ "')";
> >
> > ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:123: Invalid character in input.
> >                         String query6 ="values('" +@s6+ "','"
> > +headitem_name+ "','" +clasi_name3+ "','" +@s3+ "')";
> >                                                    ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:123: Invalid character in input.
> >                         String query6 ="values('" +@s6+ "','"
> > +headitem_name+ "','" +clasi_name3+ "','" +@s3+ "')";
> >
> > ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:126: Invalid character in input.
> >                         String query8 ="values('" +@s6+ "','"
> > +headitem_name+ "','" +clasi_name4+ "','" +@s4+ "')";
> >                                                    ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:126: Invalid character in input.
> >                         String query8 ="values('" +@s6+ "','"
> > +headitem_name+ "','" +clasi_name4+ "','" +@s4+ "')";
> >
> > ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:130: Invalid character in input.
> >                         String query10 ="values('" +@s6+ "','"
> > +headitem_name+ "','" +clasi_name5+ "','" +@s5+ "')";
> >                                                     ^
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > aditem_jsp_0.java:130: Invalid character in input.
> >                         String query10 ="values('" +@s6+ "','"
> > +headitem_name+ "','" +clasi_name5+ "','" +@s5+ "')";
> >
> > ^
> > 31 errors
> >
> >         at
org.apache.jasper.compiler.Compiler.compile(Compiler.java:247)
> >         at
> org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
> >         at
> >
>
org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
> > rvlet.java:149)
> >         at
> >
>
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
> > va:161)
> >         at
> > org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
> >         at
> org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> >         at
> >
>
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
> >         at
> > org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
> >         at
> >
>
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
> > onnectionHandler.java:160)
> >         at
> >
>
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
> > )
> >         at java.lang.Thread.run(Unknown Source)
> >
>
>
===========================================================================
> 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