使用JRuby连接到MS SQL服务器

时间:2021-12-19 02:49:36

I'm working on a project that involves some scripting and data storage. The database that I have available to me is MS Sql Server and it is on a windows platform.

我正在做一个涉及脚本和数据存储的项目。我可以使用的数据库是MS Sql Server,它位于windows平台上。

Despite this I'm looking to leverage Ruby to write the script, specifically JRuby. There are a couple of reasons for this

尽管如此,我还是希望利用Ruby来编写脚本,特别是JRuby。这有几个原因

  1. I would like to leverage Prawn to create pdfs
  2. 我想利用虾来创建pdf文件
  3. I just like Ruby
  4. 我只是喜欢红宝石
  5. JRuby and Rawr will allow me to bundle the dependencies so that I don't have to worry about having ruby on the target machine(s).
  6. JRuby和Rawr将允许我打包依赖项,这样我就不必担心目标机器上有ruby了。

When using Matz ruby I can use 'win32ole' for easy database connectivity. However this doesn't work in JRuby for obvious reasons. What is the bast way to connect to MS Sql from JRuby/Java to perform simple Select and Update statements?

当使用Matz ruby时,我可以使用“win32ole”来方便数据库连接。然而,这在JRuby中并不适用,原因很明显。从JRuby/Java连接到MS Sql以执行简单的选择和更新语句的bast方法是什么?

Thanks in advance.

提前谢谢。

1 个解决方案

#1


5  

MS SQL should have a JDBC driver; use that with the JRuby-JDBC bridge: http://wiki.jruby.org/wiki/JDBC

MS SQL应该有一个JDBC驱动程序;使用JRuby-JDBC bridge: http://wiki.jruby.org/wiki/JDBC

#1


5  

MS SQL should have a JDBC driver; use that with the JRuby-JDBC bridge: http://wiki.jruby.org/wiki/JDBC

MS SQL应该有一个JDBC驱动程序;使用JRuby-JDBC bridge: http://wiki.jruby.org/wiki/JDBC