Varun Verma
Varun Verma

Reputation: 724

Connect to MySQL in Ruby using NetBeans

I've downloaded the dbd-mysql-0.4.4.zip and linked it to my project. While I try to run a demo code from NetBeans the very first line (shown below) gives me an error. Is there a different way to do it?

require "dbi";

I also tried this command from the command prompt:

jruby setup.rb config --with=dbi,dbd_mysql

It gave me the following error:

config: unknown option --with=dbi,dbd_mysql  
Try ruby setup.rb --help for detailed usage.

Any suggestions please?

Upvotes: 0

Views: 484

Answers (1)

Ken Bloom
Ken Bloom

Reputation: 58790

If you're working with jruby, you need to use dbd-jdbc, because dbd-mysql depends on mysql a native extension (written in C) for Matz' Ruby interpreter.

Install it using rubygems: jruby -S gem install dbi, and add require 'rubygems' as the first line of your code.

Upvotes: 1

Related Questions