I have been hit my the DB administrator with a 5 minute connection
before disconnection.

this means my program needs to be able to run a heartbeat to keep
things alive.
how do i do this?

I don't really want to put a meaningless dataset statement in the
ensure or rescue part of my code as this is to handle valid crashes
and not issues where the remote server wants to kill the connection
due to inactivity.

I thought there would be a method call with it being a boolean or a
second / minute value to be passed that would be triggered to keep the
connection open within the sequel gem.

code that i have is this...


  def initialize(*arg)
    @path = "logs/"
    @log = Logger.new("#...@path}db - info.log")
    @log.level = Logger::DEBUG

    @log.debug('initialing the DB access!')

    if arg[0] == 'local'
      @db = Sequel.connect(:adapter => 'mysql', :localhost =>
'localhost', :database => 'test', :user => 'test', :password =>
'apples')

    else
      @db = Sequel::connect(:adapter => 'mysql', :host =>
'remote.server', :database => 'server', :user => 'user', :password =>
'apples')
    end

    rescue DBI::DatabaseError => e
      @log.debug("An error occurred\nError code: #{e.err}\nError
message: #{e.errstr}")

    ensure
      if arg[0] == 'local'
        @log.debug("LOCAL - DB closed!")
      else
        @log.debug("REMOTE - DB closed!")
      end
        @db.disconnect if @db
  end

any help? (have googled but with no luck - maybe been using wrong
phrases)

dave.


-- 
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