mysql-ruby

P

Paul Vudmaska

%$@#%$ i know i've abused this list with more questions than answers but
i dont know who else to ask.
I'm willing to set a phpBB for these stupid newby tricks and avoid some
of this drivel if anyone is interested. I'd like to contribute something
other than q's. A bb would better support things like 'why is ruby
better than python', 'what makes a web app framework'- a section for
those would work nicely
and could get better over time and other questions that are redundant.
Or has this been brought up.

I like _using_ ruby but working in it's environment has really kicked my
ass. Installation problems in particular.

I'm still messing with mysql-ruby. I'm not giving up.

I dont have the mysql.h header file on my system - perhaps installed
through rpm? No developer pack. No header files.
[root@u15154846 include]# locate mysql.h
/usr/share/doc/courier-imap-1.7.3/README.authmysql.html
/usr/share/doc/courier-imap-3.0.1/README.authmysql.html
/usr/local/lib/mysql-standard-4.0.20-pc-linux-i686/include/mysql.h

I have not installed mysql 4 above yet and when i point
--with-mysql-include to that dir it still fails.

Would this be the reason why i'm unable to get past extconf.rb, and ill
it's iterations?

ruby 1.81
redhat
mysql-ruby 2.4.5
mysql 3.23

thanks
paul
 
M

Michael Neumann

%$@#%$ i know i've abused this list with more questions than answers but
i dont know who else to ask.
I'm willing to set a phpBB for these stupid newby tricks and avoid some
of this drivel if anyone is interested. I'd like to contribute something
other than q's. A bb would better support things like 'why is ruby
better than python', 'what makes a web app framework'- a section for
those would work nicely
and could get better over time and other questions that are redundant.
Or has this been brought up.

I like _using_ ruby but working in it's environment has really kicked my
ass. Installation problems in particular.

I'm still messing with mysql-ruby. I'm not giving up.

I dont have the mysql.h header file on my system - perhaps installed
through rpm? No developer pack. No header files.
[root@u15154846 include]# locate mysql.h
/usr/share/doc/courier-imap-1.7.3/README.authmysql.html
/usr/share/doc/courier-imap-3.0.1/README.authmysql.html
/usr/local/lib/mysql-standard-4.0.20-pc-linux-i686/include/mysql.h

I have not installed mysql 4 above yet and when i point
--with-mysql-include to that dir it still fails.

Would this be the reason why i'm unable to get past extconf.rb, and ill
it's iterations?

Could you please send the exact output of extconf.rb as well as with
which parameters you started it (exactly)!
If there's a source rpm for mysql or a developer package, please install
them too.

And please keep in mind that this might (or might not) be more a problem
of your OS than of Ruby (there are lot's of OSes out there where
installing mysql-ruby just works). Of course this does not help you
much... and of course lacking support of ruby packages in redhat is not
good for ruby.

Regards,

Michael
 
M

Michael Neumann

But he uses a package which is not installed "the Redhat way(tm)",
otherwise the libs are in /usr/lib/mysql and the include files in
/usr/include/mysql. So Redhat isn't to blame, actually.

Sorry, this was no attempt to blame Redhat.

Regards,

Michael
 
D

Dick Davies

* Paul Vudmaska said:
I'm still messing with mysql-ruby. I'm not giving up.

Attaboy :)
I dont have the mysql.h header file on my system - perhaps installed
through rpm? No developer pack. No header files.

You neet those.
[root@u15154846 include]# locate mysql.h
/usr/share/doc/courier-imap-1.7.3/README.authmysql.html
/usr/share/doc/courier-imap-3.0.1/README.authmysql.html
/usr/local/lib/mysql-standard-4.0.20-pc-linux-i686/include/mysql.h

I have not installed mysql 4 above yet and when i point
--with-mysql-include to that dir it still fails.

Would this be the reason why i'm unable to get past extconf.rb, and ill
it's iterations?

