JayBird 中的连接问题

发布于 2024-08-04 23:33:04 字数 1071 浏览 3 评论 0原文

我是 Firebird 的新手,使用其 Java 版本 Jaybird,但无法从数据库(.fdb 文件)连接。问题是这样的:

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

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

使用以下代码:

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

在 Eclipse 项目的构建路径中包含以下文件:

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

还使用 JVM 参数作为 -Djava .library.path="D:\Shared\Firebird\Jaybird-2.1.5JDK_1.5"

告诉我我的方法有什么问题?


感谢 RRUZ 的回复。

实际上,我的连接字符串中的“C:/XLNKREPOS”后面没有空格,这是复制过去的错误。再次&我再次收到以下 SQL 异常:

org.firebirdsql.jdbc.FBSQLException:GDS 异常。 335544375. 不可用的数据库

并且该数据库未在其他程序中使用。

希望我的这篇文章能让您理解我的问题。

谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

烧了回忆取暖 2024-08-11 23:33:04

OP 混合了 Jaybird 支持的两种 jdbc url 格式。

使用

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

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

{...} 用于指示可选部分

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

说好的呢 2024-08-11 23:33:04

我认为问题一定是连接字符串,“C:/XLNKREPOS”后面有一个空格

试试这个

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

再见。

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.

耀眼的星火 2024-08-11 23:33:04

当我收到此错误时,是因为我使用的是 x64 Firebird 版本而不是标准 x86 版本。我认为因为我运行的是 64 位操作系统,所以那些嵌入式二进制文件与我相对应......希望这可以解决您的问题。

故障排除提示:

通过将 apache 站点中的最新 log4j jar 添加到我的项目/类路径中,我还能够进一步诊断其他 Firebird 问题。然后,我将 log4j.properties 文件添加到我的 default/root src 目录中,其中设置了以下属性:

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

我还必须在代码中设置 System.setProperty("FBLog4j", "true");

您可以做的另一件事是确保您正在运行他们的存储库中的最新和最好的版本 http://firebird.cvs.sourceforge.net/viewvc/firebird/client-java/?view=tar

只需解压 tarball 并使用他们提供的构建脚本(build.bat /build.sh)。编译后,查看“output/lib”目录,您将找到最新版本的 jaybird jar(目前为 2.2.0)。您还需要位于“native”目录中的最新 jaybird dll(目前为 22)。我经历了很多痛苦试图解决这个问题。 Firebird 网站上的文档非常过时且写得不好。

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.

聊慰 2024-08-11 23:33:04

我遇到了同样的问题,这是由 localhost 之前的斜杠引起的。
该网址应该是:

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

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",
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文