Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to detect the correct character-encoding
    text
    copied!<p>I need to extract data from some old interbase databasefiles created with InterBase 4.2.1. I'm using the embedded version of Firebird (version 2.5.1) and the .NetProvider (version 2.7.0). I never worked with interbase of firebird before (but i have some experience with SQL SERVER and SQLite) and after cruising the web and experimenting for 2 days, I have yet to find a solution.</p> <p>The tables in the database contain data in English, but also data in Hebrew. Optimistic as I was, I started by creating my connection string using UTF8:</p> <pre><code>FbConnectionStringBuilder builder = new FbConnectionStringBuilder(); builder.Database = m_DatabaseName; builder.ServerType = FbServerType.Embedded; builder.Charset = FbCharset.Utf8.ToString(); </code></pre> <p>But that gave me the following exception:</p> <pre><code>bad parameters on attach or create database CHARACTER SET Utf8 is not defined </code></pre> <p>I correctly used the fbintl.dll. (see the files in my application directory and subdirectories below). I even used ProcessMonitor to check if the fbintl.dll was loaded.</p> <pre><code>fbembed.dll firebird.log firebird.msg FirebirdSql.Data.FirebirdClient.dll ib_util.dll icudt30.dll icuin30.dll icuuc30.dll MyApplication.exe Microsoft.VC80.CRT.manifest msvcp80.dll msvcr80.dll intl\fbintl.conf intl\fbintl.dll udf\fbudf.dll udf\ib_udf.dll </code></pre> <p>So I tried enumerating <code>FbCharset</code> and trying to connect with each character set, more than half of them threw the same exception, and when I connected with the others and queried one of the Hebrew fields (by using <code>IDataReader.GetString()</code>), I always got the same garbage as result. It doesn't seem to matter what character set I specify in the connection string, the result are always the same, even if I don't specify any character set at all.</p> <p>Next I queried the character sets defined in the database <code>SELECT RDB$CHARACTER_SET_NAME FROM RDB$CHARACTER_SETS</code> and I enumrated those, trying to connect with each one of them, some threw an exception, the others gave the same result as before.</p> <p>I have no clue with what character set the database was created, but I checked the character sets of each field in the database and all text fields have their character sets set to 'NONE'.</p> <pre><code>SELECT r.RDB$RELATION_NAME, r.RDB$FIELD_NAME, f.RDB$FIELD_NAME, cset.RDB$CHARACTER_SET_NAME FROM RDB$RELATION_FIELDS r LEFT JOIN RDB$FIELDS f ON r.RDB$FIELD_SOURCE = f.RDB$FIELD_NAME LEFT JOIN RDB$CHARACTER_SETS cset ON f.RDB$CHARACTER_SET_ID = cset.RDB$CHARACTER_SET_ID ORDER BY r.RDB$RELATION_NAME ASC, r.RDB$FIELD_POSITION ASC </code></pre> <p>But I noticed some of the system tables' text fields have UNICODE_FSS as character set. I already tried that character set in the connection string, but I still get garbadge for the requested text fields.</p> <p>My last try was to retrieve the bytes (by using <code>IDataReader.GetBytes()</code>) and encode the string myself, but this gives me a cast exception (<code>Unable to cast object of type 'System.String' to type 'System.Byte[]'.</code>)</p> <p>Does anyone have any ideas on how to read this data ? I don't need to convert the databases permanently, as they won't be used anymore once i have extracted the data.</p> <p>EDIT: btw, are there any free lightweight interbase/firebird database viewers, I can't seem to find any good ones (comparable to <a href="http://www.yunqa.de/delphi/doku.php/products/sqlitespy/index" rel="nofollow">SQLiteSpy</a>) ?</p> <p>Marc</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload