This discussion is archived
4 Replies Latest reply: Oct 6, 2012 6:29 AM by greybird RSS

Android - Execute Statements

957451 Newbie
Currently Being Moderated
Hi,

What i did so far:
in the libs folder i copied the je-android-5.0.48.jar and under properties -> java build path -> libraries i added this.

This is how i created my BDB and it works:
final File envDir = new File("/data/data/example_berkeleydb");
final EnvironmentConfig envConfig = new EnvironmentConfig();
envConfig.setTransactional(true);
envConfig.setAllowCreate(true);
env = new Environment(envDir, envConfig);
Transaction txn = env.beginTransaction(null, null);
final DatabaseConfig dbConfig = new DatabaseConfig();
dbConfig.setTransactional(true);
dbConfig.setAllowCreate(true);
dbConfig.setSortedDuplicates(true);
db = env.openDatabase(null, "exampledb", dbConfig);
txn.commit();

My problem is now:
It says that you can use SQLite commands in sqlite i did db.execSQL(my_statement); to do this? how does this work for BDB?


Thank you for you answers
  • 1. Re: Android - Execute Statements
    Charles Lamb Pro
    Currently Being Moderated
    You can not use BDB JE with SQLLite. Where does it say you can?

    Charles
  • 2. Re: Android - Execute Statements
    957451 Newbie
    Currently Being Moderated
    okay i think i read that i can use it like a SQLite DB.

    How do i create tables and insert data? I have no clue :(

    Thank you
  • 3. Re: Android - Execute Statements
    Charles Lamb Pro
    Currently Being Moderated
    There are various examples in the documentation and examples/ directory.

    Charles
  • 4. Re: Android - Execute Statements
    greybird Expert
    Currently Being Moderated
    You may be using the wrong BDB product. BDB JE doesn't have a SQLLite interface. BDB (the C-based product) does. So you may want to ask your questions about BDB, Android and SLQLite on the BDB forum:
    Berkeley DB
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points