error connecting to a firebird 4.0 database with Jaybird 4.0.5

85 views
Skip to first unread message

Patrick de Torcy

unread,
Feb 11, 2022, 12:26:18 PM2/11/22
to firebird-java
I use the following code :
Connection c = getConnection( "jdbc:firebirdsql://localhost:3050/c:/lexidiom/LexidiomBase/LEXIDIOM.fdb",
                                     "org.firebirdsql.jdbc.FBDriver",
                                    getPropertiesFirebird("SYSDBA", "masterkey", "UNICODE_FSS") );

and I got the Exception :
org.firebirdsql.jdbc.FBSQLException: Resource Exception. No message for code 335545106 found.

Reason: No message for code 335545106 found.
        at org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:106)
        at org.firebirdsql.jdbc.FBDriver.connect(FBDriver.java:221)
        at java.sql.DriverManager.getConnection(DriverManager.java:664)
        at java.sql.DriverManager.getConnection(DriverManager.java:208)
        at com.memodata.util.OutilsSGBD.getConnection(OutilsSGBD.java:72)
        at com.memodata.util.OutilsSGBD.main(OutilsSGBD.java:634)
at org.firebirdsql.gds.GDSException: No message for code 335545106 found.
        at org.firebirdsql.jgds.GDS_Impl.readStatusVector(GDS_Impl.java:1759)
        at org.firebirdsql.jgds.GDS_Impl.receiveResponse(GDS_Impl.java:1712)
        at org.firebirdsql.jgds.GDS_Impl.isc_attach_database(GDS_Impl.java:297)
        at org.firebirdsql.jgds.GDS_Impl.isc_attach_database(GDS_Impl.java:259)
        at org.firebirdsql.jca.FBManagedConnectionFactory.createDbHandle(FBManagedConnectionFactory.java:540)
        at org.firebirdsql.jca.FBManagedConnection.<init>(FBManagedConnection.java:88)
        at org.firebirdsql.jca.FBManagedConnectionFactory.createManagedConnection(FBManagedConnectionFactory.java:366)
        at org.firebirdsql.jca.FBStandAloneConnectionManager.allocateConnection(FBStandAloneConnectionManager.java:60)
        at org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:103)
        at org.firebirdsql.jdbc.FBDriver.connect(FBDriver.java:221)
        at java.sql.DriverManager.getConnection(DriverManager.java:664)
        at java.sql.DriverManager.getConnection(DriverManager.java:208)
        at ...

Notes: 
- I can use my database with flameRobin and with Python and fdb package
- I have modified firebird.conf by adding : WireCrypt = Enabled

Thanks

Mark Rotteveel

unread,
Feb 11, 2022, 12:41:51 PM2/11/22
to firebi...@googlegroups.com
Error 335545106 is "Error occurred during login, please check server
firebird.log for details". The firebird log probably contains a message
like:
"""
SERVER Sat Oct 28 10:07:26 2017
Authentication error
No matching plugins on server
"""

The title of your message suggests you're using Jaybird 4.0.5, but the
exception stacktrace contains org.firebirdsql.jgds.GDS_Impl, which means
you're using a very old version of Jaybird, Jaybird 1.5 or older. Make
sure you do not have older versions of Jaybird on your classpath.

In theory, you can also solve this problem by making sure the
Legacy_Auth plugin is configured in Firebird (see [1]), but I would not
recommend that, because Jaybird 1.5 or earlier will likely not work well
with Firebird 4.0 in other areas, and definitely not work with the new
data types.

Mark

[1]:
https://www.firebirdsql.org/file/documentation/drivers_documentation/java/faq.html#error-occurred-during-login-please-check-server-firebird.log-for-details-335545106

Arioch The

unread,
Feb 11, 2022, 12:51:28 PM2/11/22
to firebi...@googlegroups.com
while not directly related i would also wonder if perusing non-standard charset UNICODE_FSS can not be avoided by switch to standard UTF-8

Patrick de Torcy

unread,
Feb 12, 2022, 4:44:34 AM2/12/22
to firebird-java
You were right about my wrong version of Jaybird. I added the file jaybird-full-4.0.5.java8.jar in the lib folder (in the same folder than the old one  firebirdsql-full.jar)  and  in my project Netbeans, I picked up the new jar. But it doesn't work. Anyway, it' more a Netbeans issue than a jaybird's one...
For UNICODE_FSS, I used it because my database is an old firebird 2.5 one,  converted in the new format 4.0 using gbak...
Do you think I can use UTF-8 instead, without no further modifications  ? 

Many thanks to everybody !

Patrick

Mark Rotteveel

unread,
Feb 12, 2022, 5:09:17 AM2/12/22
to firebi...@googlegroups.com
On 12-02-2022 10:44, Patrick de Torcy wrote:
> You were right about my wrong version of Jaybird. I added the
> file jaybird-full-4.0.5.java8.jar in the lib folder (in the same folder
> than the old one firebirdsql-full.jar)  and  in my project Netbeans, I
> picked up the new jar. But it doesn't work. Anyway, it' more a Netbeans
> issue than a jaybird's one...
> For UNICODE_FSS, I used it because my database is an old firebird 2.5
> one,  converted in the new format 4.0 using gbak...
> Do you think I can use UTF-8 instead, without no further modifications  ?

Even with Firebird 2.5, UTF8 was the 'better' choice. UTF8 was
introduced in Firebird 1.5 as a replacement of UNICODE_FSS, while
UNICODE_FSS was introduced in InterBase 6.0 or earlier.

That said, unless you need to full range of Unicode characters, and
UNICODE_FSS worked fine for you before, continuing to use UNICODE_FSS
probably won't be that much of a problem.

The primary difference is that UNICODE_FSS is only max 3 bytes in
length, thus it can't support all Unicode characters, and it has some
additional restrictions on its character set (FSS stands for File System
Safe). Switching to UTF8 does come at a cost because it is max 4 bytes,
storage could increase by 1/3, and maximum length of fields is reduced
from 10922 to 8191.

In addition, I believe - based on a comment in the Firebird 1.5 release
notes - that Firebird doesn't check character length requirements of
UNICODE_FSS, only byte length requirements, which would make it possible
to have stored 32766 characters from the ASCII range in a VARCHAR(10922)
CHARACTER SET UNICODE_FSS (on the other hand, mechanisms in Jaybird
might prevent you from storing such values).

Mark
--
Mark Rotteveel

Patrick de Torcy

unread,
Feb 12, 2022, 7:58:22 AM2/12/22
to firebird-java
Indeed,  with my 1.5 database, I could put a 1250 characters length string in a field declared varchar(1200) UNICODE_FSS.
But when I tried to parse the table with a simple "select * from...", I got the following error : 
fdb.fbcore.DatabaseError: ('Cursor.fetchone:\n- SQLCODE: -802\n- arithmetic exception, numeric overflow, or string truncation.
You can write it, but can't read it...

That was a reason to upgrade to firebird 4.0 (but this bug may still remain)...



Reply all
Reply to author
Forward
0 new messages