pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
JDBC DatabaseMetaData problem
4+ messages / 4 participants
[nested] [flat]

* JDBC DatabaseMetaData problem
@ 2003-10-29 19:37  Aleksey <phone@ukr.net>
  0 siblings, 0 replies; 4+ messages in thread

From: Aleksey @ 2003-10-29 19:37 UTC (permalink / raw)
  To: pgsql-jdbc

Hello,



I have the following problem working with DatabaseMetaData. There is a 
database with table and attribute names in Russian. Database cluster was 
initialized with appropriate ru_RU.KOI8-R locale. All the databases were 
created with KOI8-R encoding. No problems were encountered in accessing 
database table data with JDBC.

Database has foreign key constraints that I try to get with 
DatabaseMetaData methods. Both getTables and getPrimaryKeys work fine, 
all the results have correct encoding and values.

The following fragment of code causes exception:

rs = meta.getImportedKeys(null,null,tableName);
while(rs.next()) {

    String pkTable = rs1.getString("PKTABLE_NAME");
    String pkColumn = rs1.getString("PKCOLUMN_NAME");  /* here */

    String fkTable = rs1.getString("FKTABLE_NAME");
    String fkColumn = rs1.getString("FKCOLUMN_NAME"); /* and here */

}

PKTABLE_NAME and FKTABLE_NAME fields are fetched correctly. Both the 
marked lines produce exception with this stack trace:

at org.postgresql.core.Encoding.decodeUTF8(Encoding.java:270)
at org.postgresql.core.Encoding.decode(Encoding.java:165)
at org.postgresql.core.Encoding.decode(Encoding.java:181)
at 
org.postgresql.jdbc1.AbstractJdbc1ResultSet.getString(AbstractJdbc1ResultSet.java:97)
at 
org.postgresql.jdbc1.AbstractJdbc1ResultSet.getString(AbstractJdbc1ResultSet.java:337)

Error message is: "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.",

but database is not SQL_ASCII (actually KOI8-R) and all the characters 
in column names are taken from this codepage. Other DatabaseMetaData 
methods work with these characters fine.

I tested the same methods with the same database but with tables with 
latin names - everything worked fine, but renaming all the columns will 
cause a huge amount of extra work with database and applications.


I use PostgreSQL-7.3.4 compiled from source, JDBC driver from 
http://jdbc.postgresql.org/download/pg73jdbc3.jar on Linux, J2SDK 1.4.1_02.


I will appreciate any help with this.

Thank you.


Sincerely yours,
Aleksey.





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

