LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-25-2005, 11:03 PM   #1
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
PostgreSQL 8 and DBI, DBD::Pg


Say, has anyone used the above combination... successfully?

I recently compiled PostgreSQL 8 on a SuSE 9.2 system and haven't been having much luck getting a formerly working Perl script to be able to connect to the database since the database upgrade.

Software versions: SuSE 9.2, Pg 8.0.0 (compiled from sources w/ ./configure --with-perl), DBI-1.43-2 (from the 9.2 CDs), and DBD::Pg-1.22-198 (downloaded from Novell/SuSE site).

The line that's failing is:
Code:
$dbh = DBI->connect("dbi:Pg:dbname=$db", "", "", "") || die $DBI::errstr;
where $db has been set to "test". The error message it's kicking out is:
Code:
Can't use string ("") as a HASH ref while "strict refs" in use at /usr/lib/perl5/site_perl/5.8.5/i586-linux-thread-multi/DBI.pm line 515.
As I recall from when I wrote the script (a year or so ago), the first two null strings in the statement were interpretted as allowing access to the current user.

If I change that line to use a couple of variables containing username and password info:
Code:
$dbh = DBI->connect("dbi:Pg:dbname=$db", $username, $password, {RaiseError => 1}) || die $DBI::errstr;
the program just hangs at the "connect" statement. If I leave out the "RaiseError blah" I get the above error message again. (This used to be allowed and you could use a statement "$dbh->{RaiseError}=> = 1;" following the $dbh->connect(). Apparently that doesn't work any more. :-( )

This seems awfully weird to me that this interface would now be this broken; especially when when of the main PostgreSQL developers is an admin on the DBD::Pg project.

So... Anyone got any experience along these lines? Pg 8 is pretty new so I guess it's possible that the perl interface hasn't caught up yet so I'm monitoring traffic on as many Pg sites as I can find in case something turns up.)

Could this be a SuSE 9.2 problem?

TIA

--

PS. If the above is littered with weird "+ACQ-" and similar strings and the like, will someone please explain how the heck you're supposed to be able to post code with some silly parser mucking it up all the time?
 
Old 02-22-2005, 02:30 AM   #2
krishnajai
LQ Newbie
 
Registered: Feb 2005
Location: USA
Distribution: Knoppix, White Hat
Posts: 1

Rep: Reputation: 0
You might want to try DBIx::Password to hold all the handle information before you make the DBI connection. Make sure it comes before the code that tries to use it!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL / DBD / DBI problems drowning Linux - Software 9 09-19-2005 12:01 AM
dbi measurments memo007 Linux - Networking 1 03-03-2005 05:07 PM
Can't install DBD::mysql or DBD::Pg DogTags Mandriva 2 01-21-2004 07:13 AM
Dbi Cgi lackluster Programming 3 11-19-2003 08:10 AM
postgresql -odbc & postgresql-jdbc installation kjsubbu Linux - Software 0 06-19-2003 02:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration