On Oct 18, 2:09 am, Gary Doades <[email protected]> wrote:
> Is there a known issue using odbc and sharding under Windows?
>
> Currently I'm using jruby and jdbc to connect to a set of MS SQL
> databases. All works just fine.
>
> However, I also need to use ruby (1.9.2) and odbc instead in some
> circumstances. I'm using the exact same working code as in the jruby
> case, but just using odbc instead.
>
> So I have a servers hash like:
>
> defaultDB = "odbc:///default?user=sa&password=testing"
>
> :dsn1 = "odbc:///dsn1?user=sa&password=testing"
> :dsn2 = "odbc:///dsn2?user=sa&password=testing"
>
> Then:
>
> DB = Sequel.connect(defaultDB, :servers => servers)
What specifically is servers here? It probably should be:
{:dsn1=>{:host=>'dsn1'}, :dsn2=>{:host=>'dsn2'}}
> But when I then look at DB.servers (using DB.each_server) I get:
>
> #<Sequel::ODBC::Database: "odbc:sa:testing@/default">
> #<Sequel::ODBC::Database: "odbc:sa:testing@/default">
> #<Sequel::ODBC::Database: "odbc:sa:testing@/default">
Unrelated to your issue, but the default historical behavior for
Database#inspect uses a connection string, which often gives
inaccurate results in complex cases. It should probably be changed to
show the databases opts hash.
> It seems that all the database connections have been set to the
> default database.
>
> All subsequent code works just fine, except of course it only ever
> connects to the one database and not the other shards.
My guess is the :servers hash you are passing to the method is
incorrect, but I don't have enough data to state that reliably.
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].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.