Thread: server-side prepared

server-side prepared

From
Felipe Schnack
Date:
  I just can't use server-side prepared statements
  Here is a snippet of my sources, note that the column I'm inserting is
of "bigint" data type
  PreparedStatement prep = Connection.prepareStatement("insert into
tablename values (?)");
  prep.setNull(1, Types.BIGINT);
  prep.executeUpdate();
  For some strange reasons when I execute that I get the following
error: "Column 'cpf' is of type BIGINT, but expression is of type text"
  Well, I specified the BIGINT type correctly, What can I do?


--

Felipe Schnack
Analista de Sistemas
felipes@ritterdosreis.br
Cel.: (51)91287530
Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone/Fax.: (51)32303341


Re: server-side prepared

From
Scott Lamb
Date:
Felipe Schnack wrote:

>   I just can't use server-side prepared statements
>   Here is a snippet of my sources, note that the column I'm inserting is
> of "bigint" data type
>   PreparedStatement prep = Connection.prepareStatement("insert into
> tablename values (?)");
>   prep.setNull(1, Types.BIGINT);
>   prep.executeUpdate();
>   For some strange reasons when I execute that I get the following
> error: "Column 'cpf' is of type BIGINT, but expression is of type text"
>   Well, I specified the BIGINT type correctly, What can I do?
>
>

Are you using the latest CVS release? I encountered this bug, too -
you'll probably find setting a non-null integer value works, but it
always thinks nulls are of type text. It was fixed in CVS a while ago,
but that version wasn't released with 7.3.0 or 7.3.1.

Scott


Re: server-side prepared

From
Dave Cramer
Date:
Felipe,

You, need the new code.

Dave
On Wed, 2003-01-08 at 13:34, Felipe Schnack wrote:
>   I just can't use server-side prepared statements
>   Here is a snippet of my sources, note that the column I'm inserting is
> of "bigint" data type
>   PreparedStatement prep = Connection.prepareStatement("insert into
> tablename values (?)");
>   prep.setNull(1, Types.BIGINT);
>   prep.executeUpdate();
>   For some strange reasons when I execute that I get the following
> error: "Column 'cpf' is of type BIGINT, but expression is of type text"
>   Well, I specified the BIGINT type correctly, What can I do?
>
>
--
Dave Cramer <Dave@micro-automation.net>


Re: server-side prepared

From
Felipe Schnack
Date:
  I'm using an old CVS version, because I need the changes I made to the
driver regarding insert statements' DEFAULT keyword (new in 7.3)... I'm
waiting my patch to be applied so I can download the sources...
  Maybe I can apply the patches in my copy? How?

On Wed, 2003-01-08 at 17:26, Scott Lamb wrote:
> Felipe Schnack wrote:
>
> >   I just can't use server-side prepared statements
> >   Here is a snippet of my sources, note that the column I'm inserting is
> > of "bigint" data type
> >   PreparedStatement prep = Connection.prepareStatement("insert into
> > tablename values (?)");
> >   prep.setNull(1, Types.BIGINT);
> >   prep.executeUpdate();
> >   For some strange reasons when I execute that I get the following
> > error: "Column 'cpf' is of type BIGINT, but expression is of type text"
> >   Well, I specified the BIGINT type correctly, What can I do?
> >
> >
>
> Are you using the latest CVS release? I encountered this bug, too -
> you'll probably find setting a non-null integer value works, but it
> always thinks nulls are of type text. It was fixed in CVS a while ago,
> but that version wasn't released with 7.3.0 or 7.3.1.
>
> Scott
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
--

Felipe Schnack
Analista de Sistemas
felipes@ritterdosreis.br
Cel.: (51)91287530
Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone/Fax.: (51)32303341