* JDBC DatabaseMetaData problem
@ 2012-04-06 08:05  BCH)$BU*KrIR(B <jiangyimin@basechina.net>
  0 siblings, 1 reply; 4+ messages in thread

From: BCH)$BU*KrIR(B @ 2012-04-06 08:05 UTC (permalink / raw)
  To: pgsql-jdbc

Hello,
I have the following problem working with DatabaseMetaData. There is a
database with table and the attribute of 'cont'  is  character. Database 
cluster was
initialized with appropriate ru_RU.KOI8-R locale. All the databases were
created with utf-8 encoding.

I use PostgreSQL-8.2compiled from source, JDBC driver from
 on Linux, J2SDK 1.4.2_12.

update scheduleconttbl set cont ='\xf0\x9f\x99\x8f'
where logindaytime = '20120406142138813';



      [28/03/2012 13:55:39:906 +0900] 2012-03-28 13:55:39,905 
[com.fujitsu.fasol.intrapartner.common.action.BaseAction]-[ERROR] $B%7%9%F%`%(%i!<$,H/@8$7$^$7$?!'(B
      org.postgresql.util.PSQLException: 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.
     at org.postgresql.core.Encoding.decodeUTF8(Encoding.java:299)
     at org.postgresql.core.Encoding.decode(Encoding.java:186)
     at org.postgresql.core.Encoding.decode(Encoding.java:206)
     at 
org.postgresql.jdbc1.AbstractJdbc1ResultSet.getString(AbstractJdbc1ResultSet.java:222)
     at 
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getObject(AbstractJdbc2ResultSet.java:133)
     at com.fujitsu.fasol.intrapartner.common.IntranetResultSet.init(Unknown 
Source)
     at 
com.fujitsu.fasol.intrapartner.common.IntranetResultSet.<init>(Unknown 
Source)
     at 
com.fujitsu.fasol.intrapartner.user.schedule.dao.YoteiDao.yoteiSelectP50SQL6(Unknown 
Source)
     at 
com.fujitsu.fasol.intrapartner.user.schedule.action.Yotei50InitAction.getResultBean(Unknown 
Source)
     at 
com.fujitsu.fasol.intrapartner.user.schedule.action.Yotei50InitAction.process(Unknown 
Source)
     at 
com.fujitsu.fasol.intrapartner.common.action.BaseAction.execute(Unknown 
Source)
     at 
com.fujitsu.fasol.intrapartner.common.IntranetRequestProcessor.processActionPerform(Unknown 
Source)
     at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
     at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
     at 
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:599)
     at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:267)
     at 
com.fujitsu.fasol.intrapartner.common.SetCharacterEncodingFilter.doFilter(Unknown 
Source)
     at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:389)
     at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:267)
     at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:418)
     at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:292)
     at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at 
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2539)
     at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:255)
     at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
     at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
     at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
     at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
     at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.catalina.core.StandardHost.invoke(StandardHost.java:1002)
     at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:180)
     at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at 
org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:336)
     at 
org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:161)
     at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
     at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at 
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
     at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:648)
     at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:447)
     at 
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:917)
     at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
     atjava.lang.Thread.run(Thread.java:534)



 I will appreciate any help with this.

Thank you.


Sincerely yours,

Jiang

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

* Re: JDBC DatabaseMetaData problem
@ 2012-04-06 21:05  dmp <danap@ttc-cmc.net>
  parent: BCH)$BU*KrIR(B <jiangyimin@basechina.net>
  0 siblings, 1 reply; 4+ messages in thread

From: dmp @ 2012-04-06 21:05 UTC (permalink / raw)
  To: "BCH)姜亦敏" <jiangyimin@basechina.net>; pgsql-jdbc

BCH)姜亦敏 wrote:
> Hello,
> I have the following problem working with DatabaseMetaData. There is a
> database with table and the attribute of 'cont' is character. Database
> cluster was
> initialized with appropriate ru_RU.KOI8-R locale. All the databases were
> created with utf-8 encoding.
> I use PostgreSQL-8.2compiled from source, JDBC driver from
> on Linux, J2SDK 1.4.2_12.
> update scheduleconttbl set cont ='\xf0\x9f\x99\x8f'
> where logindaytime = '20120406142138813';
> ~
 > ~
> ~
> I will appreciate any help with this.
>
> Thank you.
>
>
> Sincerely yours,
> Jiang

Hello,

I just tried this same update on a table with char type with the input
indicated and it works fine on PostgreSQL 9.0.1 with jdbc-9.0-901.jdbc3.

Perhaps you need to update to a newer version of the database if you are
used the recommended supported version and correlated jdbc has indicated
at http://jdbc.postgresql.org/download.html

Version 8.2 Build 512 and JDBC2 8.2-512 JDBC2 which I think supports
JRE 1.4.

danap.






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

* Re: JDBC DatabaseMetaData problem
@ 2012-04-07 10:27  Dave Cramer <pg@fastcrypt.com>
  parent: dmp <danap@ttc-cmc.net>
  0 siblings, 0 replies; 4+ messages in thread

From: Dave Cramer @ 2012-04-07 10:27 UTC (permalink / raw)
  To: dmp <danap@ttc-cmc.net>; +Cc: "BCH)姜亦敏" <jiangyimin@basechina.net>; pgsql-jdbc

Why are you still using 8.2 ?
Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca



On Fri, Apr 6, 2012 at 5:05 PM, dmp <danap@ttc-cmc.net> wrote:
> BCH)姜亦敏 wrote:
>>
>> Hello,
>> I have the following problem working with DatabaseMetaData. There is a
>> database with table and the attribute of 'cont' is character. Database
>> cluster was
>> initialized with appropriate ru_RU.KOI8-R locale. All the databases were
>> created with utf-8 encoding.
>> I use PostgreSQL-8.2compiled from source, JDBC driver from
>> on Linux, J2SDK 1.4.2_12.
>> update scheduleconttbl set cont ='\xf0\x9f\x99\x8f'
>> where logindaytime = '20120406142138813';
>> ~
>
>> ~
>
>> ~
>> I will appreciate any help with this.
>>
>> Thank you.
>>
>>
>> Sincerely yours,
>> Jiang
>
>
> Hello,
>
> I just tried this same update on a table with char type with the input
> indicated and it works fine on PostgreSQL 9.0.1 with jdbc-9.0-901.jdbc3.
>
> Perhaps you need to update to a newer version of the database if you are
> used the recommended supported version and correlated jdbc has indicated
> at http://jdbc.postgresql.org/download.html
>
> Version 8.2 Build 512 and JDBC2 8.2-512 JDBC2 which I think supports
> JRE 1.4.
>
> danap.
>
>
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc



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


end of thread, other threads:[~2012-04-07 10:27 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-10-29 19:37 JDBC DatabaseMetaData problem Aleksey <phone@ukr.net>
2012-04-06 08:05 JDBC DatabaseMetaData problem BCH)$BU*KrIR(B <jiangyimin@basechina.net>
2012-04-06 21:05 ` dmp <danap@ttc-cmc.net>
2012-04-07 10:27   ` Dave Cramer <pg@fastcrypt.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