I'd ignore that one, you want the headers for the version you run.

Yes. mysql-ruby needs the includes (the headers) to know how
to use the mysql libraries.

I just got it working with CVS ruby on NetBSD, on a Linux it
should be simpler. But install mysql-3.23-devel. then try extconf again.
 
P

Paul Vudmaska

Dick said:
Attaboy :)

:)


You neet those.
Took me awhile but i figured that out. It is not exactly clear from any
of the docs from anywhere i could find. My inexperience with linux has
been a real detriment to my health the last month.
[root@u15154846 include]# locate mysql.h
/usr/share/doc/courier-imap-1.7.3/README.authmysql.html
/usr/share/doc/courier-imap-3.0.1/README.authmysql.html
/usr/local/lib/mysql-standard-4.0.20-pc-linux-i686/include/mysql.h

I have not installed mysql 4 above yet and when i point
--with-mysql-include to that dir it still fails.

Would this be the reason why i'm unable to get past extconf.rb, and ill
it's iterations?

I'd ignore that one, you want the headers for the version you run.
I want/need to run 4.0. One of the reasons i've made the fateful
decision to move to another host was to, hopefully,
avoid the 'mysql has gone away' error (if you see that sob tell him to
get his ass back in the box!) I _understand_ this is fixed with 4.0.
The linux admin, which fixed
the problem, i'm running 4.0 with dbi:mysql, i mute on how he fixed it.
Pissing me off to no end.

In lieu of grabbing the dev packages i installed 4.0 - headers and all.
Then ran through dbi, mysql-ruby(pointing to new headers) - pointing
mysql-ruby to
the headers installed. Life was good. Untill i tried running selects.
Where all goes south - exhibiting the same symptoms as my current host.
I'm using apache 2 here - was 1.3 - so it aint apache. I'm 90% sure it
has some library incompatibility in mysql 4.0.
Yes. mysql-ruby needs the includes (the headers) to know how
to use the mysql libraries.

I just got it working with CVS ruby on NetBSD, on a Linux it
should be simpler. But install mysql-3.23-devel. then try extconf again.
I could move back to 3.23, but then, i'd just be back where i was.
My introduction to open source, especially over the last 6 months, has
been rewarding and harrowing. Open sources' achailles heel is that only
the sharpest tools
in the toolbox are allowed to play. M$, with all the money in the world
and uber marketing skill aside, has penetrated virtually every market
because the average joes like myself can be productive - or at least
think he is :). Even when i fix this my next big project will be in .Net
and this list will be free of my pithy, dim witted comments. Like this one.

Get a freaking forum. Developers with skills on both ends of the spectum
will be more productive. You need a better way(subjective) to seperate
the wheat from the chaff - the esoteric from the 'why this does not
work'. It will get better over time.
Oranization.Orginaization.Organization.
Put ruby on rails( or some such) on the fast track. Develop a killer app
with it.Use that app in a high profile setting - like Ruby-lang.org.
Emulate what is best
out there. Make it better. Make it pretty. Make it easy to install.
Get off your high horse. If some dumb ass comes in and says 'python
rocks' - there might be some merit to his story. Listen before you jab.

I really do appreciate you answering.
 
P

Philipp Kern

I could move back to 3.23, but then, i'd just be back where i was.

Your problem is that MySQL 4 is installed the wrong way.
extconf.rb can't find the include files at this uncommon location.
I think you should edit it so that it could find mysql_config correctly,
which would lead to the correct configuration of mysql-ruby in regard
to include files and library directories.

Bye,
phil
 
P

Paul Vudmaska

Philipp said:
Your problem is that MySQL 4 is installed the wrong way.
I wish this were the case. However i did point to the _correct_
lirbraries installing mysql-ruby.
[root@u15154846 mysql-ruby-2.4.5]# ruby -I. ./test.rb localhost admin @ou812
connect.............ok
create_db...........ok
create_table........ok
insert..............ok
select..............ok
update..............ok
drop_table..........ok
drop_db.............ok
close...............ok

