pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
charset property is not working
2+ messages / 2 participants
[nested] [flat]

* charset property is not working
@ 2004-05-13 16:04 Katalina Marcos <kmarcos@mazda.com.co>
  2004-05-16 20:33 ` Re: charset property is not working Kris Jurka <books@ejurka.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Katalina Marcos @ 2004-05-13 16:04 UTC (permalink / raw)
  To: pgsql-jdbc

Hi all! 

 

Please help me!

 

I’m using postgresql  7.3.2 (datasource) and jboss… 

 

When I try to query a table , I get  this error:

 

Invalid character data was found.  This is most likely caused by stored data
containing characters that are invalid f

or the character set the database was created in.  The most common example
of this is storing 8bit data in a SQL_ASCII database.

 

That is because in a row I have the character ¥… In the postgresql’s log I
get…

 

LOG:  query: select * from t_migracion_historico where
lower(tps_migrhist_basedato) = 'repuestos' and lower(ts_migrhist_tablorig) =
't_moneda' and (upper(ts_migrhist_procesado)='N' or ts_migrhist_procesado is
null)

LOG:  query: select * from t_migracion_historico;

LOG:  query: set datestyle to 'ISO'; select version(), case when
pg_encoding_to_char(1) = 'SQL_ASCII' then 'UNKNOWN' else
getdatabaseencoding() end;

LOG:  query: ÿþs

ERROR:  parser: parse error at or near "ÿþs" at character 1

FATAL:  Socket command type e unknown

 

So, I try to set the connection property in the datasource descriptor:

 

<connection-property name="charSet">UNICODE</connection-property>

 

Because I set client_encoding to UNICODE in postgresql.config.

 

 

But when I try to run the application again, it throws

 

Could not create connection; - nested throwable: (Something unusual has
occured to cause the driver to fail. Please report this exception:
Exception: java.sql.SQLException: 

Stack Trace:

 

java.sql.SQLException: 

       at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131)

       at
org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection
.java:482)

       at
org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection
.java:461)

       at
org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Con
nection.java:376)

       at org.postgresql.Driver.connect(Driver.java:122)

       at
org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createMa
nagedConnection(LocalManagedConnectionFactory.java:150)

       at
org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createCon
nectionEventListener(InternalManagedConnectionPool.java:477)

...

 

Could anybody help to me? What is the right way to do this query?

 

Thanks in advance!

Katalina

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: charset property is not working
  2004-05-13 16:04 charset property is not working Katalina Marcos <kmarcos@mazda.com.co>
@ 2004-05-16 20:33 ` Kris Jurka <books@ejurka.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Kris Jurka @ 2004-05-16 20:33 UTC (permalink / raw)
  To: Katalina Marcos <kmarcos@mazda.com.co>; +Cc: pgsql-jdbc



On Thu, 13 May 2004, Katalina Marcos wrote:

> I'm using postgresql  7.3.2 (datasource) and jboss

Is this a 7.3.2 server or 7.3.2 jdbc driver or both?

> 
> When I try to query a table , I get  this error:
> 
> Invalid character data was found.  This is most likely caused by stored
> data containing characters that are invalid for the character set the
> database was created in.  The most common example of this is storing
> 8bit data in a SQL_ASCII database.
> 
> LOG:  query: ÿþs
> ERROR:  parser: parse error at or near "ÿþs" at character 1
> FATAL:  Socket command type e unknown

What encoding did you create the database in?  (psql's \l command will 
show you.)  If it's not unicode you won't be able to store the full range 
of unicode characters correctly in it.

> 
> So, I try to set the connection property in the datasource descriptor:
> <connection-property name="charSet">UNICODE</connection-property>

The charSet property is only valid when connecting to 7.2 and earlier 
databases.  Starting with the 7.3 series multibyte support was enabled in 
the default install, so the client_encoding is always set to unicode by 
the driver.


Kris Jurka




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-05-16 20:33 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-05-13 16:04 charset property is not working Katalina Marcos <kmarcos@mazda.com.co>
2004-05-16 20:33 ` Kris Jurka <books@ejurka.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox