Skip site navigation (1) Skip section navigation (2)

Re: macaddr data type and prepared statements

From: Kris Jurka <books(at)ejurka(dot)com>
To: Steve Foster <s(dot)p(dot)foster(at)leeds(dot)ac(dot)uk>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: macaddr data type and prepared statements
Date: 2008-08-05 05:30:39
Message-ID: Pine.BSO.4.64.0808050129200.411@leary.csoft.net (view raw or flat)
Thread:
Lists: pgsql-jdbc

On Mon, 4 Aug 2008, Steve Foster wrote:

> I'm trying to bulk load some MAC addresses using a prepared statement. But I 
> keep on getting an error about incorrect datatype (complains that I'm trying 
> to insert "character varying").  Bellow is an example of the code that I'm 
> using:
>
>           stmt.setString(3, line[2]);
>

Don't use setString for non-string types.  With a recent JDBC driver you 
should use setObject(3, line[2], Types.OTHER);

Kris Jurka


In response to

pgsql-jdbc by date

Next:From: Steve FosterDate: 2008-08-05 08:46:05
Subject: Re: macaddr data type and prepared statements
Previous:From: Oliver JowettDate: 2008-08-04 20:20:18
Subject: Re: macaddr data type and prepared statements

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group