List:General Discussion« Previous MessageNext Message »
From:yilmaz Date:November 20 2001 10:18am
Subject:Re: why doesn't prepared statement work?
View as plain text  
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" <hans@stripped>
To: "yilmaz" <yilmaz@stripped>
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" <yilmaz@stripped>
> To: <mysql@stripped>
> 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 <mysql-thread91757@stripped>
> > To unsubscribe, e-mail
> <mysql-unsubscribe-hans=trimegah.com@stripped>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> >
> >
> >
>
>


Thread
why doesn't prepared statement work?yilmaz20 Nov
  • Re: why doesn't prepared statement work?yilmaz20 Nov
  • Re: why doesn't prepared statement work?DL Neil20 Nov
  • Re: why doesn't prepared statement work?yilmaz20 Nov
  • Re: why doesn't prepared statement work?yilmaz20 Nov
    • Re: why doesn't prepared statement work?Dan Nelson20 Nov