Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6815129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:46:13+00:00 2026-05-26T20:46:13+00:00

I am trying to write a program that uses a Berkeley Database and i

  • 0

I am trying to write a program that uses a Berkeley Database and i configured my database as followed :

DatabaseConfig dbConfig = new DatabaseConfig();

dbConfig.setType(DatabaseType.HASH);
dbConfig.setAllowCreate(true);
dbConfig.setSortedDuplicates(false); //tried commented this out as well

// Create the database
std_db = new Database("name.db", null, dbConfig); //delcared as a private variable

I have been spending the last hour searching the web for what happens with a key/data pair when a new key to be entered matches an existing one. According to the API the current data will be overwritten with the new data, but in my program it seems that this is not the case. Anyone know how to make it so that if im putting into a database and the key exists it will overwrite the old data?

I was thinking of just deleting the old key first and then putting in the new key/data combo, but this solution is a work-around and just adds unnecessary overhead.

Thanks in Advance 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:46:13+00:00Added an answer on May 26, 2026 at 8:46 pm

    I think database.put() is the solution. According to below link:

    The Db::put method stores key/data pairs in the database. The default behavior of the Db::put function is to enter the new key/data pair, replacing any previously existing key if duplicates are disallowed, or adding a duplicate data item if duplicates are allowed. If the database supports duplicates, the Db::put method adds the new data value at the end of the duplicate set. If the database supports sorted duplicates, the new data value is inserted at the correct sorted location.

    http://web.deu.edu.tr/doc/berkeley/berkeleyDB/api_cxx/db_put.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a simple C++ program that uses Berkeley DB for storage.
I'm trying to write a program that uses sockets to connect with other instances
I'm trying to write a program in Java that uses osql to generate a
I am trying to write a program that uses file I/O to score personality
I'm trying to write a program with g++ that uses conio.h header. What I'm
So I'm trying to write a C program that uses inotify. I've used pyinotify
I am trying to write a program that uses a C API. This API
gud day... i'm trying to write a program in javascript that uses .json. i
I'm trying to write a program that uses fattach but the compiler says fattach
I am trying to write a program that uses a timer, duration, start time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.