Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: Inserting file into a database

by Anonymous Monk
on Jan 10, 2003 at 13:37 UTC ( [id://225788]=note: print w/replies, xml ) Need Help??


in reply to Re: Inserting file into a database
in thread Inserting file into a database

Thanks for many responses. I just want to load the filename and the letter in the database not the contents of the file.

Is the above script going to work? I cant seem to get it to work.

Replies are listed 'Best First'.
Re: Re: Re: Inserting file into a database
by derby (Abbot) on Jan 10, 2003 at 13:51 UTC
    Okay. For your above script, put some error checking into it so you can see where the failure is taking place.

    #!/usr/bin/perl -w use strict; my $filename = "File_Name_One"; my $letter = "A"; my $dbh = DBI->connect("DBI:ODBC:databasename", "","") || die "error: ($DBI::errstr)\n"; my $firstvar = $dbh->quote($filename); my $secondvar = $dbh->quote($letter); my $statement = "Insert into tableOne (filename, letter) values ($firstname, $letter)"; # Now you need to actually execute the statement $dbh->do( $statment ) || die "error: $dbh->errstr\n"; # rest of code

    -derby

      Thank yous to all.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://225788]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-03-28 17:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found