The above was after i pointed to the corrrect include place.
tried --with-mysql-config as well without luck.

extconf.rb can't find the include files at this uncommon location.
I think you should edit it so that it could find mysql_config correctly,
which would lead to the correct configuration of mysql-ruby in regard
to include files and library directories.

Bye,
phil

Thanks for answering. Take another swing.

:paul
 
D

Dick Davies

Took me awhile but i figured that out. It is not exactly clear from any
of the docs from anywhere i could find. My inexperience with linux has
been a real detriment to my health the last month.

Not your fault, it's RedHats. Having the headers in a separate RPM
is a bloody stupid idea.
[root@u15154846 include]# locate mysql.h
/usr/local/lib/mysql-standard-4.0.20-pc-linux-i686/include/mysql.h

I have not installed mysql 4 above yet and when i point
--with-mysql-include to that dir it still fails.

It looks like there's bits of an install left behind in usr/local.

In lieu of grabbing the dev packages i installed 4.0 - headers and all.
Then ran through dbi, mysql-ruby(pointing to new headers) - pointing
mysql-ruby to
the headers installed. Life was good. Untill i tried running selects.
Where all goes south - exhibiting the same symptoms as my current host.

I'm using apache 2 here - was 1.3 - so it aint apache. I'm 90% sure it
has some library incompatibility in mysql 4.0.

It being ruby? To be honest I only threw in the DBI stuff and
checked it could connect and read tables/databases, so maybe.

I could move back to 3.23, but then, i'd just be back where i was.

No that shouldn't matter, from the output below I thought you
wanted 3.23.
My introduction to open source, especially over the last 6 months, has
been rewarding and harrowing. Open sources' achilles heel is that only
the sharpest tools
in the toolbox are allowed to play

I don't think that's true so much anymore, I think you've just had
trouble because the build of mysql you have is screwed.
Have you tried just building from source? I know this is seen as
'l33t' by a lot of new users, but to be honest it's usually the
safest way to get a working system. Beats the usual 'this rpm was
compiled for somelib version bla, go get that' nonsense.
 
P

Paul Vudmaska

Dick said:
Not your fault, it's RedHats. Having the headers in a separate RPM
is a bloody stupid idea.
I certainly can agree.
[root@u15154846 include]# locate mysql.h
/usr/local/lib/mysql-standard-4.0.20-pc-linux-i686/include/mysql.h

I have not installed mysql 4 above yet and when i point
--with-mysql-include to that dir it still fails.

It looks like there's bits of an install left behind in usr/local.
Here is the view from ssh.
[root@u15154846 mysql-ruby-2.4.5]# ruby extconf.rb
--with-mysql-include=/usr/local/lib/mysql-standard-4.0.20-pc-linux-i686/include
--with-mysql-lib=/usr/local/lib
checking for mysql_query() in -lmysqlclient... yes
checking for mysql.h... yes
creating Makefile
[root@u15154846 mysql-ruby-2.4.5]# make && make install
gcc -fPIC -g -O2 -I. -I/usr/local/lib/ruby/1.8/i686-linux
-I/usr/local/lib/ruby/1.8/i686-linux -I. -DHAVE_MYSQL_H
-I/usr/local/lib/mysql-standard-4.0.20-pc-linux-i686/include
-I/usr/local/include -c mysql.c
gcc -shared -L"/usr/local/lib" -L"/usr/local/lib" -o mysql.so mysql.o
-lmysqlclient -ldl -lcrypt -lm -lc
install -c -p -m 0755 mysql.so /usr/local/lib/ruby/site_ruby/1.8/i686-linux
[root@u15154846 mysql-ruby-2.4.5]# ruby -I. ./test.rb localhost admin @ou812
connect.............ok
create_db...........ok
create_table........ok
insert..............ok
select..............ok
update..............ok
drop_table..........ok
drop_db.............ok
close...............ok

