trouble installing Ruby DBI for MySQL

J

Jeff Anderson

------=_Part_37632_23122444.1132160492095
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hello all, first time poster.

I installed ruby 1.8.2 without a hitch and am trying to install drivers for
accessing MySQL

I tried to install mysql-ruby-2.6 with the following:

ruby extconf.rb --with-mysql-include=3D/usr/include/mysql
--with-mysql-lib=3D/var/lib/mysql
make
make install

(no errors)

and ruby-dbi-all-0.0.21 with:

ruby setup.rb config --with=3Ddbi,dbd_mysql
ruby setup.rb setup
ruby setup.rb install

(no errors here either)

But when i attempt to run a simple script:

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
require "dbi"

DBI.connect("dbi:Mysql:database:host", "user", "pass") do |dbh|

# prepare can take a code block, passes the statement handle
# to it, and automatically calls finish at the end of the block

dbh.prepare("SHOW DATABASES") do |sth|
sth.execute
puts "Databases: " + sth.fetch_all.join(", ")
end

# execute can take a code block, passes the statement handle
# to it, and automatically calls finish at the end of the block

dbh.execute("SHOW DATABASES") do |sth|
puts "Databases: " + sth.fetch_all.join(", ")
end
end
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

I get a bad segfault error:

/usr/local/lib/ruby/site_ruby/1.8/DBD/Mysql/Mysql.rb:465: [BUG] Segmentatio=
n
fault
ruby 1.8.2 (2004-12-25) [i686-linux]

Aborted

Can anyone shed any light on the situation? I am quite stuck on where to fi=
x
this.

Thanks in advance
 
J

Jeff Anderson

------=_Part_2854_8490641.1132239346399
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Did this message even get through? Shall i just go back to programming Perl=
?

Hello all, first time poster.

I installed ruby 1.8.2 without a hitch and am trying to install drivers
for
accessing MySQL

I tried to install mysql-ruby-2.6 with the following:

ruby extconf.rb --with-mysql-include=3D/usr/include/mysql
--with-mysql-lib=3D/var/lib/mysql
make
make install

(no errors)

and ruby-dbi-all-0.0.21 with:

ruby setup.rb config --with=3Ddbi,dbd_mysql
ruby setup.rb setup
ruby setup.rb install

(no errors here either)

But when i attempt to run a simple script:

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
require "dbi"

DBI.connect("dbi:Mysql:database:host", "user", "pass") do |dbh|

# prepare can take a code block, passes the statement handle
# to it, and automatically calls finish at the end of the block

dbh.prepare("SHOW DATABASES") do |sth|
sth.execute
puts "Databases: " + sth.fetch_all.join(", ")
end

# execute can take a code block, passes the statement handle
# to it, and automatically calls finish at the end of the block

dbh.execute("SHOW DATABASES") do |sth|
puts "Databases: " + sth.fetch_all.join(", ")
end
end
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D

I get a bad segfault error:

/usr/local/lib/ruby/site_ruby/1.8/DBD/Mysql/Mysql.rb:465: [BUG]
Segmentation
fault
ruby 1.8.2 (2004-12-25) [i686-linux]

Aborted

Can anyone shed any light on the situation? I am quite stuck on where to
fix
this.

Thanks in advance
 
G

Gregory Brown

Can anyone shed any light on the situation? I am quite stuck on where to = fix
this.

I'm not sure what's going on but you may not need to use extconf.rb

You might try installing mysql via the RubyGems system.

and then reinstalling DBI

What system are you on? This kind of information is usually helpful
for those looking to assist you.
 
F

Francis Hwang

Depending on your environment, Ruby-MySQL can have frustrating
problems. See
http://groups.google.com/group/comp...=dbi+mysql+i686-linux&rnum=3#e1bc495f571301db
and
http://groups.google.com/group/comp...=dbi+mysql+i686-linux&rnum=6#057878404303dc27
for more discussion.

I've had times when Ruby-MySQL through DBI won't work for me, so what
I've done is:

1. Install MySQL-Ruby (which is a pure Ruby version) from
http://www.tmtm.org/en/mysql/ruby/ .
2. Edit your Mysql.rb DBD file. The line that says

require 'mysql'

should instead say

require 'mysql.rb'

You're coercing the DBD to use the .rb version, instead of the .so
version.

This is terribly annoying, of course, but for me it's less annoying
than futzing around endlessly with build configuration.

I'm an admin on the Ruby-DBI project, and with any luck will be able to
commit this into the head in the next few weeks.

f.
 
J

Jeff Anderson

------=_Part_3814_15966474.1132244219482
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Thanks Greg and Francis.

My apologies for not listing the system specs:

Linux/Red Hat v9
MySQL 4.1.9-Max

I will try your suggestions/advice ... thanks again. :)

Depending on your environment, Ruby-MySQL can have frustrating
problems. See

http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/ffe920= e1f74b133a/e1bc495f571301db?q=3Ddbi+mysql+i686-linux&rnum=3D3#e1bc495f57130=
1db
3f16d1f92b/057878404303dc27?q=3Ddbi+mysql+i686-linux&rnum=3D6#057878404303d=
c27
for more discussion.

I've had times when Ruby-MySQL through DBI won't work for me, so what
I've done is:

1. Install MySQL-Ruby (which is a pure Ruby version) from
http://www.tmtm.org/en/mysql/ruby/ .
2. Edit your Mysql.rb DBD file. The line that says

require 'mysql'

should instead say

require 'mysql.rb'

You're coercing the DBD to use the .rb version, instead of the .so
version.

This is terribly annoying, of course, but for me it's less annoying
than futzing around endlessly with build configuration.

I'm an admin on the Ruby-DBI project, and with any luck will be able to
commit this into the head in the next few weeks.

f.


Jeff said:
Hello all, first time poster.

I installed ruby 1.8.2 without a hitch and am trying to install drivers for
accessing MySQL

I tried to install mysql-ruby-2.6 with the following:

ruby extconf.rb --with-mysql-include=3D/usr/include/mysql
--with-mysql-lib=3D/var/lib/mysql
make
make install

(no errors)

and ruby-dbi-all-0.0.21 with:

ruby setup.rb config --with=3Ddbi,dbd_mysql
ruby setup.rb setup
ruby setup.rb install

(no errors here either)

But when i attempt to run a simple script:

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
require "dbi"

DBI.connect("dbi:Mysql:database:host", "user", "pass") do |dbh|

# prepare can take a code block, passes the statement handle
# to it, and automatically calls finish at the end of the block

dbh.prepare("SHOW DATABASES") do |sth|
sth.execute
puts "Databases: " + sth.fetch_all.join(", ")
end

# execute can take a code block, passes the statement handle
# to it, and automatically calls finish at the end of the block

dbh.execute("SHOW DATABASES") do |sth|
puts "Databases: " + sth.fetch_all.join(", ")
end
end
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
I get a bad segfault error:

/usr/local/lib/ruby/site_ruby/1.8/DBD/Mysql/Mysql.rb:465: [BUG] Segmentation
fault
ruby 1.8.2 (2004-12-25) [i686-linux]

Aborted

Can anyone shed any light on the situation? I am quite stuck on where t=
o
fix
this.

Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top