Berkeley DB with C++

I am a new comer to the Berkelet DB, Does anyone could give some examples how to start with Berkelet DB? Thanks. My e-mail is: [email protected]

Hi Richard,
You will find starting guides on Berkeley DB on the documentation page:
http://www.oracle.com/technology/documentation/berkeley-db/db/index.html
Also, in the directory where you built/installed/unzipped Berkeley DB, there are a couple of directories in which you can find samples (examples_c, examples_cxx, examples_java).
Information on how to build Berkeley DB and run examples are found on the following link:
http://www.oracle.com/technology/documentation/berkeley-db/db/ref/build_win/intro.html
Regards,
Andrei Costache
Oracle Support Services

Similar Messages

  • How can I use the latest Berkeley DB with SQL API in PHP app?

    Hi,
    I'm a PHP developer and I already use Berkeley DB in my applications using the [DBA Functions|http://www.php.net/manual/en/ref.dba.php] . I'm very interested in the latest Berkeley DB release. How can I write a PHP program that uses the SQL API of the latest Berkeley DB release?

    Hi Kurt,
    I'm not a PHP expert (far from it), but the simplest way to get started with the Berkeley DB SQL interface is to run Berkeley DB's <tt>configure</tt> script with the <tt>--enable-sql_compat</tt> flag.  This will create a library called <tt>libsqlite3.so</tt> that you can use as a drop-in replacement for SQLite at the API level.  Database files still need to be converted with a SQLite <tt>.dump</tt> followed by a <tt>.read</tt> with the <tt>dbsql</tt> tool.
    This should then allow the existing PHP driver and application code to switch over to Berkeley DB without any code changes by setting <tt>LD_LIBRARY_PATH</tt> to find the Berkeley DB version of <tt>libsqlite3.so</tt> ahead of SQLite. Note that any other code that relies on SQLite will also run against Berkeley DB with this configuration, which can cause problems if the system libraries use SQLite (for example, on Mac OS X). For that reason, a better long term solution would be for the PHP SQLite driver to have a mode where it loads <tt>libdbsql.so</tt> rather than <tt>sqlite3.so</tt>.
    I hope this helps, please let us know how you go because I'm sure lots of other PHP developers will be interested in the answer.
    Regards,
    Michael Cahill, Oracle Berkeley DB.

  • I want to get the source code of the examples of berkeley DB with Java

    Hi
    I want to get the source code of the examples of berkeley DB with Java
    Thanks and Regards
    Rahul

    Look in the "examples" directory, in the BDB JE package that you downloaded.
    --mark                                                                                                                                                                           

  • Berkeley DB with SQL API: Where to start?

    Hi,
    I am an Oracle DBA and just starting to look at Berkeley DB for a new project at work. I intend to use the SQL API, so I have downloaded and installed Berkeley 11g R2 (using the windows msi).
    However, I have been browsing around the documentation for 2 days now but still don't understand how to actually create a database! Is this not possible with the SQL API? Do I have to do it from "somewhere else" and just use the API to access the data?
    The strange thing is, if I open the API (dbsql) I can create a table:
    dbsql> create table test_tab(x int) ;
    dbsql> .tables
    test_tab
    dbsql> exitBut I have no idea where that table is actually created and stored? I don't see a file on disk (a "database" is a file, right?). If I open dbsql again, the table is not shown.
    Sorry for the dumb questions but I'm really an old relational-DB guy struggling to come to terms with this architecturally and functionally different idea of a database. Hope someone can help, or at least point me to a "Berkeley DB using SQL API for complete and utter dummies" type guide.
    Regards,
    El DBA

    Hi Sandra,
    Thanks very much for the information. I have been looking through the documentation and starting to get to grips with this now.
    We do have one important issue though, which comes from within the FAQ you mentioned. I see it's also been talked about in this thread:
    ado.net provider
    In the FAQ, it says:
    Does Berkeley DB support ADO.NET?
    There are some known issues related to using the public domain SQLite ADO.NET provider with Berkeley DB. We are actively working on clearly defining those issues, and hopefully resolving them. Is there any idea of a date for the ado.net support? In our development, we are using that very same provider, which is the same one as mentioned in that thread (it's system.data.sqlite.dll from http://sqlite.phxsoftware.com) but will not be able to commit to developing with Berkeley until the support is offered.
    Kind regards,
    Adam
    Edited by: El DBA on Jul 29, 2010 1:13 PM
    Edited by: El DBA on Jul 29, 2010 1:16 PM

  • Compiling Berkeley DB with MinGW

    Has anyone compiled Berkeley DB using MinGW, and if so, would you mind sharing the steps necessary to do this?

    Perhaps I need to download a different source for Berkeley....when executing the prescribed commands I get an error message:
    RAI@RAPHAEL-01 /c/Oracle/db-4.7.25.NC
    $ ./configure --enable-mingw
    sh: ./configure: No such file or directory
    I downloaded the file "db-4.7.25.NC.zip". It does not contain a configure executable.
    Note that I'm using MSYS for the unix-like shell. When compiling other programs the configure program was provided with the source.
    I tried copying one of these configure programs and using it, but it does not recognize the --enable-mingw flag.
    Sorry if I'm not much help here.

  • How to query berkeley db with multiple keys

    Hi all,
    Is there a way to query a berkeleydb using multiple keys. For example, I want to query a order record with orderID and orderDirection, orderID is a string and orderDirection is a char.
    Is there a way to do so?
    Regards,
    -Bruce

    Hi Bruce,
    Yes, you would use the same approach with a join cursor.
    Here is a simple example, simplified for brevity. Suppose the primary database "books" stores information about books, and that these books could have multiple authors. Following is some example data and the structure of these databases:
    books.db (primary db -- ISBN is primary key)
    isbn_1 | {author_1, author_2; ...}
    isbn_2 | {author_2; ...}
    isbn_3 | {author_1, author_3; ...}
    booksAuthors.db (secondary db -- author is the secondary key, the secondary key extractor generates multiple keys)
    author_1 | isbn_1
    author_1 | isbn_3
    author_2 | isbn_1
    author_2 | isbn_2
    author_3 | isbn_3
    To get the books authored by author_1 and author_2 for example, you would do the following:
    - position a cursor in the booksAuthors.db secondary db, using DBcursor->get() with the DB_SET flag, on the records whose key (secondary key) is author_1;
    The cursor will be positioned on the duplicates list for author_1:
    author_1 | isbn_1
    author_1 | isbn_3
    - position a cursor in the booksAuthors.db secondary db, using DBcursor->get() with the DB_SET flag, on the records whose key (secondary key) is author_2, hence duplicates list for author_2:
    author_2 | isbn_1
    author_2 | isbn_2
    - create a join cursor using DB->join, using the previous two cursors.
    An excerpt from the above documentation page explains the way a join cursor works:
    "Joined values are retrieved by doing a sequential iteration over the first cursor in the curslist parameter, and a nested iteration over each secondary cursor in the order they are specified in the curslist parameter. This requires database traversals to search for the current datum in all the cursors after the first."
    Hence, the data item (primary key from the primary db) that results is isbn_1.
    Regards,
    Andrei

  • How berkeley db performance with appache tomcat

    can any one tell me how berkeley db performs with appach tomcat jjava application server.
    i m presised in finding the speed (accessing)

    Hi,
    Many of the folks that typically respond to these questions do not have direct experience with tomcat and Berkeley DB. It would be great if folks from the user community would chime in here and share their experiences and performance.
    We do know that some/many folks use Berkeley DB with Tomcat so hopefully folks will respond.
    Regards,
    Ron

  • Working with BDB SQL API (libsqlite3.a) on iPhone Simulator

    Hi,
    I downloaded latest BDB and got a static library libsqlite3.a by compiling the code on Mac OS X (1.6.8 64bit).
    I am now trying to use this library as a drop in replacement into a SQLite project.
    I copied the SQLite database (with only one table) to a new Berkeley DB.
    I want to access this new Berkeley DB with existing code using SQLite.
    I followed following steps:
    1. Added (copied) libsqlite3.a from build directory to my project
    2. Added #import <db.h> and left #import <sqlite3.h> as it is
    3. compiled the code and ran it in iPhone simulator
    The code runs fine until I go to prepare a statement. Please see the snippet from the function below:
    - (void)initializeDatabase {
    NSMutableArray *todoArray =[[NSMutableArray alloc] init];
    self.todos = todoArray;
    [todoArray release];
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *path = [documentsDirectory stringByAppendingPathComponent:@"todo.db"];
    if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) {      // This is ok, opens berkeley DB
    const char *sql = "SELECT pk FROM todo";
    const char *tail;
    sqlite3_stmt *statement;
    if (sqlite3_prepare_v2(database, sql, -1, &statement, &tail) != SQLITE_OK) {    *// Fails here - table and records exist in Berkeley DB*
    if (sqlite3_step(statement) == SQLITE_ROW) {
    int primarykey = sqlite3_column_int(statement, 0);
    Todo *td = [[Todo alloc] initWithPrimaryKey:primarykey database:database];
    [todos addObject:td];
    [td release];
    } else {
    NSAssert1(0, @"Failed to read from the table '%s'.", sqlite3_errmsg(database));
    sqlite3_close(database);
    sqlite3_finalize(statement);
    } else {
    NSAssert1(0, @"Failed to open database with message '%s'.", sqlite3_errmsg(database));
    sqlite3_close(database);
    The log dump:
    GNU gdb 6.3.50-20050815 (Apple version gdb-1518) (Sat Feb 12 02:52:12 UTC 2011)
    Copyright 2004 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB. Type "show warranty" for details.
    This GDB was configured as "x86_64-apple-darwin".sharedlibrary apply-load-rules all
    Attaching to process 14578.
    Pending breakpoint 1 - ""todoAppDelegate.m":109" resolved
    Current language: auto; currently objective-c
    /Users/kpotnis/Library/Application Support/iPhone Simulator/4.3.2/Applications/0322BCD5-4C71-498E-82EC-469133B7A935/Documents/todo.db: BDB0113 Thread/process 14578/2696754496 failed: BDB1507 Thread died in Berkeley DB library
    Any thoughts?
    Edited by: 868618 on Jul 11, 2011 4:51 AM

    Hi,
    I was looking over this and I was wondering if you've got the chance to progress with this issue or if you need assistance?
    Thanks,
    Bogdan Coman

  • Using BDB with IBM GPFS

    Hi experts,
    Can I put ENV and DB files on shared file system such like IBM's GPFS(General Parallel File System)? I want to make two nodes to update same database by sharing it using shared disk technology.
    Following URL is about GPFS.
    http://www.redbooks.ibm.com/redbooks/pdfs/sg245165.pdf
    Thanks.
    Let me add some comment for this.
    The application is email server. For load-balancing two email servers are behind of L4 switch. And those 2 nodes shares a disk using GPFS (similiar with SAN storage such like Veritas's CFS). Customer wants to place BDB database on that disk and read/write transactions on it.
    Does this architecture make sense?
    Any comment would be very appreciated.
    Thank you.
    Message was edited by:
    user610522

    Hello,
    The short answer is, it is unlikely. Though I am not familiar with the specific filesystem you are talking about.
    Detailed information on using Berkeley DB with remote file systems can be found in the Berkeley DB reference guide here:
    http://www.oracle.com/technology/documentation/berkeley-db/db/ref/env/remote.html
    and in the Berkeley DB FAQ here:
    http://www.oracle.com/technology/products/berkeley-db/faq/db_faq.html#30
    You might be able to use the Berkeley DB replication functionality to share a database between multiple clients. Information on Berkeley DB replication is here:
    http://www.oracle.com/technology/documentation/berkeley-db/db/gsg_db_rep/C/index.html
    Regards,
    Alex Gorrod, Oracle

  • Berkeley DB and DRBD

    Hello,
    Do you have any advices to give about the use of Berkeley DB with DRBD (on linux clusters)?
    Things I must have in mind, etc.
    Note : Currently, my Berkeley DB databases are stored on a replicated storage managed by DRBD on a two-node Linux cluster. These DBs are handled inside an environment using transactions.
    Thanks

    Hello,
    The default is memory mapped files. For the BDB SQL API, we do not
    yet support DB_SYSTEM_MEM, for allocating memory from system
    shared memory. For more details see:
    BDB SQL Performance
    The "Shared memory regions" documentation at:
    http://download.oracle.com/docs/cd/E17076_02/html/programmer_reference/env_region.html
    provides a further discussion of memory mapped files vs DB_SYSTEM_MEM.
    Thanks,
    Sandra

  • Perforamance comparison of various available Berkeley DB versions

    Hi All,
    I am currently using Berkeley DB 4.5.20 in my project for message storage. It is handling 1500 messages/sec. I want to improve the performance to 3000 messages/sec.
    I have tried to check the change logs for all the latest and available versions of Berkeley DB. I am not able to find any significant information that talks about the performance enhancement in the Berkeley DB with respect to processing and optimization of existing algorithms.
    If someone is using Berkeley DB for similar kind of usage or has data that explains performance comparison between Berkeley DB 4.5.20 and all latest versions available. Please share.
    Thanks
    Rahul

    Hi Rahul,
    We don't have performance comparisons for the various versions of Berkeley DB. As a general statement, we work on performance projects in each new release of Berkeley DB. However, it is difficult to say whether you'll get a 2X performance improvement for your workload simply by upgrading the BDB version.
    Having said that, I'd definitely recommend that
    a) you upgrade to the latest release at the earliest convenient opportunity. We've added many new features and enhancements since BDB 4.5.
    b) you look into optimizing your existing Berkeley DB configuration and application. Quite often, we find that performance can be improved significantly as a result. We're happy to help with that, but we'll need a lot more detail about your app and set up. My suggestion is that you spend some time analyzing and tuning the application and then post your questions to the forum.
    Hope this helps.
    Thanks and warm regards.
    ashok

  • Berkeley DB installation guide asking...

    Hi,
    I'm the new user of Berkeley DB. I facing one of the problem now.
    Actually I'm trying to install DB_File Version 1.82. It requires Berkeley DB for PREREQUISITES.
    I'm using the ia64 GNU/Linux, perl, v5.8.8. I got a bit confusing which path or link that I should refer to proper install of Berkeley DB.
    Hope can get the advice from all Berkeley DB user.
    Thanks a lot for any advice and help.

    Hi,
    I just accessed the link now, so you should be able to get there if you try again. In any case here is what that documentation says:
    Using Berkeley DB with Perl
    The original Perl module for Berkeley DB was DB_File, which was written to interface to Berkeley DB version 1.85. The newer Perl module for Berkeley DB is BerkeleyDB, which was written to interface to version 2.0 and subsequent releases. Because Berkeley DB version 2.X has a compatibility API for version 1.85, you can (and should!) build DB_File using version 2.X of Berkeley DB, although DB_File will still only support the 1.85 functionality.
    DB_File is distributed with the standard Perl source distribution (look in the directory "ext/DB_File"). You can find both DB_File and BerkeleyDB on CPAN, the Comprehensive Perl Archive Network of mirrored FTP sites. The master CPAN site is ftp://ftp.funet.fi/.
    Versions of both BerkeleyDB and DB_File that are known to work correctly with each release of Berkeley DB are included in the distributed Berkeley DB source tree, in the subdirectories perl.BerkeleyDB and perl.DB_File. Each of those directories contains a README file with instructions on installing and using those modules.
    The Perl interface is not maintained by Oracle. Questions about the DB_File and BerkeleyDB modules are best asked on the Usenet newsgroup comp.lang.perl.modules.
    ==========
    As I mentioned I checked the README files under the Berkeley DB home directory, perl/BerkeleyDB and per/DB_File directories, and they contain the needed information.
    Thanks,
    Sandra

  • Berkeley DB  about hash Access Methods

    When I use Berkeley DB with hash Access Methods, and the recored is very large, I want to know:
    for examle when i insert two recored
    (key1, data1) and (key2, data2) into DB, the hash of key1 and hash of key2 is same, but key1 and key2 is different, how the Berkeley DB to do this?
    is the Berkeley DB cover the key1,data1 with key2,date2 ?, if so, i think it is a terrible things.
    thanks for any reply, waiting......

    You are very welcome, thanks again,
    but now i find the Berkeley DB working are very slowly when the Database size grow up to more than 2GB, below is the list of my computer information:
    OS: windows server 2003
    API: C language
    memory: 1GB
    CPU: intel 820
    database Access Methods: hash
    key and dada: key is always char[32], data is always int32
    when I open the database in the env, I didn't set the catch and page size because I don't know how to set it, and i also find there is anthor method to improve the performance by set the "Page fill factor", and "DB->set_h_ffactor", but can you give me some advice how can set it to make DB more fast,
    by the way I find when the Berkeley DB's database size is larger than memory, it works very slowly, why?

  • Berkeley DB for Android

    Hi, I intend to use Berkeley DB with Android, but I wasn't able to find any valuable starter user guide. Are there any of thoose materials available?
    Thanks
    Hmyzak

    Have you read the "A Simple HOWTO for Using Berkeley DB Java Edition on the Android Platform" guide??
    http://download.oracle.com/docs/cd/E17277_02/html/HOWTO-Android.html

  • Berkeley DB internals

    Hi,
    I am trying to understand how Berkeley DB works. I have downloaded the source tar ball and want to understand the code. The documents in the tar ball all speak of how to use Berkeley DB with examples. Being an open-source DB, i would like to understand how file reads/writes are done. I am particularly interested in how BTREE method is implemented(in memory seems to be easy, but on file is hard!!!). Any guidance/directions/suggestions is highly is appreciated.
    Thanks,
    Balaji.

    Hi,
    The best thing to do is to ask specific questions after reading the documentation that is publicly available here: http://www.oracle.com/technology/documentation/berkeley-db/db/index.html
    Bogdan Coman

Maybe you are looking for

  • Mac is running slow after upgrading to maverick

    My macbook pro is running very slow since I upgraded to 10.9

  • ALV Object Model - Merged Cells

    Hi all    When utilizing ALV Object Model, how do I display cells as merged when they have the same content?    Can someone help me out?    Thank you very much!

  • Impact of movement type 412 E on MAP

    Hi Usage of movement type 412 E is causing huge change in MAP . Is there any reciprocaory movement to curb this MAP rise ? Regards, Lalit

  • New tabelspace for standby DB

    Hi, i have created new tabelspace in the primary DB and i want sea it with it's object in standby DB when i open it on read only. What is the steps to follow for this, without reset the standby DB form scrash. my severs are 9i Standard edition on lin

  • ACROBAT PRO 7.0

    I have original DISC AND SERIAL NUMBER. ADOBE WEBSITE SAYS IT IS INVALID and will not let me download!! BOUGHT NEW COMPUTER, NO CD DRVIE. stuck! please help!