Re: NullPointerException when trying to PreparedStament.setString()
Posted by: Mark Matthews
Date: September 15, 2005 07:36AM

Tom Coupland wrote:
> Hi all,
>
> Have been using prepared statements in my proj for
> a while and have enjoyed quite abit of success
> with them, but today i decided to changed the
> order of things abit and now they won't work!
> Heres my code snippet
>
>
> public ResultSet executeStatement(String[] args)
> throws SQLException{
> synchronized(myStatement){
> try{
> for(int i=0;i<args.length;i++){
> log.info("Setting statement var "+(i+1)+" to
> "+args);
> myStatement.setString(i+1, args);
> }
> return myStatement.executeQuery();
>
>
> When it runs i now get this
>
>
> java.lang.NullPointerException at
> com.mysql.jdbc.ServerPreparedStatement.getBinding(
> ServerPreparedStatement.java:733) at
> com.mysql.jdbc.ServerPreparedStatement.setString(S
> erverPreparedStatement.java:1738) at
> org.jboss.resource.adapter.jdbc.WrappedPreparedSta
> tement.setString(WrappedPreparedStatement.java:406
> ) at
> meta.database.PersistentDatagram.executeStatement(
> PersistentDatagram.java:101)
>
>
> Can anyone shed some light on this for me? Would
> really appreciate it!
>
> Cheers
>
> Tom


Tom,

What version of the driver are you using? How did you change the order of things (i.e. what were you doing before that was different).

-Mark

Mark Matthews
Consulting Member Technical Staff - MySQL Enterprise Tools
Oracle
http://www.mysql.com/products/enterprise/monitor.html

Options: ReplyQuote


Subject
Written By
Posted
Re: NullPointerException when trying to PreparedStament.setString()
September 15, 2005 07:36AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.