wow Jeremy you're fast in repyling - Appreciate this.

from you suggestion i've done this...

@db = Mysql.new(( 'remote.co.nz', "my_name", "2010", 'server')

as a connection test i used this...

@db.query('SELECT VERSION()')

then i used this query and got the data expected to see.

@db.query('select * from cust_data')

SO things now work as expected!

could it be the sequence I have for the connection that's upsetting things?

the full trace back is as follows (and Yes I did Ctrl-C out as it just sat
there I think at one point for @ 3 minutes doing nothing.
I'm on cable (think 15meg/s link up & down so else it's a 4meg link - still
fast enough to push & pull data to / from the remote server fast).

dave.

On 12 December 2010 17:38, Jeremy Evans <[email protected]> wrote:

>  On Dec 11, 8:16 pm, dave <[email protected]> wrote:
> > I am unsure of what i'm doing wrong but it seems that it's 1 step
> > forward and a few back at present for me.
> > after issues trying to sort out the rescue ensure part of my DB access
> > script i've fallen foul of the gem gods again.
> >
> > my connection code is this...
> >
> >         puts 'in remote side'
> >           @db = Sequel.mysql2(:host => 'remote.co.nz', :database =>
> > 'server', :user => "my_name", :password => "2010")
> >       # remote
> >     end
> >     Thread.new{loop{sleep 60; DB.get(1)}}   #to keep the connection
> > open
> >
> >         rescue Sequel::DatabaseError
> >       @log.debug("An error occurred\nError code: #{Sequel}\nError
> > message: #{Sequel.to_s}")
> >     ensure
> >       @log.debug("DB closed!")
> >       @db.disconnect if @db
> >
> > currently i am getting these errors...
> >
> > in DB connection initialize
> > in remote side
> > C:/Ruby187/lib/ruby/gems/1.8/gems/sequel-3.18.0/lib/sequel/adapters/
> > mysql2.rb:58
> > :in `query': Interrupt:  (Sequel::DatabaseConnectionError)
> >         from C:/Ruby187/lib/ruby/gems/1.8/gems/sequel-3.18.0/lib/
> > sequel/adapters
> > /mysql2.rb:58:in `connect'
> >
> > this ot me *IS* the problem!
>
> This says the initial exception was Interrupt (did you press Ctrl-C
> while connecting?).
>
> >      **** lots of lines referring to problems in the apdapter - these
> > not shown.****
>
> It's almost always a bad idea not to provide full backtraces.
>
> > I tried originially this line and got the same errors
> >
> > @db = Sequel.connect(:adapter => 'mysql', :host =>
> > 'remote.co.nz', :database => 'server', :user => "my_name", :password
> > => "2010")
> >
> > I've also tried a simple get the version number after the connect and
> > it has worked but as soon as i try to get a Query result this error
> > occures
>
> You may want to use test_connection after the Sequel.connect call just
> to make sure things are working.
>
> > I am wondering if the mysql (2.8.1 x86-mingw32) gem is incompatible
> > with sequel.
> > tried using mysql2 (0.2.6 x86-mingw32) also but this too gives me the
> > same errors.
>
> Both are compatible with Sequel and tested on a regular basis (before
> every push to github).
>
> > Now just added a .connect and got this error so I'm making progress
> > but don't understand what I am doing wrong!
> >
> > connection statement was
> > @db = Sequel.mysql.connect(:host => 'remote.co.nz', :database =>
> > 'server', :user => "my_name", :password => "2010")
>
> This is not progress, this is just wrong.  You are attempting to set
> up the connection with default parameters (which is why it attempts to
> use localhost), and then calling the connect method, which should not
> really be called by user code.
>
> My recommendation is first get a working connection using either mysql
> or mysql2 directly.  Once you have a working connection with mysql or
> mysql2, you should be able to figure out how to get it working with
> Sequel, and if not, please post here with your working connection
> information for mysql or mysql2 and I'll attempt to help.
>
> Jeremy
>
> --
> You received this message because you are subscribed to the Google Groups
> "sequel-talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<sequel-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/sequel-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to