12

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
  • 100,966
  • 191
  • 140
  • 197
Rakesh Goyal
  • 3,117
  • 8
  • 39
  • 69

7 Answers7

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
  • 203,806
  • 29
  • 246
  • 1,045
3

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
  • 17,828
  • 6
  • 117
  • 94
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
  • 3,177
  • 29
  • 26
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
  • 73,784
  • 33
  • 194
  • 347
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
  • 5,489
  • 46
  • 45
  • 50
tjlee
  • 16
  • 2
0

Connection string example for Apache Tomcat properties.xml with specified IP, port, data base alias and encoding:

<entry key="db.url">jdbc:firebirdsql:127.0.0.1/2222:my-db-alias?lc_ctype=WIN1251</entry>

Kyo
  • 61
  • 6