Subject: | Issue connecting to MS Azure dbases |
Date: | Thu, 04 Jun 2015 10:45:28 +0200 |
To: | bug-DBD-Sybase [...] rt.cpan.org |
From: | Bart Boelaert <bboelaert [...] incalibration.com> |
Hello,
It appears MS Azure dbase servers do NOT allow dbase switching ("USE
anotherdb") after a connection is established. In addition cross
database queries are not supported ("SELECT from somedb.dbo.SomeTable"
fails).
After several tests I discovered that the DBD::Sybase interface first
establishes a connection to the "master" dbase. When you specify another
dbase at connect time, it tries to switch to the right dbase AFTER
successfull connection.
So :
my $dbh =
DBI->connect("DBI:Sybase:server=SomeAzureSQLServer;database=mydbase;encryptPassword=1",
"myusername", "mypwd", {PrintError => 0});
is actually the same as :
my $dbh =
DBI->connect("DBI:Sybase:server=SomeAzureSQLServer;encryptPassword=1",
"myusername", "mypwd", {PrintError => 0});
unless ($dbh) {
die "ERROR: Failed to connect to server ($server).\nERROR MESSAGE:
$DBI::errstr";
} else {
print "\n";
print "Successful Connection.";
print "\n\n";
}
$dbh = DBI->go("use mydbase");
So, the above connection approach fails for MS Azure dbases.
Could the logic be changed so that DBD:Sybase immediately connects to
the right dbase at connection time?
Switching to DBD::ODBC and using the Linux ODBC drivers from MS is no
option for me, as MS provides only 64-bit ODBC drivers and I'm accessing
the Azure dbase from a Raspberry Pi.
Thanks in advance!
Kind regards,
Bart Boelaert.