我是Ubuntu的新手,我剛安裝在電腦上。我安裝了Samba並共享了文件夾「/ samba」和「/ hd」。我下載並安裝了Firebird並複製了我在Windows上創建的數據庫並將其放入「/ samba」中。這是我的Java代碼:無法連接到Firebird(Ubuntu)
public static Connection getConnection() throws SQLException {
Connection connection = null;
try {
Class.forName("org.firebirdsql.jdbc.FBDriver");
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
connection = DriverManager.getConnection("jdbc:firebirdsql://localhost:3050/samba/LNX.FDB", "sysdba",
"masterkey");
return connection;
}
public static void main(String[] args) throws SQLException {
getConnection();
}
我得到這個錯誤:
Exception in thread "main" org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544344. I/O error during "open" operation for file "samba/LNX.FDB"
Error while trying to open file
null
at org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:120)
at org.firebirdsql.jdbc.AbstractDriver.connect(AbstractDriver.java:136)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at br.com.ipsnet.jdbc.ConnectionFactory.getConnection(ConnectionFactory.java:16)
at br.com.ipsnet.jdbc.ConnectionFactory.main(ConnectionFactory.java:22)
Caused by: org.firebirdsql.gds.GDSException: I/O error during "open" operation for file "samba/LNX.FDB"
Error while trying to open file
null
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.readStatusVector(AbstractJavaGDSImpl.java:2098)
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.receiveResponse(AbstractJavaGDSImpl.java:2048)
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.internalAttachDatabase(AbstractJavaGDSImpl.java:463)
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.iscAttachDatabase(AbstractJavaGDSImpl.java:411)
at org.firebirdsql.jca.FBManagedConnection.<init>(FBManagedConnection.java:105)
at org.firebirdsql.jca.FBManagedConnectionFactory.createManagedConnection(FBManagedConnectionFactory.java:509)
at org.firebirdsql.jca.FBStandAloneConnectionManager.allocateConnection(FBStandAloneConnectionManager.java:65)
at org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:118)
... 5 more
如果我去 「/桑巴」,然後鍵入:
isql-fb
connect "localhost:/samba/LNX.FDB" user 'SYSDBA' password 'masterkey';
這工作完全正常,我可以選擇,刪除,更新,插入......沒有任何問題。
如果我用我的IBExpert Windows機器連接到我的數據庫,在Ubuntu它說:
Unable to complete network request to host "Server-Test".
Failed to estabilish connection.
如果我使用Flamerobin它說:
An assertion failed!
../src/common/strconv.cpp(3031): assert "Assert failure" failed in wxCSConv(): invalid encoding value in wxCSConv ctor
但它連接。我可以選擇,刪除,更新...
也許你會需要允許訪問爲IBExpert,你的Java應用程序的目錄... – Majkl
我做了「chmod 755/samba -R」,錯誤仍然存在。 – Bolaum