Connection issue in JayBird

10,209

Solution 1

The OP is mixing two jdbc url formats supported by Jaybird.

Either use

jdbc:firebirdsql://[host]{:[port]}/[path]

or

jdbc:firebirdsql:[host]{/[port]}:[path]

{...} used to indicate optional part

Solution 2

I think the problem must be the connection string, there is a blank space after "C:/XLNKREPOS"

Try this

connection = DriverManager.getConnection("jdbc:firebirdsql://localhost/3050:C:/XLNKREPOS/FIRBIRDXA.FDB", "SYSDBA", "masterkey");

Bye.

Solution 3

I had the same problem, it was caused by those slashes before localhost. That URL should be:

jdbc:firebirdsql:localhost/3050:C:/XLNKREPOS/FIRBIRDXA.FDB",

Solution 4

When I got this error it was because I was using x64 Firebird version instead of the standard x86 version. I thought since I was running a 64bit OS that those embedded binaries corresponded to me... Hopefully that fixes your problem.

Troubleshooting Tips:

I was also able to further diagnose additional Firebird problems by adding the latest log4j jar from apache's site to my project/classpath. I then added a log4j.properties file to my default/root src directory with the following properties set inside:

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%c{1},%p] %m%n
log4j.rootCategory=DEBUG, stdout
log4j.category.org.firebirdsql=DEBUG, stdout

I also had to set System.setProperty("FBLog4j", "true"); in my code.

Another thing you can do is make sure you're running the latest and greatest from their repository at http://firebird.cvs.sourceforge.net/viewvc/firebird/client-java/?view=tar

Just unzip the tarball and compile it using their supplied build script (build.bat/build.sh). After compilation look in the 'output/lib' directory and you'll find the latest version of the jaybird jar (as of right now it's 2.2.0). You'll also need the latest jaybird dll (as of right now it's 22) which is located in the 'native' directory. I went through a lot of pain trying to figure this crap out. The documentation on Firebird's site is very outdated and poorly written.

Share:
10,209
Kishore
Author by

Kishore

New in Java Field.

Updated on June 04, 2022

Comments

  • Kishore
    Kishore almost 2 years

    I am new to Firebird using its Java version Jaybird, But unable to connect from database (.fdb file). The problem comes like this:

    org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544375. unavailable database

    OR

    java.lang.RuntimeException: Failed to initilize Jaybird native library. This is most likley due to a failure to load the firebird client library.

    Using following code:

    Class.forName("org.firebirdsql.jdbc.FBDriver").newInstance();
    connection = DriverManager.getConnection("jdbc:firebirdsql://localhost/3050:C:/XLNKREPOS /FIRBIRDXA.FDB", "SYSDBA", "masterkey");
    

    Having following files in build path of Eclipse project:

    • jaybird-full-2.1.5.jar
    • jaybird21.dll
    • fbclient.dll
    • fbembed.dll

    Also using the JVM arguments as -Djava.library.path="D:\Shared\Firebird\Jaybird-2.1.5JDK_1.5"

    Tell me what is wrong in my approach?


    Thanks RRUZ for giving repsonse.

    Actually there was no space after "C:/XLNKREPOS" in my connection string, It was a copy past mistake. Again & again I got the following SQL Exception:

    org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544375. unavailable database

    And that database is no where used in other program.

    Hope my this post makes you understand my problem.

    Thanks