Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Anybody managed to connect Perl to ElevateDB ?
Tue, Oct 4 2011 9:06 PMPermanent Link

TonyWood

Hi All

Having had problems with .Net VB, I've tried using Cygwin, Perl, DBI and DBD::ODBC to connect to ElevateDB on Windows 7, I seem to get close but no cigar yet.  If i specify a valid DSN, i.e. matching a User DSN displayed by c:/Windows/SysWOW64/odbcad32.exe, i get :

ElevateDB Error #501 Login failed (The user name or password is incorrect) (SQL-H)

Here's some perl code to try to explore the issue:

#!/usr/bin/perl -w
use strict;
use warnings;
use Data::Dumper;
use DBI;
use DBD::ODBC;

my $attr = {};
my @driver_names = DBI->available_drivers;
my %drivers      = DBI->installed_drivers;

print "Driver Names = ".Dumper \@driver_names;
print "Drivers = ".Dumper \%drivers;

foreach my $driver_name (@driver_names) {
   my @data_sources = DBI->data_sources($driver_name, $attr);
   print "$driver_name, data_sources = ".Dumper \@data_sources;
}

my $dsn = "SlacksCreekLive2_Unconstrained";  # maps to Driver 'ElevateDB 2 ODBC Driver'

my $dbh = DBI->connect("dbi:ODBC:$dsn",
                      "Administrator",
                      "EDBDefault",
                      {RaiseError => 1},
                  );

$dbh->disconnect;


Here's the output :

$ perl edb_connect.pl
Driver Names = $VAR1 = [
         'DBM',
         'ExampleP',
         'File',
         'Gofer',
         'ODBC',
         'Proxy',
         'Sponge'
       ];
Drivers = $VAR1 = {};     # i guess i should be worried about this being empty ...
DBM, data_sources = $VAR1 = [
         'DBI:DBM:f_dir=.'
       ];
ExampleP, data_sources = $VAR1 = [
         'dbi:ExampleP:dir=.'
       ];
File, data_sources = $VAR1 = [
         'DBI:File:f_dir=.'
       ];
Gofer, data_sources = $VAR1 = [];
ODBC, data_sources = $VAR1 = [
         'dbi:ODBC:rc1_Unconstrained',
         'dbi:ODBC:Configuration',
         'dbi:ODBC:rc2_Unconstrained',
         'dbi:ODBC:dBASE Files',
         'dbi:ODBC:Excel Files',
         'dbi:ODBC:MS Access Database',
         'dbi:ODBC:rc2_Final',
         'dbi:ODBC:rc3_Unconstrained',
         'dbi:ODBC:rc3_Final',
         'dbi:ODBC:rc1_Final',
         'dbi:ODBC:rc4_Unconstrained',
         'dbi:ODBC:rc4_Final',
         'dbi:ODBC:gg_Unconstrained',
         'dbi:ODBC:test_Unconstrained',
         'dbi:ODBC:test_Final',
         'dbi:ODBC:Coffs_Harbour2_Unconstrained',
         'dbi:ODBC:Coffs_Harbour2_Final',
         'dbi:ODBC:tony_test',
         'dbi:ODBC:SlacksCreekLive_Unconstrained',
         'dbi:ODBC:SlacksCreekLive_Final',
         'dbi:ODBC:SlacksCreekLive2_Unconstrained',
         'dbi:ODBC:SlacksCreekLive2_Final',
         'dbi:ODBC:SlacksCreek2_Unconstrained',
         'dbi:ODBC:Xtreme Sample Database 2008',
         'dbi:ODBC:EDB_ODBC'
       ];
Proxy, data_sources = $VAR1 = [];
Sponge, data_sources = $VAR1 = [];
set_err: state ('H') is not a 5 character string, using 'S1000' instead at /usr/lib/perl5/site_perl/5.10/i686-cygwin/DBD/ODBC.pm line 107.
DBI connect('SlacksCreekLive2_Unconstrained','Administrator',...) failed: [Elevate Software][ElevateDB] ElevateDB Error #501 Login failed (The user name or password is incorrect) (SQL-H) at edb_connect.pl line 27

Administrator@roxy ~/perl

Thanks in advance
Tony Wood
Tue, Oct 4 2011 9:52 PMPermanent Link

TonyWood

Oh yeah - I should add that i'm sure the user name / password i'm using is correct
Tue, Oct 11 2011 2:27 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Tony,

<< Having had problems with .Net VB, I've tried using Cygwin, Perl, DBI and
DBD::ODBC to connect to ElevateDB on Windows 7, I seem to get close but no
cigar yet.  If i specify a valid DSN, i.e. matching a User DSN displayed by
c:/Windows/SysWOW64/odbcad32.exe, i get :

ElevateDB Error #501 Login failed (The user name or password is incorrect)
(SQL-H)  >>

Did you configure the DSN with a user name and password, or did you leave
them blank ?

If Perl allows you to specify additional connection string arguments when
connecting, then that is the route I would take.  If not, then you probably
will need to make sure that the DSN is pre-configured with the proper user
name and password for connecting.

--
Tim Young
Elevate Software
www.elevatesoft.com
Tue, Oct 11 2011 9:54 PMPermanent Link

TonyWood

whoo-hoo - well done Tim, putting user name and password into the DSN string solved it, i.e this works :

my $dbh = DBI->connect("dbi:ODBC:DSN=SlacksCreekLive2_Unconstrained;Uid=Administrator;Pwd=EDBDefault;";
                      {RaiseError => 1},
                  );

whereas the perl DBI doco has :

        $dbh = DBI->connect($dsn, $user, $password,
                            { RaiseError => 1});
i.e. in my case

        $dbh = DBI->connect("dbi:ODBC:SlacksCreekLive2_Unconstrained", "Administrator", "EDBDefault",
                            { RaiseError => 1, AutoCommit => 0 });

which is what i tried originally, and which gives the bad password error

Thanks for your insight
Tony Wood

>> Did you configure the DSN with a user name and password, or did you leave
>> them blank ?

>> If Perl allows you to specify additional connection string arguments when
>> connecting, then that is the route I would take.  If not, then you probably
>> will need to make sure that the DSN is pre-configured with the proper user
>>name and password for connecting.
Image