Обсуждение: pg or DBI
Hi all, I have used pg to connect to postgres. However, I have seen a lot of people use DBI. Are there any advantages/disadvantages in using one or the other for connecting to postgres via perl. Also, which one is more widely used? Thanks for your input. Devinder Rajput Stores Division Corporate Offices Chicago, IL (773) 442-6474
Unless I am mistaken (which actually happens quite often) DBI is the base modue that perl uses.. the extension of that DBI::Pg (which is called in the script) is postgres specific. That is what I am using and I am new to postgres but have been working with perl for 3-4 years and I have found it very easy to use. Travis -----Original Message----- From: Devinder K Rajput [mailto:Devinder.Rajput@ipaper.com] Sent: Thursday, October 24, 2002 12:05 PM To: pgsql-novice@postgresql.org; pgsql-admin@postgresql.org Subject: [NOVICE] pg or DBI Hi all, I have used pg to connect to postgres. However, I have seen a lot of people use DBI. Are there any advantages/disadvantages in using one or the other for connecting to postgres via perl. Also, which one is more widely used? Thanks for your input. Devinder Rajput Stores Division Corporate Offices Chicago, IL (773) 442-6474 ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
Actually there are two PostgreSQL Perl interfaces the DBI based one and Pg. It has been a while since I have used Perl (and it has been even longer since I used the Pg interface), but I can tell you that most people use the DBI version. The two interfaces are very similar, but the Pg interface is PostgreSQL specific. In other words, if you want to migrate to another database in the future then you should use DBI. DBI is also likely to be more familiar to Perl hackers that have worked with another database. Jason "Williams, Travis L, NPONS" <tlw@att.com> writes: > Unless I am mistaken (which actually happens quite often) DBI is the > base modue that perl uses.. the extension of that DBI::Pg (which is > called in the script) is postgres specific. That is what I am using and > I am new to postgres but have been working with perl for 3-4 years and I > have found it very easy to use. > > Travis > > -----Original Message----- > From: Devinder K Rajput [mailto:Devinder.Rajput@ipaper.com] > Sent: Thursday, October 24, 2002 12:05 PM > To: pgsql-novice@postgresql.org; pgsql-admin@postgresql.org > Subject: [NOVICE] pg or DBI > > > Hi all, > > I have used pg to connect to postgres. However, I have seen a lot of > people use DBI. Are there any advantages/disadvantages in using one or > the > other for connecting to postgres via perl. Also, which one is more > widely > used? Thanks for your input. > > Devinder Rajput > Stores Division Corporate Offices > Chicago, IL > (773) 442-6474 > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
I looked into it very heavily when I was first deciding on a method.
I chose to use Pg, and I've found it amazing ever since.
I use it religiously, with Mason, and haven't been let down by it once.
I'm sure the reasons I found were enough for me, and should be enough for
anyone :-)
Gareth
-----Original Message-----
From: pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Devinder K Rajput
Sent: 24 October 2002 18:05
To: pgsql-novice@postgresql.org; pgsql-admin@postgresql.org
Subject: [ADMIN] pg or DBI
Hi all,
I have used pg to connect to postgres. However, I have seen a lot of
people use DBI. Are there any advantages/disadvantages in using one or the
other for connecting to postgres via perl. Also, which one is more widely
used? Thanks for your input.
Devinder Rajput
Stores Division Corporate Offices
Chicago, IL
(773) 442-6474
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
On Thursday, October 24, 2002, at 10:05 AM, Devinder K Rajput wrote: > Hi all, > > I have used pg to connect to postgres. However, I have seen a lot of > people use DBI. Are there any advantages/disadvantages in using one or > the > other for connecting to postgres via perl. Also, which one is more > widely > used? Thanks for your input. In theory, DBI is "cross-database", meaning the code you write to access one database is the same as, or very similar to, the code you write to access another. That's nice because if you switch databases, you don't have to do a huge code re-write, and you don't have to learn a different set of function calls for each database you use. Also, DBI is actively maintained, and I don't know if Perl-Pg is or not. There has been some discussion about ditching Perl-Pg in favor of DBI, but I don't know if anything became of that. --Jeremy
> I have used pg to connect to postgres. However, I have seen a lot of > people use DBI. Are there any advantages/disadvantages in using one or the > other for connecting to postgres via perl. Also, which one is more widely > used? Thanks for your input. I have never used Pg but I had a quick look and appears to be the way to go if you are going to be using PostgreSQL only. DBI gives you two benefits which are related; a) You can build software that will work with different database backends with only minimal changes (if you follow the portability guidelines) and b) you can work with multiple different database backends in the same code at the same time. The later is extremely powerful when you 'inherit' a job that may involve ODBC, Oracle, PostgreSQL etc. Cough. Give both a quick try, proof of concept them, and decide. Peter