0

I am trying to use the Firebird embeded DB together with Hibernate, but I get the following error when trying to create the database:

Caused by: org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544344. I/O error during "CreateFile (open)" operation for file "D:\DB\FIREBIRD.FDB"
Error while trying to open file
null
    at org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:123)
    at org.firebirdsql.jdbc.AbstractDriver.connect(AbstractDriver.java:126)
    at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:204)
    at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:292)
    at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:214)
    ... 32 more
Caused by: org.firebirdsql.gds.GDSException: I/O error during "CreateFile (open)" operation for file "D:\DB\FIREBIRD.FDB"
Error while trying to open file
null
    at org.firebirdsql.gds.impl.jni.JniGDSImpl.native_isc_attach_database(Native Method)
    at org.firebirdsql.gds.impl.jni.BaseGDSImpl.iscAttachDatabase(BaseGDSImpl.java:158)
    at org.firebirdsql.jca.FBManagedConnection.<init>(FBManagedConnection.java:105)
    at org.firebirdsql.jca.FBManagedConnectionFactory.createManagedConnection(FBManagedConnectionFactory.java:490)
    at org.firebirdsql.jca.FBStandAloneConnectionManager.allocateConnection(FBStandAloneConnectionManager.java:69)
    at org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:120)
    ... 36 more

What I have done until now:

  1. I've set the hibernate configuration.
    Driver = "org.firebirdsql.jdbc.FBDriver",
    Dialect = "org.hibernate.dialect.FirebirdDialect",
    Url = "jdbc:firebirdsql:embedded:D:\DB\FIREBIRD.FDB",

  2. I have added the jaybird-full jar to my classpath.

  3. I have added jaybird22.dll, fbembed.dll (the whole folder) to my path.

The dlls seem to be loaded since if I delete the dlls I get and exception telling me that jaybird22.dll cannot be found.

Any idea what could be wrong ?

4

1 回答 1

1

看来我缺少的步骤是手动创建数据库文件:

FBManager manager = new FBManager(GDSType.getType("EMBEDDED"));
manager.start();
manager.createDatabase(myDbFile, username, password);
manager.stop();
于 2013-06-13T05:28:10.940 回答