Skip Menu |

This queue is for tickets about the RT-Authen-ExternalAuth CPAN distribution.

Report information
The Basics
Id: 57791
Status: open
Priority: 0/
Queue: RT-Authen-ExternalAuth

People
Owner: Nobody in particular
Requestors: kammerer [...] and.at
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: ODBC DSN Problem
Date: Sun, 23 May 2010 23:02:09 +0200
To: "'bug-RT-Authen-ExternalAuth [...] rt.cpan.org'" <bug-RT-Authen-ExternalAuth [...] rt.cpan.org>
From: "AnD-Institut (Andreas Kammerer)" <kammerer [...] and.at>
Hi! Just a suggestion: I use ODBC to connect to a Windows SQL-Server 2008 instance. I had some Problems to get a proper DSN, so i modified DBI.pm around line 455 to get an override: # AnD: Using DSN directily from config if having something "special" my $db_dsn = $config->{'dsn'}; # Use config to create a DSN line for the DBI connection my $dsn = "dbi:$dbi_driver:database=$db_database;host=$db_server;port=$db_port"; # AnD: Override dsn directly in set in config if ($db_dsn) {$dsn=$db_dsn;} # Now let's get connected And in the RT_SiteConfig.pm: Set($ExternalSettings, { 'My_Globeman' => { 'type' => 'db', 'dsn' => 'DBI:ODBC:AnD2009', 'server' => 's03-sql', Ist a little "quick and dirty" ;) - maybe there should be some change tot he string-building oft he dsn, so that parameters which are not given by the config are not included (ie if no port iss et, then dont include 'port=' in the dsn...) Greetings from Austria, Andreas Kammerer, CMC Geschäftsführer kammerer@and.at - www.and.at Tel.: +43 7276/4282 101 - Fax: +43 7276/4282 99 Absender dieses Mails ist das AnD-Institut Inh. Andreas Kammerer, Rossanger 7, AT-4722 Peuerbach, Gerichtsstand ist AT-4722 Peuerbach. Wenn Sie keine eMails mehr von uns erhalten möchten, antworten Sie bitte auf dieses Mail mit "UNSUBSCRIBE" im Betreff.
Subject: Re: [rt.cpan.org #57791] ODBC DSN Problem
Date: Mon, 24 May 2010 16:58:54 -0400
To: AnD-Institut via RT <bug-RT-Authen-ExternalAuth [...] rt.cpan.org>
From: Kevin Falcone <kevin [...] jibsheet.com>
On Sun, May 23, 2010 at 07:16:52PM -0400, AnD-Institut via RT wrote: Show quoted text
> Just a suggestion: I use ODBC to connect to a Windows SQL-Server 2008 instance. I had some Problems to get a proper DSN, so i modified DBI.pm around line 455 to get an override: > > # AnD: Using DSN directily from config if having something "special" > my $db_dsn = $config->{'dsn'}; > > # Use config to create a DSN line for the DBI connection > my $dsn = "dbi:$dbi_driver:database=$db_database;host=$db_server;port=$db_port"; > > # AnD: Override dsn directly in set in config > if ($db_dsn) {$dsn=$db_dsn;} > > # Now let's get connected > > And in the RT_SiteConfig.pm: > > Set($ExternalSettings, { > 'My_Globeman' => { > 'type' => 'db', > 'dsn' => 'DBI:ODBC:AnD2009', > 'server' => 's03-sql', > > Ist a little "quick and dirty" ;) - maybe there should be some change tot he string-building oft he dsn, so that parameters which are not given by the config are not included (ie if no port iss et, then dont include 'port=' in the dsn...)
Hi Andreas I'd be happy to take a patch that built the dsn piecemeal based on what arguments were passed in. I'm a little hesitant to just clobber the dsn to work around the issue. I assume your dsn would also work as dbi:ODBC:database=AnD2009 ? -kevin
Subject: AW: [rt.cpan.org #57791] ODBC DSN Problem
Date: Tue, 25 May 2010 15:01:56 +0200
To: "bug-RT-Authen-ExternalAuth [...] rt.cpan.org" <bug-RT-Authen-ExternalAuth [...] rt.cpan.org>
From: "AnD-Institut (Andreas Kammerer)" <kammerer [...] and.at>
Hi Kevin! Thank you for the fast reply. I tried the DSN "dbi:ODBC:database=AnD2009", but its not working this way: DBI connect('database=AnD2009','ticketingDBuser',...) failed: [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed (SQL-IM004)(DBD: db_login/SQLConnect err=-1) at /opt/rt3/local/plugins/RT-Authen-ExternalAuth/lib/RT/Authen/ExternalAuth/DBI.pm line 465 So I did the following (I'm not very familiar with perl - I'm sure there is a more sophisticated way to do this ;) # Use config to create a DSN line for the DBI connection my $dsn="dbi:$dbi_driver:"; if ($db_database) { if ("\U$dbi_driver" eq 'ODBC') { $dsn=$dsn."$db_database";} else { $dsn=$dsn."database=$db_database;"}; } if ($db_server) {$dsn=$dsn."host=$db_server;"}; if ($db_port) {$dsn=$dsn."port=$db_port"}; #my $dsn = "dbi:$dbi_driver:database=$db_database;host=$db_server;port=$db_port"; # Now let's get connected $RT::Logger->debug("Attemting to connect to db with dsn:",$dsn); my $dbh = DBI->connect($dsn, $db_user, $db_pass,{RaiseError => 1, AutoCommit => 0 }) or die $DBI::errstr; Show quoted text
____________________________________________ Andreas Kammerer, CMC AnD-Institut www.and.at +43 7276 4282 0
Subject: Re: [rt.cpan.org #57791] ODBC DSN Problem
Date: Tue, 25 May 2010 17:07:07 -0400
To: AnD-Institut via RT <bug-RT-Authen-ExternalAuth [...] rt.cpan.org>
From: Kevin Falcone <kevin [...] jibsheet.com>
On Tue, May 25, 2010 at 09:02:12AM -0400, AnD-Institut via RT wrote: Show quoted text
> > Thank you for the fast reply. I tried the DSN "dbi:ODBC:database=AnD2009", but its not working this way:
Ok, that makes me sad, but yes, looking at the DBD::ODBC documentation, it appears to work differently from other DBD modules. Perhaps we will just add a plain dsn option for those folks who have to work in 'slightly unusual' environments. I'll see if Mike has any objections before poking at it -kevin
Subject: AW: [rt.cpan.org #57791] ODBC DSN Problem
Date: Wed, 26 May 2010 08:22:55 +0200
To: "bug-RT-Authen-ExternalAuth [...] rt.cpan.org" <bug-RT-Authen-ExternalAuth [...] rt.cpan.org>
From: "AnD-Institut (Andreas Kammerer)" <kammerer [...] and.at>
Maybe it would be more consistent to include something as a "odbcdsn" Parameter as an option to the Config File. In fact it is not really the Database, it’s the ODBC Data Source Name, which we refer to. my $db_ODBCdsn = $config->{'ODBCdsn'}; # Use config to create a DSN line for the DBI connection my $dsn="dbi:$dbi_driver:"; if ($db_database) {$dsn=$dsn."database=$db_database;"}; if ($db_ODBCdsn) {$dsn=$dsn.$db_ODBCdsn;} if ($db_server) {$dsn=$dsn."host=$db_server;"}; if ($db_port) {$dsn=$dsn."port=$db_port"}; #my $dsn = "dbi:$dbi_driver:database=$db_database;host=$db_server;port=$db_port"; # Now let's get connected I think this would be slightly more straight forward? Sg, AnDi Show quoted text
-----Ursprüngliche Nachricht----- Von: Kevin Falcone via RT [mailto:bug-RT-Authen-ExternalAuth@rt.cpan.org] Gesendet: Dienstag, 25. Mai 2010 23:07 An: AnD-Institut (Andreas Kammerer) Betreff: Re: [rt.cpan.org #57791] ODBC DSN Problem <URL: https://rt.cpan.org/Ticket/Display.html?id=57791 > On Tue, May 25, 2010 at 09:02:12AM -0400, AnD-Institut via RT wrote:
> > Thank you for the fast reply. I tried the DSN "dbi:ODBC:database=AnD2009", but its not working this way:
Ok, that makes me sad, but yes, looking at the DBD::ODBC documentation, it appears to work differently from other DBD modules. Perhaps we will just add a plain dsn option for those folks who have to work in 'slightly unusual' environments. I'll see if Mike has any objections before poking at it -kevin