Hi,
Ralph Smith wrote:
The only instructions for getting ruby to access mysql that I've been able
to find seem to be
oriented to non-windows os's. The instructions talk about mysql c api
header files, but I can't find
them. Can someone tell me how to get ruby on windows xp to talk to mysql?thanks,
Ralph
It seems the mysql-ruby-win package at
README-winpkg is no
longer maintained.
So I made mysql.so binary for Windows XP.
0. Requirement
Windows XP Professional
Ruby 1.8.2-15
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for
80x86
1. Download and ungzip mysql-ruby-2.7.tar.gz at
http://tmtm.org/downloads/mysql/ruby/mysql-ruby-2.7.tar.gz
2. Download and Install mysql-essential-4.1.14-win32.msi at
http://dev.mysql.com/downloads/mysql/4.1.html
3. Edit extconf.rb
--- extconf2.rb 2005-10-20 10:50:50.000000000 +0900
+++ extconf.rb 2005-10-20 11:23:39.000000000 +0900
@@ -11,6 +11,5 @@
else
inc, lib = dir_config('mysql', '/usr/local')
- libs = ['m', 'z', 'socket', 'nsl']
- while not find_library('mysqlclient', 'mysql_query', lib, "#{lib}/mysql")
do
+ while not find_library('mysqlclient', 'mysql_reconnect', lib,
"#{lib}/mysql") do
exit 1 if libs.empty?
have_library(libs.shift)
@@ -18,5 +17,4 @@
end
-have_func('mysql_ssl_set')
if have_header('mysql.h') then
@@ -37,5 +35,5 @@
cpp = Config::expand sprintf(CPP, $CPPFLAGS, $CFLAGS, '')
end
-unless system "#{cpp} > confout" then
+unless system "#{cpp} /P > confout" then
exit 1
end
···
============================================
4. Create Makefile
ruby extconf.rb --with-mysql-include="C:\Program Files\MySQL\MySQL Server
4.1\include" --with-mysql-lib="C:\Program Files\MySQL\MySQL Server
4.1\lib\opt"
5. Run Makefile and instal
nmake
6. Test
ruby test.rb localhost root password
Test result seems no harmful but annoying.
Loaded suite test
Started
..................F...............................................F.............
..............................
Finished in 6.656 seconds.
1) Failure:
test_sqlstate(TC_Mysql2) [test.rb:154]:
<"00000"> expected but was
<"HY000">.
2) Failure:
test_fetch_double(TC_MysqlStmt2) [test.rb:860]:
<-1.79769313486232e+308> expected but was
<-1.79769313486232e+308>.
110 tests, 349 assertions, 2 failures, 0 errors
* If you don't have C++ Compiler or just want binary, Download mysql.so at
http://home.nownuri.net/~phasis/mysql.so
and Copy to your RUBYARCHDIR like C:\ruby\lib\ruby\site_ruby\1.8\i386-msvcrt
Regards,
Park Heesob