All seems ok.

here is dbi.
[root@u15154846 ruby-dbi-all]# ruby setup.rb config
--with=dbi,dbd_mysql,dbd_pg
entering config phase...
config done.
[root@u15154846 ruby-dbi-all]# ruby setup.rb setup
entering setup phase...
setting #! line to "#!/usr/local/bin/ruby"
setup.rb: skip bin/proxyserver(dbd_proxy) by user option
setup.rb: skip ext/dbd_sqlite(dbd_sqlite) by user option
setup.rb: skip ext/dbd_sybase(dbd_sybase) by user option
setup done.
[root@u15154846 ruby-dbi-all]# ruby setup.rb install
entering install phase...
mkdir -p /usr/local/bin
install sqlsh.rb /usr/local/bin
setup.rb: skip bin/proxyserver(dbd_proxy) by user option
setup.rb: skip lib/dbd_ado(dbd_ado) by user option
setup.rb: skip lib/dbd_db2(dbd_db2) by user option
setup.rb: skip lib/dbd_frontbase(dbd_frontbase) by user option
setup.rb: skip lib/dbd_interbase(dbd_interbase) by user option
setup.rb: skip lib/dbd_msql(dbd_msql) by user option
mkdir -p /usr/local/lib/ruby/site_ruby/1.8/DBD/Mysql
install Mysql.rb /usr/local/lib/ruby/site_ruby/1.8/DBD/Mysql
setup.rb: skip lib/dbd_odbc(dbd_odbc) by user option
setup.rb: skip lib/dbd_oracle(dbd_oracle) by user option
mkdir -p /usr/local/lib/ruby/site_ruby/1.8/DBD/Pg
install Pg.rb /usr/local/lib/ruby/site_ruby/1.8/DBD/Pg
setup.rb: skip lib/dbd_proxy(dbd_proxy) by user option
setup.rb: skip lib/dbd_sqlrelay(dbd_sqlrelay) by user option
mkdir -p /usr/local/lib/ruby/site_ruby/1.8/dbi
install columninfo.rb /usr/local/lib/ruby/site_ruby/1.8/dbi
install dbi.rb /usr/local/lib/ruby/site_ruby/1.8/dbi
install row.rb /usr/local/lib/ruby/site_ruby/1.8/dbi
install sql.rb /usr/local/lib/ruby/site_ruby/1.8/dbi
install trace.rb /usr/local/lib/ruby/site_ruby/1.8/dbi
install utils.rb /usr/local/lib/ruby/site_ruby/1.8/dbi
install version.rb /usr/local/lib/ruby/site_ruby/1.8/dbi
mkdir -p /usr/local/lib/ruby/site_ruby/1.8/.
install dbi.rb /usr/local/lib/ruby/site_ruby/1.8/.
setup.rb: skip ext/dbd_sqlite(dbd_sqlite) by user option
setup.rb: skip ext/dbd_sybase(dbd_sybase) by user option
install done.
It being ruby? To be honest I only threw in the DBI stuff and
checked it could connect and read tables/databases, so maybe.





No that shouldn't matter, from the output below I thought you
wanted 3.23.
Ultimately, i want 4.0+ but tried 3.23 just to simplify before moving to
4.0. That is when the headers were found missing for 3.23.
I don't think that's true so much anymore, I think you've just had
trouble because the build of mysql you have is screwed.
Have you tried just building from source? I know this is seen as
'l33t' by a lot of new users, but to be honest it's usually the
safest way to get a working system. Beats the usual 'this rpm was
compiled for somelib version bla, go get that' nonsense.
This has been my experience. I compiled mysql from src.(that is implied
with the config,make,make install ?? forgive my ignorance)
The rpm detected dependancies with the previous installation - even
after first running the 'shared' version of the rpm.

