I've used the snippet of code below on my devlopement box fine (using
linux) and on another Linux box.

Now porting to windows and i'm getting a undefined constant DBI error.
I've realised i didn't have DBI gem installed then thought it would
"just fix the error" it hasn't.

I'm not requiring dbi in code only logger & sequel gems.
I've tried Sequel::DatabaseError in place to no joy.

using ruby 1.8.7.p302

the current code is this...

    @db = Sequel::connect(:adapter => 'mysql', :host =>
'localhost', :database => 'adb', :user => 'user', :password =>
'password')


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

OR

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

     ensure
       @log.debug('DB closed!')
       @db.disconnect if @db       <<<<<<< Also getting an error
sometimes referring to @db not being initialised!


all the above works as is and I'm happy with it under Linux OS.

error messages below....

For DBI use,

sequel1.rb:24:in `initialize': uninitialized constant Dopen::DBI
(NameError)
        from sequel1.rb:162:in `new'
        from sequel1.rb:162

Using the Sequel::DatabaseError I get and suspect this is because i
don't have mysql server on this PC.but that's only because of the
mysql (Sequel::AdapterNotFound) error but why?

I'm connecting to a remote mysql server and have internet connection
active.

C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original
_require': LoadError: no such file to load -- mysql
(Sequel::AdapterNotFound)
        from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:31:in
`require'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/sequel-3.18.0/lib/
sequel/adapters
/mysql.rb:4
        from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:31:in
`gem_original_require'
        from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:31:in
`k_require'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/sequel-3.18.0/lib/
sequel/core.rb:
249:in `tsk_require'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/sequel-3.18.0/lib/
sequel/core.rb:
72:in `check_requiring_thread'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/sequel-3.18.0/lib/
sequel/core.rb:
69:in `synchronize'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/sequel-3.18.0/lib/
sequel/core.rb:
69:in `check_requiring_thread'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/sequel-3.18.0/lib/
sequel/core.rb:
249:in `tsk_require'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/sequel-3.18.0/lib/
sequel/database
/connecting.rb:25:in `adapter_class'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/sequel-3.18.0/lib/
sequel/database
/connecting.rb:63:in `connect'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/sequel-3.18.0/lib/
sequel/core.rb:
119:in `connect'
        from sequel1.rb:19:in `initialize'
        from sequel1.rb:162:in `new'
        from sequel1.rb:162

I've looked at the gem loaded on my development PC and there is
nothing

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