如果 derby.jar 位于 Eclipse 工作区中,则无法连接到 Derby 数据库
我一直在尝试通过 Eclipse Data Tools Platform 创建 Derby DB,一开始我无法让它工作。无论我做什么,我总是遇到同样的错误:
Could not connect to New Derby.
Error creating SQL Model Connection connection to New Derby. (Error: null)
java.lang.NullPointerException
Error creating JDBC Connection connection to New Derby. (Error: null)
java.lang.NullPointerException
当我尝试这个时包含驱动程序的 derby.jar 文件位于“workspace/myproject/lib”文件夹内。然后我将相同的文件放到我的桌面上,将驱动程序设置为指向我的 derby.jar 的新位置,然后一切都开始自动工作...
我做了一些实验,它碰巧在任何地方都可以工作,除了当我放入其中时我的 Eclipse 工作区文件夹。为什么?
最重要的是:如果我想在不同的机器上部署我的应用程序,我是否需要将 derby.jar 放在我的项目文件夹中(也就是我项目的 .jar 中)?
预先感谢大家
编辑:我已经通过 Eclipse 界面将 derby.jar 添加到项目中,具体方法如下:
I've been trying to create a Derby DB via Eclipse Data Tools Platform and at the beginning I couldn't manage to get it to work.. no matter what I did, I always got the same error:
Could not connect to New Derby.
Error creating SQL Model Connection connection to New Derby. (Error: null)
java.lang.NullPointerException
Error creating JDBC Connection connection to New Derby. (Error: null)
java.lang.NullPointerException
While I was trying this the derby.jar file containing the driver was inside "workspace/myproject/lib" folder. Then I put the same exact file to my Desktop, set the driver to point to the new location of my derby.jar and all started to work automagically...
I did some experiments and it happens that it works everywhere EXCEPT when I put inside my Eclipse workspace folder. Why?
And most important: if I want to deploy my application on different machines do I need the derby.jar inside my project folder (and thus inside the .jar of my project)?
Thanks in advance to everyone
EDIT: I already added derby.jar to the project through Eclipse interface, here's how:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须使用 eclipse 的界面添加 jar 文件。该网站展示了如何操作:
http://www.cs。 duke.edu/courses/cps004g/fall05/assign/final/addlibrary.html
You have to add the jar file using eclipse's interface. This website shows how:
http://www.cs.duke.edu/courses/cps004g/fall05/assign/final/addlibrary.html