views:

42

answers:

1

This is very perplexing, but I'm having this weird error. Here's the code I have:

my $env = new BerkeleyDB::Env ( 
    -Home   => "$dbFolder", 
    -Flags  => DB_CREATE | DB_INIT_CDB | DB_INIT_MPOOL | DB_CDB_ALLDB
) or die "cannot open environment: $BerkeleyDB::Error\n";

my $unsortedHash  = BerkeleyDB::Hash->new (
    -Filename => "Unsorted.db", 
    -Flags => DB_CREATE,
    -Env  => $env
) or die "couldn't create: $!, $BerkeleyDB::Error.\n";

And I ran this just fine last week to make a couple databases and load them with information. Now I'm trying to open the existing databases, but it keeps giving me this error:

couldn't create: No such file or directory, Successful return: 0.

So, the API returns a success, and I know the call is failing for some reason, and it says "No such file", but I have checked my $dbFolder many times and used it to open the folder, so it is fine. I tried removing the DB_CREATE flag as well. If I make the same call with a different, empty $dbFolder, it works just fine and creates new databases. But how do I open my CURRENT databases?

EDIT: I removed the extra '\' from the end of the Env object, and I tried both absolute paths and just "Unsorted.db" for the DB object. Same error, no dice.

EDIT2: I remember that I did move this database file to another folder, would that have anything to do with this problem?

A: 

Are you sure the database folder includes a literal \? Seems unlikely. I'd try removing the \\ from the -Home line.

zigdon
Nope, I tried fixing those, but the same errors are still there.
Sho Minamimoto