Here are some tests i'm running to conclusively narrow down where things
are going wrong.
# this work
require "mysql"
m = Mysql.new('localhost', 'admin', '@ou812')
m.list_dbs.each do |db|
puts db
end
#this works
require 'dbi'
c = DBI::connect('dbi:Mysql:dev','admin','@ou812')
c.do('insert into categories(name) values(?)','value')
#this does not
require "mysql"
m = Mysql.new('localhost', 'admin', '@ou812','dev')

res = m.query("select * from categories")

#dies on next line
fields = res.fetch_fields.filter do |f| f.name end
puts fields.join("\t")

res.each do |row|
puts row.join("\t")
end

#neither does this
require 'dbi'

c = DBI::connect('dbi:Mysql:dev','admin','xxxxx')

c.do('insert into categories(name) values(?)','value')

p 'before'
#dies
r = c.select_all('select * from categories')
#done get nothing from here out. nothing. not even headers. fails
silently and painfully
p 'after'

p r.size

Has something to do with hashes in mysql-ruby, as far as i can tell.

Thanks for any help.

:paul
 
P

Philipp Kern

[root@u15154846 mysql-ruby-2.4.5]# ruby extconf.rb
--with-mysql-include=/usr/local/lib/mysql-standard-4.0.20-pc-linux-i686/include
--with-mysql-lib=/usr/local/lib

Are you sure that these are the right settings? What's the directory structure
below /usr/local/lib/mysql-standard-4.0.20-pc-linux-i686/? Doesn't it contain
its own lib/?

Bye,
phil
 
D

Dick Davies

* Paul Vudmaska said:
Dick said:
It looks like there's bits of an install left behind in usr/local.
Here is the view from ssh.
[root@u15154846 mysql-ruby-2.4.5]# ruby extconf.rb
--with-mysql-include=/usr/local/lib/mysql-standard-4.0.20-pc-linux-i686/include
--with-mysql-lib=/usr/local/lib

See, this looks wrong to me. You've got a random header for some
version and I don't think it matches the actual libraries in /usr/local.

The headers tell Ruby (or any C program) how to use the libraries,
so if they're inconsistent that could well cause problems.
 
P

Paul Vudmaska

Philipp said:
[root@u15154846 mysql-ruby-2.4.5]# ruby extconf.rb
--with-mysql-include=/usr/local/lib/mysql-standard-4.0.20-pc-linux-i686/include
--with-mysql-lib=/usr/local/lib

Are you sure that these are the right settings? What's the directory structure
below /usr/local/lib/mysql-standard-4.0.20-pc-linux-i686/? Doesn't it contain
its own lib/?

Bye,
phil
/usr is in the root.
It is where i downloaded the software and did the configure,make,make
install shuffle.
Thanks for your help,
:paul
 
P

Paul Vudmaska

Dick said:
Dick Davies wrote:

It looks like there's bits of an install left behind in usr/local.
Here is the view from ssh.
[root@u15154846 mysql-ruby-2.4.5]# ruby extconf.rb
--with-mysql-include=/usr/local/lib/mysql-standard-4.0.20-pc-linux-i686/include
--with-mysql-lib=/usr/local/lib

See, this looks wrong to me. You've got a random header for some
version and I don't think it matches the actual libraries in /usr/local.

The headers tell Ruby (or any C program) how to use the libraries,
so if they're inconsistent that could well cause problems.
No, that did not seem 'obvious' to me either howver I've tried the paths
given by whereis :
[root@u15154846 root]# whereis mysql
mysql: /usr/bin/mysql /usr/lib/mysql /usr/local/lib/mysql
/usr/share/mysql /usr/share/man/man1/mysql.1.gz

and --with-mysql-config=/usr/bin/mysql_config

With the same result.
You are right i've probably done it enuf to confuse everyone.
May as well close this thread. Thanks for your help.

:paul
 

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

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top