On Thursday, September 25, 2014 1:42:30 PM UTC+8, Jeremy Evans wrote:
>
> On Wednesday, September 24, 2014 9:38:46 PM UTC-7, henry beh wrote:
>>
>> My database is in different schema,   
>>
>>
>> previously i did like this, so the first connection is default, when i 
>> want to retrieve the data from database2, it always get it form default 
>> database , so it cause table not found error
>> $database1 = Sequel.connect(:adapter=>'mysql2', :host=>'127.0.0.1',
>>  :database=>'database1 ', :user=>'root', :password=>'1234',
>>  :max_connections => 30,
>>  :logger => Logger.new('sequel-log.txt'))
>>
>> $database2= Sequel.connect(:adapter=>'mysql2', :host=>'127.0.0.1',
>>  :database=>'database2', :user=>'root', :password=>'1234',
>>  :max_connections => 30,
>>  :logger => Logger.new('sequel-log.txt'))
>>
>
> Well, other than using a global variable instead of a constant, this looks 
> fine.  You'll have to post the code you are using to retrieve data and why 
> it isn't working as you suspect.
>
> Jeremy 
>



Table below is retrieve from second database, but i always get an error 
ERROR Sequel::DatabaseError: Mysql2::Error: Table 'database1.user' doesn't 
exist

class User< Sequel::Model(:user)
       
       def get_user
               User.dataset
        end

end 

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to