From: SourceForge.net <no...@so...> - 2005-06-28 14:42:18
|
Bugs item #1229047, was opened at 2005-06-28 16:35 Message generated for change (Comment added) made by rrokytskyy You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=109028&aid=1229047&group_id=9028 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Charsets/Collations Group: Initial Bug Status: Open Resolution: None Priority: 5 Submitted By: Thomas Mur (laffreuxthomas) Assigned to: Nobody/Anonymous (nobody) Summary: Cannot transliterate character between character sets Initial Comment: I have a problem with any criteria in the where statement. First, I create a database: create database 'localhost:C:\Tests.fdb' user 'sysdba' password 'masterkey' DEFAULT CHARACTER SET ISO8859_1; CREATE TABLE TestLabel ( Label VARCHAR(255) COLLATE FR_CA ); Then, in a Java program: public static void main(String[] args) { try { Driver driverInstance = (Driver) Class.forName("org.firebirdsql.jdbc.FBDriver").newInstance(); DriverManager.registerDriver(driverInstance); Connection cnFb = DriverManager.getConnection( "jdbc:firebirdsql:/Tests.fdb", "sysdba", "masterkey" ); String value = "a funny character: \u00e9 (very important for my users)"; // - insert PreparedStatement psInsert = cnFb.prepareStatement( "insert into testlabel (label) values (?)" ); psInsert.setCharacterStream(1, new StringReader(value), value.length()); //psInsert.executeUpdate(); psInsert.close(); // - select PreparedStatement psSelect = cnFb.prepareStatement( "select label from testlabel where label = ?" ); //byte[] array = value.getBytes("ISO-8859-1"); //ps.setBinaryStream(1, new ByteArrayInputStream(array), array.length); //psSelect.setString(1, value); psSelect.setCharacterStream(1, new StringReader(value), value.length()); ResultSet rs = psSelect.executeQuery(); // !!! BUG HERE !!! while (rs.next()) System.out.print(" " + rs.getString(1)); System.out.println(); rs.close(); psSelect.close(); // - end cnFb.close(); } catch (Throwable x) { x.printStackTrace(); } } Note: this program has to be executed with firebirdsql-full.jar in the class-path (found in FirebirdSQL-1.5.5JDK_1.4.zip) The error message: org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544321. arithmetic exception, numeric overflow, or string truncation Cannot transliterate character between character sets at org.firebirdsql.jdbc.FBCachedFetcher.<init>(FBCachedFetcher.java:126) at org.firebirdsql.jdbc.FBResultSet.<init>(FBResultSet.java:113) at org.firebirdsql.jdbc.AbstractStatement.getCachedResultSet(AbstractStatement.java:568) at org.firebirdsql.jdbc.AbstractPreparedStatement.executeQuery(AbstractPreparedStatement.java:115) at Tests.testFb(Tests.java:155) at Tests.main(Tests.java:128) at org.firebirdsql.gds.GDSException: arithmetic exception, numeric overflow, or string truncation Cannot transliterate character between character sets at org.firebirdsql.jgds.GDS_Impl.readStatusVector(GDS_Impl.java:1816) at org.firebirdsql.jgds.GDS_Impl.receiveResponse(GDS_Impl.java:1769) at org.firebirdsql.jgds.GDS_Impl.isc_dsql_fetch(GDS_Impl.java:1106) at org.firebirdsql.jca.FBManagedConnection.fetch(FBManagedConnection.java:828) at org.firebirdsql.jdbc.AbstractConnection.fetch(AbstractConnection.java:969) at org.firebirdsql.jdbc.FBCachedFetcher.<init>(FBCachedFetcher.java:63) at org.firebirdsql.jdbc.FBResultSet.<init>(FBResultSet.java:113) at org.firebirdsql.jdbc.AbstractStatement.getCachedResultSet(AbstractStatement.java:568) at org.firebirdsql.jdbc.AbstractPreparedStatement.executeQuery(AbstractPreparedStatement.java:115) at Tests.testFb(Tests.java:155) at Tests.main(Tests.java:128) Good luck and thanks in advance ! ---------------------------------------------------------------------- >Comment By: Roman Rokytskyy (rrokytskyy) Date: 2005-06-28 16:42 Message: Logged In: YES user_id=356832 Try Connection cnFb = DriverManager.getConnection( "jdbc:firebirdsql:/Tests.fdb?lc_ctype=ISO8859_1", "sysdba", "masterkey" ); If this works, you should read a bit about how character sets work in Firebird. Also, please close the bug if this solves your problem ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=109028&aid=1229047&group_id=9028 |