如何在Netbeans 6.5中制作数据库服务连接到SQLite数据库?
我使用 Netbeans IDE (6.5) 并且有一个 SQLite 2.x 数据库。 我从 zentus.com 安装了 JDBC SQLite 驱动程序,并在 Nebeans 服务面板中添加了新驱动程序。 然后尝试从“服务”> 连接到我的数据库文件 我的数据库使用此 URL 的数据库:
jdbc:sqlite:/home/farzad/netbeans/myproject/mydb.sqlite
但无法连接。 我得到这个例外:
org.netbeans.modules.db.dataview.meta.DBException: Unable to Connect to database : DatabaseConnection[name='jdbc:sqlite://home/farzad/netbeans/myproject/mydb.sqlite [ on session]']
at org.netbeans.modules.db.dataview.output.SQLExecutionHelper.initialDataLoad(SQLExecutionHelper.java:103)
at org.netbeans.modules.db.dataview.output.DataView.create(DataView.java:101)
at org.netbeans.modules.db.dataview.api.DataView.create(DataView.java:71)
at org.netbeans.modules.db.sql.execute.SQLExecuteHelper.execute(SQLExecuteHelper.java:105)
at org.netbeans.modules.db.sql.loader.SQLEditorSupport$SQLExecutor.run(SQLEditorSupport.java:480)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
我应该做什么? :(
I use Netbeans IDE (6.5) and I have a SQLite 2.x database. I installed a JDBC SQLite driver from zentus.com and added a new driver in Nebeans services panel. Then tried to connect to my database file from Services > Databases using this URL for my database:
jdbc:sqlite:/home/farzad/netbeans/myproject/mydb.sqlite
but it fails to connect. I get this exception:
org.netbeans.modules.db.dataview.meta.DBException: Unable to Connect to database : DatabaseConnection[name='jdbc:sqlite://home/farzad/netbeans/myproject/mydb.sqlite [ on session]']
at org.netbeans.modules.db.dataview.output.SQLExecutionHelper.initialDataLoad(SQLExecutionHelper.java:103)
at org.netbeans.modules.db.dataview.output.DataView.create(DataView.java:101)
at org.netbeans.modules.db.dataview.api.DataView.create(DataView.java:71)
at org.netbeans.modules.db.sql.execute.SQLExecuteHelper.execute(SQLExecuteHelper.java:105)
at org.netbeans.modules.db.sql.loader.SQLEditorSupport$SQLExecutor.run(SQLEditorSupport.java:480)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
What should I do? :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Zentus SQLiteJDBC 的当前版本是 v053,基于 SQLite 3.6.1。 它不会打开 2.x SQLite 数据库。 也许您可以使用 SQLite 2.x 命令行工具来转储数据库,并使用 Sqlite3 命令行工具来加载它。 使用Zentus SQLiteJDBC 访问新的SQLite 3.x 数据库。
或者,使用支持 SQLite 2 的 JDBC 驱动程序,例如这个。
The current version of Zentus SQLiteJDBC is v053, based on SQLite 3.6.1. It will not open a 2.x SQLite database. Perhaps you can use SQLite 2.x command line tool to .dump your database, and the Sqlite3 command line tool to .load it. The use Zentus SQLiteJDBC to access the new SQLite 3.x database.
Alternatively, use a JDBC driver that supports SQLite 2 such as this one.
又是我……
我在第一次尝试中犯了两个错误。 将 CLASSPATH 设置为系统变量后(希望我没有破坏其他内容:)),将 sqlite_jni.dll 放入 system32 文件夹并更正
JDBC url
我已经成功了:)我还下载了他们的
SQLite ODBC 包装器
。 安装它并通过普通和基于UTF8
的ODBC
驱动程序连接到我的SQLite2
数据库。 我还使用内置的 NetBeans JDBC-ODBC 桥驱动程序来设置此连接。所有三个连接均已创建,但是:
普通 ODBC 驱动程序
:我看到文本数据的编码错误。 所有其他列均正确显示UTF8 ODBC 驱动程序
:我根本看不到文本数据。 所有其他列均正确显示JDBC 驱动程序
:我根本没有看到任何列。“Select * from my_any_table”
始终返回一个空的单个列我的数据库中有基于俄语的数据。
所以...目前我已经返回到 sqlite 命令行界面:))
It's againg me...
I have made two mistakes during my first attempt. After setting
CLASSPATH
as a system variable (hope I didn’t broke smth else :)), puttingsqlite_jni.dll
to thesystem32
folder and correctingJDBC url
I have got a success :)I also have downloaded their
SQLite ODBC wrapper
. Installed it and made a connection to mySQLite2
database via ordinary andUTF8
basedODBC
driver. I also used built inNetBeans JDBC-ODBC
Bridge driver to be able to set up this connection.All three connections have been created but:
ordinary ODBC driver
: I see text data in a wrong encoding. All other columns are displayed correctlyUTF8 ODBC driver
: I don’t see text data at all. All other columns are displayed correctlyJDBC driver
: I don’t see any column at all."Select * from my_any_table"
always returns an empty single columnI have Russian based data in my database.
So...currently I have returned to sqlite command line interface :))