On 11 December 2010 17:17, Jeremy Evans <[email protected]> wrote:
> On Dec 10, 7:00 pm, dave <[email protected]> wrote: > > 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}") > > It's pointless to rescue DBI::DatabaseError. You aren't using DBI, > and even if you were, sequel would be raising a connection error as a > Sequel::DatabaseConnectionError instance. That's not the cause of > your problem, though. > > > 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? > > You are using the mysql adapter, so you need the mysql gem installed. > > > 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/ > > This should make it obvious what the problem is. Install the mysql > gem and the problem should go away. > > Well I got a LIBMYSQL.dll error so found it on the net and now I get a error procedure point mysql_row_tell could not be located in the DDL libmysql. I don't want to have mysql server installed as I want to create an exe or single file (via exerb) that i can take and put onto other windows PC's and have the program "just work". I will be accessing a remote MYSQL server via the net or local network just not local to the PC. I rechecked my Linux dev PC and see I've not got mysql gem loaded so this was something i didn't think of. have you other thoughts ? > 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.
