11

I have installed Firebird 2.1 on windows Xp and using firebirdsql.jdbc-2.1.6 driver to connect with java. Code:

Class.forName("org.firebirdsql.jdbc.FBDriver"); 

connection = DriverManager.getConnection(
    "jdbc:firebirdsql://localhost/3050//C:/firebird/database/EMPLOYEE.FDB", 
    "test","test"); 

I am getting following error:

Caused by: org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544375.
unavailable database 
Reason: unavailable database at 
org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:122) at 
org.firebirdsql.jdbc.FBDriver.connect(FBDriver.java:140) at 
java.sql.DriverManager.getConnection(DriverManager.java:525) at 
java.sql.DriverManager.getConnection(DriverManager.java:171)

Please help.

Problem solved: Actually I had problem with jar file that I got from

http://mirrors.ibiblio.org/pub/mirrors/maven2

I downloaded jaybird-full-2.1.6.jar from firebird offical website and problem got solved.

Correct URL is

"jdbc:firebirdsql://localhost:3050/C:\\firebird\\database\\EMPLOYEE.FDB"

I tried this URL earlier also but it was not working beacuse of jar issue.

Mark Rotteveel
  • 82,132
  • 136
  • 114
  • 158
Rakesh Goyal
  • 2,947
  • 6
  • 33
  • 65

6 Answers6

3

As @Thorbjørn Ravn Andersen observes, your Jaybird JDBC URL is incorrect. The syntax is jdbc:firebirdsql:[host[/port]:]<database>. You need a colon between the host/port and the database path. Perhaps something like this:

"jdbc:firebirdsql://localhost/3050:C:\\firebird\database\EMPLOYEE.FDB"

Oops, I left in the leading slashes; try this:

"jdbc:firebirdsql:localhost/3050:C:\\firebird\database\EMPLOYEE.FDB"

Addendum: You might run through the common errors list. Also, my firebird database files end in .fdb, but the FAQ mentions .gdb. It can't hurt to check.

trashgod
  • 196,350
  • 25
  • 213
  • 918
1

From https://www.firebirdsql.org/file/documentation/drivers_documentation/java/faq.html#pure-java-default

Default URL format:

"jdbc:firebirdsql://host[:port]/<database>"

Deprecated, but still supported legacy URL format:

"jdbc:firebirdsql:host[/port]:<database>"

Then, the correct URL should be:

"jdbc:firebirdsql://localhost:3050/C:/firebird/database/EMPLOYEE.FDB"
Eduardo Cuomo
  • 13,985
  • 3
  • 93
  • 80
0

Looking at the documentation on this site: http://www.firebirdsql.org/file/documentation/drivers_documentation/java/faq.html, item 3.1

It seems that after the [port], you must have an slash "/" or double slash "//" in case you would connect on a linux server.

Fernando Vieira
  • 2,302
  • 22
  • 23
0

Your URL is most likely broken for this driver.

Attach actual source to the jar and set a breakpoint in FBDataSource.getConnection(...) and see what values are actually present when the connection is attempted made.

Are you absolutely certain that the combination of a hostname with port agrees with a path to the FDB-file?

Thorbjørn Ravn Andersen
  • 68,906
  • 28
  • 171
  • 323
0

To connect to the database located on remote machine or cloud (linux) then use following link.

jdbc:firebirdsql:34.212.208.251/3050:/opt/app/db/sample_training.fdb

0

You should try this one. It works for me on Windows.

jdbc:firebirdsql://localhost:3050/C:\firebird\database\EMPLOYEE.FDB

Also make sure you added an exception for port 3050 to the Firewall.

karel
  • 3,880
  • 31
  • 37
  • 42
tjlee
  • 16
  • 1