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.