How can I connect to database using FXRuby

129 views Asked by At

I'd like to create an app that accesses db (with 1 table) and outputs its table in a window using FXRuby. Is there any way to make it without using query language like in this example:

require 'pg'

conn = PG.connect(dbname: 'testdb', user: 'postgres')    
rows = conn.exec("select * from users")

And without using Ruby on Rails.

I've also tried to launch this example code, but it doesn't work beacause of the problem with installing sqlite3 gem:

require 'fox16' 
require 'sqlite3.rb' 
include Fox 

class TestApp < FXApp 
   def initialize 
      super('Test', 'Test') 
      @db = SQLite3::Database.new('test.db3') 
      @db || raise("can't connect to database") 
   end 

   def db 
      @db 
   end 
end 
1

There are 1 answers

1
varro On BEST ANSWER

It looks like the following should solve your problem (see this reference):

ridk exec pacman -S mingw-w64-x86_64-dlfcn
gem install sqlite3