Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl and PostgreSQL

Status
Not open for further replies.

tanveer91

Programmer
Nov 13, 2001
31
GB
Is it possible to insert records in a PSQL Database using Perl??

Please give examples. Thanks
 
I know of a Government Agency that is implementing those two very same peices of technology for an extremely successful program.

Now, I've only connected to a MySQL DB using Perl, but I believe it would be able to connect to PostgreSQL use the DBI module.

Inserting records is a matter of knowing how to write an SQL statement, and then feeding that to perl:

# after connecting to pstgrsql and have a database handle:

my $query = "INSERT INTO table_name ... yada yada yada";

my $it_worked = $database_handle->do($query);

print "Data Inserted!" if $it_worked;

print "Data Not Inserted!" unless $it_worked;

# That's it...

Hope this helps. Hope I'm right too... :
--jim
 
tanveer, have a look at the database FAQ's in this section, sounds as if the DBI will meet your needs, we use the DBI with PostgreSql at work with good results. Mike
________________________________________________________________________________

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top