Thanks Neil,
even with only one parameter it doesn't work.
it keeps throwing:

javax.servlet.ServletException: Syntax error or access violation: You have
an error in your SQL syntax near '?)' at line 1

when i replace ? with '?'  it throws:
java.lang.ArrayIndexOutOfBoundsException
        at org.gjt.mm.mysql.PreparedStatement.set(PreparedStatement.java:1192)
        at
org.gjt.mm.mysql.PreparedStatement.setString(PreparedStatement.java:581)

It is very strange , isn't it?

----- Original Message -----
From: "DL Neil" <[EMAIL PROTECTED]>
To: "yilmaz" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, November 20, 2001 7:29 PM
Subject: Re: why doesn't prepared statement work?


> Yilmaz,
> Recommend you simplify. Test on (say) the first five fields, then the next
five,... and try to work out which
> field is causing the issue, then analyse by narrowing down until you
figure it out.
> The data value (in the (?,?,?,...) list, must be formatted to suit the
type in the column list.
> Regards,
> =dn
>
> ----- Original Message -----
> From: "yilmaz" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: 20 November 2001 10:18
> Subject: Re: why doesn't prepared statement work?
>
>
> > Thanks Hans,
> > when i replcaed  ? with "?" , this time i ma having
> >
> > java.lang.ArrayIndexOutOfBoundsException
> > at org.gjt.mm.mysql.PreparedStatement.set(PreparedStatement.java:1192)
> > at
> > org.gjt.mm.mysql.PreparedStatement.setString(PreparedStatement.java:581)
> >
> > error message.
> > However, i am sure there are exactly 19 fieldnames  and 19 "?"s, also in
the
> > database there
> > are 19 columns exactly matching the filednames.
> > what could be wrong now?
> >
> >
> > ----- Original Message -----
> > From: "Hans" <[EMAIL PROTECTED]>
> > To: "yilmaz" <[EMAIL PROTECTED]>
> > Sent: Wednesday, November 21, 2001 8:48 AM
> > Subject: Re: why doesn't prepared statement work?
> >
> >
> > > maybe u should use '?' instead of ?.
> > > Btw, isn't that special char which need function htmlspecialchars() ?
> > >
> > > ----- Original Message -----
> > > From: "yilmaz" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Tuesday, November 20, 2001 1:11 AM
> > > Subject: why doesn't prepared statement work?
> > >
> > >
> > > > Hi all,
> > > > i have a strange situation here,
> > > > i am trying to execute an sql insert via prepared statements.
> > > > though it is a simple insert process, i am having a syntax error
> > message.
> > > > Doesn't mysql support this?
> > > > can someone please tell me what is wrong with this query?
> > > >
> > > > String query="insert into temp(member ,ename,cname,jname ,sex ,age
,"+
> > > >      "nation ,prf ,occ  ,educ ,address ,city ,res_city,res_address
,"+
> > > >      "htel ,mtel,otel ,fax ,email) "+
> > > >     " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
> > > >         PreparedStatement stmt=conn.prepareStatement(query);
> > > >
> > > >     stmt.setString(1,member);
> > > >     stmt.setString(2,ename);
> > > >     stmt.setString(3,cname);
> > > >     stmt.setString(4,jname);
> > > >     stmt.setString(5,sex);
> > > >     stmt.setInt(6,age);
> > > >     stmt.setString(7,nation);
> > > >     stmt.setString(8,prf);
> > > >     stmt.setString(9,occ);
> > > >     stmt.setString(10,educ);
> > > >     stmt.setString(11,address);
> > > >     stmt.setString(12,city);
> > > >     stmt.setString(13,res_city);
> > > >     stmt.setString(14,res_address);
> > > >     stmt.setString(15,htel);
> > > >     stmt.setString(16,mtel);
> > > >     stmt.setString(17,otel);
> > > >     stmt.setString(18,fax);
> > > >     stmt.setString(19,email);
> > > >    stmt.executeUpdate(query);
> > > >
> > > >   stmt.close();
> > > >   conn.close();
> > > >
> > > > the error message says:
> > > > javax.servlet.ServletException: Syntax error or access violation:
You
> > have
> > > > an error in your SQL syntax near
> > '?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'
> > > at
> > > > line 1
> > > >
> > > >
> > > > thanks a lot in advance :)
> > > >
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > Before posting, please check:
> > > >    http://www.mysql.com/manual.php   (the manual)
> > > >    http://lists.mysql.com/           (the list archive)
> > > >
> > > > To request this thread, e-mail <[EMAIL PROTECTED]>
> > > > To unsubscribe, e-mail
> > > <[EMAIL PROTECTED]>
> > > > Trouble unsubscribing? Try:
http://lists.mysql.com/php/unsubscribe.php
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > Before posting, please check:
> >    http://www.mysql.com/manual.php   (the manual)
> >    http://lists.mysql.com/           (the list archive)
> >
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> >
> >
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to