From: Dave Lilley Date: 2010-11-01T17:40:21+09:00 Subject: access remote mysql DB I have been given a job to put a local mysql to a remote server and then connect to it. the thing is I've not done it before and am hitting an obstacle to make this work. 1. it isn't a web server so you don't go http://example.com it is simply example.com USERNAME PASSWORD (once access is granted you can then connect to the mysql as you normally would). my issue is how to instigate that initial connection. I've tried this ... link = Net::HTTP.start('example.com') {|http| req = Net::HTTP::Get.new('example.com') http.req.basic_auth 'uname', 'p/word' http.response = http.request(req) print response.body } @db = Sequel.connect(:adapter => 'mysql', :host => link, :database => 'DB_to_use', :user => 'DB_name', :password => 'p/w') only to have the index.htm be put to STD OUT. also tried .... link = Net::HTTP.new('example.com',uname, p/w) @db = Sequel.connect(:adapter => 'mysql', :host => link, :database => 'DB_to_use', :user => 'DB_name', :password => 'p/w') only to have reference to name or service not known the example.com is the url through which i gain access to the database at the back. anyone able to me I'd be grateful. note before posting this I have edited the above to this.... Net::HTTP.new('example.com') {|http| req = Net::HTTP::Get('example.com') http.req.basic_auth 'uname', 'f0ur2010' http.response = http.request(req) print response.body } @db = Sequel.connect(:adapter => 'mysql', :host => 'example.com', :database => 'DB_to_use', :user => 'DB_name', :password => 'p/w') row = @db[:cust_data] row.each {|t| puts t} getting this - /usr/lib/ruby/1.8/sequel/adapters/mysql.rb:101:in `real_connect': Mysql::Error: Access denied for user 'db_name'@'example.com' (using password: YES) (Sequel::DatabaseConnectionError) from /usr/lib/ruby/1.8/sequel/adapters/mysql.rb:101:in `connect' Dave. -- Posted via http://www.ruby-forum.com/.