Connecting Tech Pros Worldwide Forums | Help | Site Map

Unable to Connect to Mysql from ruby

Newbie
 
Join Date: Jan 2008
Posts: 21
#1: Jan 25 '08
Hi Guys,
I have tried out several ways to connect to my MYSQL database thru Ruby on my windows machine.
I have used ruby-mysql, mysql-ruby, ruby DBI....but havent been lucky so far,
is there any installer kind of a thing to do this stuff!
""I get the following error - mswin32-ruby16.dll was not found""

Can anybody guide me in steps getting this working for me!!!
Let me know if you require any more information.


Thanks in Advance

Expert
 
Join Date: May 2007
Posts: 216
#2: Jan 25 '08

re: Unable to Connect to Mysql from ruby


Are you using Rails, or only Ruby? Do you know if you have an ODBC installed for MySQL?
Newbie
 
Join Date: Jan 2008
Posts: 21
#3: Jan 28 '08

re: Unable to Connect to Mysql from ruby


I am using just Ruby.
I have installed Mysql ODBC 3.51 Driver ,I can see that - Data Source(ODBC) under Administrative Tools in windows.

let me know if i need to test anything specifically for that.

Cheers
vinram's Avatar
Newbie
 
Join Date: Jan 2008
Posts: 3
#4: Jan 28 '08

re: Unable to Connect to Mysql from ruby


Quote:

Originally Posted by idealfellow

Hi Guys,
I have tried out several ways to connect to my MYSQL database thru Ruby on my windows machine.
I have used ruby-mysql, mysql-ruby, ruby DBI....but havent been lucky so far,
is there any installer kind of a thing to do this stuff!
""I get the following error - mswin32-ruby16.dll was not found""

Can anybody guide me in steps getting this working for me!!!
Let me know if you require any more information.


Thanks in Advance


hi,

just check after u install ruby and rails ...go to browser and type http://localhost:3000/ u will get a page with the below details appear when u click a link "about your application's environment" :

Ruby version 1.8.6 (i386-mswin32)
RubyGems version 0.9.4
Rails version 1.2.5
Active Record version 1.15.5
Action Pack version 1.13.5
Action Web Service version 1.2.5
Action Mailer version 1.3.5
Active Support version 1.4.4
Application root C:/rails/sample
Environment development
Database adapter mysql
Expert
 
Join Date: May 2007
Posts: 216
#5: Jan 28 '08

re: Unable to Connect to Mysql from ruby


You should be able to connect using something like the following.
Expand|Select|Wrap|Line Numbers
  1. require 'DBI'
  2. DBI.connect('DBI:ODBC:DSN', 'username', 'password')
  3. #Where DSN is your actual data source name.
This DBI page might have some helpful info.
Newbie
 
Join Date: Jan 2008
Posts: 21
#6: Jan 29 '08

re: Unable to Connect to Mysql from ruby


Quote:

Originally Posted by vinram

hi,

just check after u install ruby and rails ...go to browser and type http://localhost:3000/ u will get a page with the below details appear when u click a link "about your application's environment" :

Ruby version 1.8.6 (i386-mswin32)
RubyGems version 0.9.4
Rails version 1.2.5
Active Record version 1.15.5
Action Pack version 1.13.5
Action Web Service version 1.2.5
Action Mailer version 1.3.5
Active Support version 1.4.4
Application root C:/rails/sample
Environment development
Database adapter mysql

HI Vinram,
I am not using Ruby on Rails!!!
Newbie
 
Join Date: Mar 2008
Posts: 2
#7: Mar 5 '08

re: Unable to Connect to Mysql from ruby


Hi i am working frist time on ruby.

Anyone tell me how can we write query our page for inserting ,fetchimg record from database.i am using dtabase mysql.

and i have installed Instantrails on windows xp.
Reply