简体   繁体   English

从Java访问NexusDB

[英]Accessing NexusDB from Java

I am trying to get info from an embedded db called NexusDB using java. 我正在尝试使用Java从称为NexusDB的嵌入式数据库中获取信息。

Alternative 1: 选择1:

I've read in NexusDB website that there is an ODBC driver so I might use it with unixODBC. 我在NexusDB网站上看到有一个ODBC驱动程序,因此我可以将它与unixODBC一起使用。 Then I need to do a JDBC-ODBC Bridge as stated here . 然后,我需要按此处所述进行JDBC-ODBC桥接。

Alternative 2: 选择2:

Get some sort of application to migrate NexusDB db to another db. 获取某种应用程序以将NexusDB数据库迁移到另一个数据库。 Would like to know one. 想知道一个。

I would like to know if anyone ever this this, what's the best solution? 我想知道是否有人这样做,最好的解决方案是什么?

Thanks for reading. 谢谢阅读。

Alternative 1: 选择1:

Not possible. 不可能。

unixODBC needs linux drivers and there aren't for nexusDB. unixODBC需要linux驱动程序,而nexusDB则不需要。

Alternative 2: 选择2:

Didn't find any. 没找到。

Solution so far 到目前为止的解决方案

Writting a small webservice with delphi or get odbc and use that in a small proxy. 用delphi编写一个小型Web服务或获取odbc,并在小型代理中使用它。 In other words, instead of connecting to the nexusdb server you connect to a dedicated application or webservice pass on the information and that app does connect to nexusd and writes the data. 换句话说,不是连接到nexusdb服务器,而是连接到专用应用程序或Web服务传递信息,并且该应用程序确实连接到nexusd并写入数据。

I've had some success running nexusDB under wine. 在葡萄酒下运行nexusDB取得了一些成功。

I was able to set up a WINEPREFIX, follow the instructions here to get at wine's odbc management panel (by default it pipes into unixODBC, and as Macarse noted, that's a dead end), set up a DSN there and test that it could access the data. 我能够设置WINEPREFIX,按照此处的说明进入wine的odbc管理面板(默认情况下,它通过管道传输到unixODBC,并且正如Macarse所指出的那样,这是一个死胡同),在那里设置DSN并测试它是否可以访问数据。

The next thing I tried was installing win32 PHP and writing a quick and dirty test using odbc_connect. 我尝试的下一件事是安装win32 PHP,并使用odbc_connect编写了快速而肮脏的测试。 After wasting a good chunk of time accidently using the linux php binary and wondering why it couldn't use the (inbuilt on win32 ONLY) function odbc_connect, I did get it working. 在使用Linux php二进制文件意外地浪费了大量时间并想知道为什么它不能使用(仅内置于win32的)函数odbc_connect之后,我确实使它工作了。

HINT: To save yourself feeling like banging your head against a brick wall, remember that any attempts to run php scripts in this environment MUST look like this 提示:为避免使自己像撞墙一样,请记住,在这种环境下运行php脚本的任何尝试都必须像这样

WINEPREFIX=/home/you/yourprefix wine php c:\\phptest.php

NOT

WINEPREFIX=/home/you/yourprefix php c:\\phptest.php

The second version will use the linux php binary. 第二个版本将使用linux php二进制文件。 Feeling pretty stupid after running the second version a good dozen times AND googling the error some before realising what was wrong - I think I need to get up later if I want to be able to still make things work at 4am :( 在运行第二个版本十次之后感觉非常愚蠢,并且在意识到错误之前对错误进行了一些搜索-我想我需要稍后起床,如果我想仍然能够在凌晨4点使事情正常进行:(

(the c:\\ path in the above examples can be passed as /home/you/yourprefix/drive_c/whatever if you prefer - relative paths are also fine) (如果您愿意,上述示例中的c:\\路径可以作为/home/you/yourprefix/drive_c/whatever传递-相对路径也可以)

And yes, I know this is a necro post, but it's a pretty niche situation, there isn't a lot of information out there making nexusdb and odbc play nice on linux, and if this information was available to me a few months back when I was googling around and came across this thread it could have saved me a good chunk of time. 是的,我知道这是一篇死灵文章,但这是一个相当利基的情况,那里没有太多信息可以使nexusdb和odbc在linux上很好地播放,如果几个月前我可以得到这些信息,我正在四处搜寻,遇到了这个线程,这可能节省了我很多时间。 Hope someone else finds it helpful. 希望其他人觉得有帮助。

If you connect to Nexus via .NET maybe you can use IKVM to run your Java app and connect through the .NET api? 如果您通过.NET连接到Nexus,也许可以使用IKVM运行Java应用程序并通过.NET api连接?

Otherwise I think your own "solution so far" sounds ok. 否则,我认为您自己的“到目前为止的解决方案”听起来还可以。

Best Anders 最佳安德斯

Since it is embedded (and you probably have full access to the machine), what about copying database files to a Windows system, setting up NexusDB and its ODBC driver, then using an ODBC-JDBC bridge on that machine? 由于它是嵌入式的(并且您可能拥有对计算机的完全访问权限),将数据库文件复制到Windows系统,设置NexusDB及其ODBC驱动程序,然后在该计算机上使用ODBC-JDBC桥该怎么办? Once the bridge is running, you can set up a new JDBC-compatible DBMS of your choice, connect, and use a little code to SELECT from NexusDB and insert to your new database. 桥运行后,您可以选择一个新的兼容JDBC的DBMS,进行连接,并使用一些代码从NexusDB中进行SELECT,然后插入到新数据库中。

If you're looking to migrate to another embedded DBMS, I'm using H2 Database for Java, and I've got to say it's really sweet. 如果您要迁移到另一个嵌入式DBMS,那么我正在使用Java的H2数据库 ,我必须说它确实很不错。 Both embedded and client/server modes, cross-platform, and really fast for anything under 1M rows. 嵌入式和客户端/服务器模式都可以跨平台使用,并且对于1M行以下的任何事物都非常快。 Supports pretty much any feature you'd have in an embedded DBMS and then some. 支持几乎任何您在嵌入式DBMS中拥有的功能,然后再提供某些功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM