# DBI, and SQLite Problems

**URL:** <https://www.ruby-forum.com/t/dbi-and-sqlite-problems/108111>\
**Category:** Ruby\
**Created:** [June 29, 2007, 2:48am UTC](https://www.ruby-forum.com/t/dbi-and-sqlite-problems/108111 "2007-06-29T02:48:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ari\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@Ari\_B](https://www.ruby-forum.com/u/Ari_B)\
**Post date:** [June 29, 2007, 2:48am UTC](https://www.ruby-forum.com/t/dbi-and-sqlite-problems/108111/1 "2007-06-29T02:48:10Z")

</div>

Uhoh!  
I need to work with MySQL databases, and my job is to enter in maybe  
7000 entries into various tables. Since I’m getting paid by the hour,  
entering the data in by hand would be a great way to save for college

- but I don’t want to do that. I am looking to enter in the data via  
RUBY!!!

After doing some research for a nice MySQL module in ruby, I came  
across a very nice one ([Ruby Revival](http://www.troubleshooters.com/codecorn/ruby/)  
database/index.htm). But to use it, I need DBI to be installed first.  
However, whenever I type:  
ruby setup.rb setup  
I get an error:  
checking for sqlite\_open() in -lsqlite… no  
\*\*\* extconf.rb failed \*\*\*  
This, as you can see, cause me to fail at making the makefile.

What should I do to fix this? I am running Mac OS X and have MySQL  
installed (although would really rather otherwise).

Help!  
-------------------------------------------------------|  
~ Ari  
crap my sig won’t fit

---

<div class="post-metadata">

**Author:** ![Ari\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@Ari\_B](https://www.ruby-forum.com/u/Ari_B)\
**Post date:** [June 29, 2007, 3:20am UTC](https://www.ruby-forum.com/t/dbi-and-sqlite-problems/108111/2 "2007-06-29T03:20:12Z")

</div>

On Jun 28, 2007, at 19:47 , Ari B. wrote:

> What should I do to fix this? I am running Mac OS X and have MySQL  
> installed (although would really rather otherwise).

How do you have Ruby installed? If you installed Ruby yourself, you  
might already have dbi as part of the installation. (That appears to  
be the case on my machine.) Also, you might consider installing  
sqlite via Macports, which might provide you with the necessary library.

Michael G.  
grzm seespotcode net

---

<div class="post-metadata">

**Author:** ![Ari\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@Ari\_B](https://www.ruby-forum.com/u/Ari_B)\
**Post date:** [June 29, 2007, 3:27am UTC](https://www.ruby-forum.com/t/dbi-and-sqlite-problems/108111/3 "2007-06-29T03:27:13Z")

</div>

On Jun 28, 2007, at 20:18 , Michael G. wrote:

> On Jun 28, 2007, at 19:47 , Ari B. wrote:
> 
> > What should I do to fix this? I am running Mac OS X and have MySQL  
> > installed (although would really rather otherwise).
> 
> How do you have Ruby installed? If you installed Ruby yourself, you  
> might already have dbi as part of the installation. (That appears  
> to be the case on my machine.)

Correction: I misread my installation.

From the README in ruby-dbi:

> To install dbi and some DBDs:
> 
> ruby setup.rb config --with=dbi,dbd\_pg, …  
> ruby setup.rb setup  
> ruby setup.rb install

So, I think you’d want something along the lines of

ruby setup.rb config --with=dib, dbd\_mysql or somesuch.

Reading README’s and Google is definitely your friend–second link  
after googling “ruby-dbi mysql install”:

[http://www.kitebird.com/articles/ruby-dbi.html](http://www.kitebird.com/articles/ruby-dbi.html)

Michael G.  
grzm seespotcode net

---

<div class="post-metadata">

**Author:** ![Ari\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@Ari\_B](https://www.ruby-forum.com/u/Ari_B)\
**Post date:** [June 29, 2007, 4:20am UTC](https://www.ruby-forum.com/t/dbi-and-sqlite-problems/108111/4 "2007-06-29T04:20:18Z")

</div>

On Jun 28, 2007, at 9:26 PM, Michael G. wrote:

> So, I think you’d want something along the lines of
> 
> ruby setup.rb config --with=dib, dbd\_mysql or somesuch.

I did ruby setup.rb config --with=dbd\_mysql, as well as with  
dbd\_sqlite. mysql worked perfectly, and sqlite did not. I assume this  
is because I do not have the sqlite software installed, as I do with  
mysql?

> Reading README’s and Google is definitely your friend–second link  
> after googling “ruby-dbi mysql install”:

I read the README and searched on Google, but it seems that all this  
time I was searching for the wrong stuff!

while true  
puts ‘Thank You!’  
end  
---------------------------------------------------------------|  
~Ari  
“I don’t suffer from insanity. I enjoy every minute of it” --1337est  
man alive

---

<div class="post-metadata">

**Author:** ![Ari\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@Ari\_B](https://www.ruby-forum.com/u/Ari_B)\
**Post date:** [June 29, 2007, 5:36pm UTC](https://www.ruby-forum.com/t/dbi-and-sqlite-problems/108111/5 "2007-06-29T17:36:45Z")

</div>

On 6/28/07, Ari B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Jun 28, 2007, at 9:26 PM, Michael G. wrote:
> 
> > So, I think you’d want something along the lines of
> > 
> > ruby setup.rb config --with=dib, dbd\_mysql or somesuch.
> 
> I did ruby setup.rb config --with=dbd\_mysql, as well as with  
> dbd\_sqlite. mysql worked perfectly, and sqlite did not. I assume this  
> is because I do not have the sqlite software installed, as I do with  
> mysql?

You need sqlite as well as the sqlite3-ruby gem

This howto is for camping, but should do the trick:  
[http://code.whytheluckystiff.net/camping/wiki/BeAlertWhenOnSqlite3](http://code.whytheluckystiff.net/camping/wiki/BeAlertWhenOnSqlite3)

Also, you might consider using ActiveRecord standalone instead of DBI.  
Or possibly Sequel, or something else that isn’t painful like DBI is.  
😉

If you wanted to use AR outside of Rails, I wrote an article that  
might be helpful.

> **[O'Reilly Media - Technology and Business Training](https://www.oreilly.com)**
>
> Gain technology and business knowledge and hone your skills with learning resources created and curated by O'Reilly's experts: live online training, video, books, our platform has content from 200+ of the world's best publishers.

Good luck,  
-greg

---

<div class="post-metadata">

**Author:** ![Ari\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@Ari\_B](https://www.ruby-forum.com/u/Ari_B)\
**Post date:** [June 29, 2007, 5:25pm UTC](https://www.ruby-forum.com/t/dbi-and-sqlite-problems/108111/6 "2007-06-29T17:25:44Z")

</div>

On Jun 28, 2007, at 21:19 , Ari B. wrote:

> I assume this is because I do not have the sqlite software  
> installed, as I do with mysql?

That appears to be the case. The DBD modules often need to link to  
libraries for their corresponding server. IIRC, the Perl Sqlite CPAN  
module even installs Sqlite as part of its installation. It’s quite  
small.

Michael G.  
grzm seespotcode net
