Thread: Perl DBD?
I would like to use a perl-script together with postgresql. Therefore I have to use the following line: use pg; I know I have to install a DBD herefore, but where can I get it? I have installed DBD-pg-0.92, DBI-1.06 and postgresql-6.4.2. A second (short) question: How can I view the tables in a DB? Thanks in advance, Jeroen Hermans Webmaster HaFaBra.nl info@hafabra.nl ____________________________________________ De ideale LINK tussen muziek en internet: De Nationale HaFaBra-pagina, http://www.hafabra.nl Een must voor iedere muziekliefhebber! ____________________________________________
There seems to be some confusion here. The Pg module and the DBI modules are NOT the same thing. The first is a postgreSQL specific perl module. The second is an API; it has a standard set of commands and these are applied to the database of your choice using the appropriate driver (in this case DBD::Pg). The fact that you mention use pg; (which by the way should be use Pg;) implies you're trying to use the former. But if you've already installed DBI/DBD::Pg, why not use these instead of the Pg module? Try perldoc DBI perldoc DBD::Pg for more info on these. If you want to use Pg get and install the Pg module from CPAN and try perldoc Pg or recompile postgreSQL with the --with-perl switch. oh, and to view the tables in a database psql <database> \dt HTH, S. >I would like to use a perl-script together with postgresql. Therefore I have >to use the following line: > >use pg; > >I know I have to install a DBD herefore, but where can I get it? I have >installed DBD-pg-0.92, DBI-1.06 and postgresql-6.4.2. >A second (short) question: >How can I view the tables in a DB? >Thanks in advance, > > Jeroen Hermans > Webmaster HaFaBra.nl > info@hafabra.nl > >____________________________________________ > >De ideale LINK tussen muziek en internet: > >De Nationale HaFaBra-pagina, http://www.hafabra.nl > >Een must voor iedere muziekliefhebber! >____________________________________________ +--------------------------+--------------------------------------+ | Stuart C. G. Rison | Ludwig Institute for Cancer Research | +--------------------------+ 91 Riding House Street | | N.B. new phone code!! | London, W1P 8BT | | Tel. +44 (0)207 878 4041 | UNITED KINGDOM | | Fax. +44 (0)207 878 4040 | stuart@ludwig.ucl.ac.uk | +--------------------------+--------------------------------------+
On Fri, 6 Aug 1999, Nationale HaFaBra-site wrote: > I would like to use a perl-script together with postgresql. Therefore I have > to use the following line: Hallo Jeroen, > use pg; If you want to use DBD-Pg the first line would be - use DBI; > I know I have to install a DBD herefore, but where can I get it? I have > installed DBD-pg-0.92, DBI-1.06 and postgresql-6.4.2. You don't have to get a database driver (DBD) to use the pg module that comes with postgres. You can use it immediately upon building the db (if you built the interfaces along with the backend.) If you want to use DBD, dial up CPAN and go to `modules by author'. Look for Edmund Mergl. Personally, I really like his DBD module. As DBI (necessary for DBD) is much more widely documented than pg - due to the fact that DBI is the generic part of the equation and DBD modules are database specific - it might be easier for you. You could try both. ;-) There is also ecpg - the ESQL(C) interface. I use DBI::DBD-Pg almost exclusively these days and have lots of code (public domain) that I'd be happy to send. > A second (short) question: > How can I view the tables in a DB? > Thanks in advance, $ psql [dbname] dbname => \d [enter] OR dbname => SELECT * FROM table; [enter] Let me know, a.u.b., if you'd like some code snippets. Tot straks, Tom > Jeroen Hermans > Webmaster HaFaBra.nl > info@hafabra.nl > > ____________________________________________ > > De ideale LINK tussen muziek en internet: > > De Nationale HaFaBra-pagina, http://www.hafabra.nl > > Een must voor iedere muziekliefhebber! > ____________________________________________ > > ------- North Richmond Community Mental Health Center ------- Thomas Good MIS Coordinator Vital Signs: tomg@ { admin | q8 } .nrnet.org Phone: 718-354-5528 Fax: 718-354-5056 /* Member: Computer Professionals For Social Responsibility */