Re: Problem with driver - Mailing list pgsql-jdbc
From | J M Okomba |
---|---|
Subject | Re: Problem with driver |
Date | |
Msg-id | 715DF98A936DD211B29D0008C71E55D4945ACC@NTSERVER1 Whole thread Raw |
In response to | Problem with driver (J M Okomba <Okomba@kabage.co.ke>) |
Responses |
Re: Problem with driver
|
List | pgsql-jdbc |
I got the different errors by changing the charSet (encoding) in the connection string i.e.: 1. String DBUrl = "jdbc:postgresql://localhost:5432/database?charSet=LATIN1"; // for LATIN1 errors 2. String DBUrl = "jdbc:postgresql://localhost:5432/database?charSet=SQL_ASCII"; //for SQL_ASCII errors 3. String DBUrl = "jdbc:postgresql://localhost:5432/database?charSet=UNICODE"; // for UNICODE errors By changing DBUrl in TestJDBC.java with the three different strings above you'll get the errors I have attached. The file pgjdbc2-LATIN1.txt contains the desired result. > -----Original Message----- > From: Barry Lind [SMTP:blind@xythos.com] > Sent: 12 March 2003 08:50 > To: J M Okomba > Cc: 'pgsql-jdbc' > Subject: Re: [JDBC] Problem with driver > > Can you be more specific. I don't know what you mean by 'latin1 errors' > or 'sql_ascii errors' or 'unicode errors'? What are these attached > files showing us? Can you provide test cases (simple code examples that > we can compile and run here) that demonstrate your problem? > > thanks, > --Barry > > J M Okomba wrote: > > After some more trials I have found out that the problem is with the > > encoding. The problematic table has a £ (pound) entry, which pg73jdbc3 > is > > having difficulties retrieving. I did tests with pg73jdbc3 using > different > > encoding and found the attached results: > > > > <<LATIN1-errors.txt>> > <<SQL_ASCII-errors.txt>> > > <<UNICODE-errors.txt>> > > > > Tests with pgjdbc2 gave the attached results: > > > > <<pgjdbc2-LATIN1.txt>> > > <<pgjdbc2-UNICODE-errors.txt>> > > It appears that UNICODE has a problem even with pgjdbc2. > > > > Attached is the Java file > > > > <<TestJDBC.java>> > > Please help. > > > > > > > >>-----Original Message----- > >>From: J M Okomba [SMTP:Okomba@kabage.co.ke] > >>Sent: 11 March 2003 15:48 > >>To: 'pgsql-jdbc' > >>Subject: Re: [JDBC] Problem with driver > >> > >> > >>After doing some more tests I have discovered that the problem is most > >>likely being caused by the context (environment) of the application I > am > >>calling. I have managed to access the problematic table from a bare Java > >>application. I will try to find out why I can't access it from a > >>JSP/servlet. > >> > >>Thanks. > >> > >> > >>>-----Original Message----- > >>>From: Dave Cramer [SMTP:Dave@micro-automation.net] > >>>Sent: 11 March 2003 12:14 > >>>To: J M Okomba > >>>Cc: 'pgsql-jdbc' > >>>Subject: Re: [JDBC] Problem with driver > >>> > >>>Can you send us a test case so we can replicate the problem here > >>> > >>>Dave > >>>On Tue, 2003-03-11 at 01:40, J M Okomba wrote: > >>> > >>>>I keep getting this error: > >>>> > >>>>Database error in EmbeddedData.fetchData 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 > >>>> > >>>>with current postgres drivers downloaded from > >>>>http://jdbc.postgresql.org/download/ (like pg73jdbc3.jar and others). > >>> > >>>The > >>> > >>>>error is only thrown when I try to access one table (other tables in > >> > >>the > >> > >>>>database work fine). > >>>> > >>>>However I don't get this error with pgjdbc2.jar, which I downloaded > >>> > >>>about 8 > >>> > >>>>months ago. > >>>> > >>>>I will appreciate any help to resolve the problem. I really need to > >> > >>use > >> > >>>new > >>> > >>>>features in the updated drivers. > >>>> > >>>> > >>>>---------------------------(end of > >> > >>broadcast)--------------------------- > >> > >>>>TIP 3: if posting/reading through Usenet, please send an appropriate > >>>>subscribe-nomail command to majordomo@postgresql.org so that your > >>>>message can get through to the mailing list cleanly > >>> > >>>-- > >>>Dave Cramer <Dave@micro-automation.net> > >> > >>---------------------------(end of broadcast)--------------------------- > >>TIP 4: Don't 'kill -9' the postmaste > > > > r > > > > > > ------------------------------------------------------------------------ > > > > > > > > 2 - entry > > DM - entry > > Deutsch Marks - entry > > null - entry > > 000.00 - entry > > false - entry > > null - entry > > ===================================================== > > 5 - entry > > 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. - sqle.getMessage() > > 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: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(AbstractJdbc1ResultS > et.java:97) > > at > org.postgresql.jdbc2.AbstractJdbc2ResultSet.getObject(AbstractJdbc2ResultS > et.java:120) > > at > org.postgresql.jdbc1.AbstractJdbc1ResultSet.getObject(AbstractJdbc1ResultS > et.java:514) > > at temp.TestJDBC.main(TestJDBC.java:105) > > > > > > > > ------------------------------------------------------------------------ > > > > > > 2 - entry > > DM - entry > > Deutsch Marks - entry > > null - entry > > 000.00 - entry > > false - entry > > null - entry > > ===================================================== > > 5 - entry > > 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. - sqle.getMessage() > > 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: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(AbstractJdbc1ResultS > et.java:97) > > at > org.postgresql.jdbc2.AbstractJdbc2ResultSet.getObject(AbstractJdbc2ResultS > et.java:120) > > at > org.postgresql.jdbc1.AbstractJdbc1ResultSet.getObject(AbstractJdbc1ResultS > et.java:514) > > at temp.TestJDBC.main(TestJDBC.java:105) > > > > > > ------------------------------------------------------------------------ > > > > > > 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(AbstractJdbc1Connecti > on.java:482) > > at > org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connecti > on.java:461) > > at > org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1C > onnection.java:375) > > at org.postgresql.Driver.connect(Driver.java:122) > > at java.sql.DriverManager.getConnection(DriverManager.java:512) > > at java.sql.DriverManager.getConnection(DriverManager.java:171) > > at temp.TestJDBC.main(TestJDBC.java:76) > > End of Stack Trace > > - sqle.getMessage() > > 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(AbstractJdbc1Connecti > on.java:482) > > at > org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connecti > on.java:461) > > at > org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1C > onnection.java:375) > > at org.postgresql.Driver.connect(Driver.java:122) > > at java.sql.DriverManager.getConnection(DriverManager.java:512) > > at java.sql.DriverManager.getConnection(DriverManager.java:171) > > at temp.TestJDBC.main(TestJDBC.java:76) > > End of Stack Trace > > at org.postgresql.Driver.connect(Driver.java:141) > > at java.sql.DriverManager.getConnection(DriverManager.java:512) > > at java.sql.DriverManager.getConnection(DriverManager.java:171) > > at temp.TestJDBC.main(TestJDBC.java:76) > > > > > > ------------------------------------------------------------------------ > > > > > > > > 2 - entry > > DM - entry > > Deutsch Marks - entry > > null - entry > > 000.00 - entry > > false - entry > > null - entry > > ===================================================== > > 5 - entry > > UK£ - entry > > Pounds Sterling - entry > > null - entry > > 000.00 - entry > > false - entry > > null - entry > > ===================================================== > > 6 - entry > > US$ - entry > > US Dollars - entry > > null - entry > > 000.01 - entry > > false - entry > > null - entry > > ===================================================== > > 7 - entry > > USH - entry > > Uganda Shillings - entry > > null - entry > > 001.00 - entry > > false - entry > > null - entry > > ===================================================== > > 8 - entry > > ZIM$ - entry > > Zimbabwe Dollars - entry > > null - entry > > 001.00 - entry > > false - entry > > null - entry > > ===================================================== > > 3 - entry > > KSH - entry > > Kenya Shillings - entry > > KENYA - entry > > 000.05 - entry > > true - entry > > - entry > > ===================================================== > > 4 - entry > > RAND - entry > > South African Rand - entry > > RSA - entry > > 000.00 - entry > > false - entry > > - entry > > ===================================================== > > 9 - entry > > T.Shs - entry > > Tanzania Shillings - entry > > TANZ - entry > > 000.00 - entry > > false - entry > > - entry > > ===================================================== > > 12 - entry > > USHSs - entry > > Uganda Shillings - entry > > UG - entry > > - entry > > false - entry > > - entry > > ===================================================== > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > > > - sqle.getMessage() > > java.sql.SQLException: > > at > org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:94) > > at org.postgresql.Connection.ExecSQL(Connection.java:398) > > at org.postgresql.jdbc2.Statement.execute(Statement.java:130) > > at > org.postgresql.jdbc2.Statement.executeQuery(Statement.java:54) > > at temp.TestJDBC.main(TestJDBC.java:82) > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 3: if posting/reading through Usenet, please send an appropriate > > subscribe-nomail command to majordomo@postgresql.org so that your > > message can get through to the mailing list cleanly > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
pgsql-jdbc by date: