LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-01-2011, 11:01 AM   #1
EnderX
Member
 
Registered: Nov 2006
Posts: 66

Rep: Reputation: 15
What is the preferred way to view the contents of a Berkeley DB file? - SuSE 9.3 Box


As the topic title states, I would like to know the preferred way of viewing the contents of a Berkeley DB file. The machine the file is on is running SuSE 9.3, with perl 5.8.6 and php 5.2.0 installed. (I'm not sure if stating that was necessary, but my understanding is that the more information I can provide you, the better. If I am wrong in this, I apologize.)

The purpose to this question is this: I have been requested to look into coming up with some form of Geocoding software for one of my company's clients. Specifically, I've been requested to look into trying to obtain Census tract/block information.

I discovered the Perl module Geo::Coder::US, which uses Census input (TIGER\Line files) to create a Berkeley DB file, then reads said file to produce its own output. However, the output from Geo::Coder::US only provides latitude and longitude information.

At the moment, my only interest is in popping the Berkeley DB file generated with the import script packaged with the Geo::Coder::US module. I'm trying to see what the contents of that DB file are, so I can determine if the information I'm after is even in there in the first place.

Please forgive me if this is a question with a too-obvious answer. I've only worked with MySQL and PostgreSQL before, so I know nothing about Berkeley DB systems.
 
Old 07-02-2011, 02:33 PM   #2
Peacedog
LQ Guru
 
Registered: Sep 2003
Location: Danville, VA
Distribution: Slackware, Windows, FreeBSD, OpenBSD, Mac OS X
Posts: 5,296

Rep: Reputation: 168Reputation: 168
Hi EnderX, You may want to try db-utils, particularly db_dump.

Good luck. ;-)
 
Old 07-02-2011, 03:12 PM   #3
aysheaia
LQ Newbie
 
Registered: Jun 2011
Distribution: Ubuntu
Posts: 26

Rep: Reputation: Disabled
You can, for example, use the BerkeleyDB perl module to parse le content of the database :
Code:
$ cat parse-db.pl
         use BerkeleyDB;
         my $env = new BerkeleyDB::Env 
                   -Home => "/database_directory/";
         my $db = new BerkeleyDB::Hash
                  -Filename => "database_file.db",
                  -Env => $env
           or die "cannot open database: $BerkeleyDB::Error\n";
         my $cursor = $db->db_cursor();
         while ($cursor->c_get($key, $value, DB_NEXT) == 0) {
           print "$key -> $value\n";
         }
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] View contents of initrd.lz file on live USB? Kenny_Strawn Ubuntu 2 09-07-2010 01:21 AM
Any command to view contents of CD image (iso file) ? lawrence_lee_lee Linux - Software 3 10-10-2007 12:38 AM
unable to view the contents!!! a1ora0 Slackware 1 09-29-2007 12:58 PM
How to view memory contents rockinsky Linux - Software 3 05-11-2006 05:09 PM
how to view contents of cd Synth218 Linux - Newbie 7 05-25-2003 06:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration