7 Replies Latest reply: Apr 27, 2011 4:05 PM by 637288 RSS

    DbEnv in 2.4.16 vs 2.5.16

    701567
      I am building an application using dbxml-2.4.16 but now see a dbxml-2.5.16 version available. After downloading and compiling against dbxml-2.5.16 I get a DbEnv error (error: DbEnv has not been declared).

      Comparing dbxml-2.4.16 to dbxml-2.5.16 seems to omit DbEnv from key files.

      If I use dbxml-2.4.16 everything is fine if I use dbxml-2.5.16 it doesn't build.

      Is this a bug or is there something I need to change in my code to use dbxml-2.5.16?

      Thanks

      dhk
        • 1. Re: DbEnv in 2.4.16 vs 2.5.16
          637288
          Hi,

          are you using Java or C++ API?
          can you provide more details? What is the stacktrace?

          Vyacheslav
          • 2. Re: DbEnv in 2.4.16 vs 2.5.16
            701567
            Yes, I'm using the C++ API. Below is the stack trace.

            $ make
            make all-recursive
            make[1]: Entering directory `/home/max/Dev/Pos/PosRepo01'
            Making all in m4
            make[2]: Entering directory `/home/max/Dev/Pos/PosRepo01/m4'
            make[2]: Nothing to be done for `all'.
            make[2]: Leaving directory `/home/max/Dev/Pos/PosRepo01/m4'
            Making all in src
            make[2]: Entering directory `/home/max/Dev/Pos/PosRepo01/src'
            make[3]: Entering directory `/home/max/Dev/Pos/PosRepo01/src'
            if g++ -DHAVE_CONFIG_H -I. -I. -I.. -Wall -g2 -O0 -DDEBUG -DG_LOG_DOMAIN=\"180Logic\" -DPACKAGE_DATA_DIR=\""/tmp/180logic"\" -DPACKAGE_LOCALE_DIR=\""/tmp/180logic/locale"\" -DROOT180LOGICDIR=\""/tmp/180logic"\" -I/opt/BerkeleyDB/dbxml-2.5.16/install/include -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng14 -I/usr/include/libxml2 -I/usr/include/gtkmm-2.4 -I/usr/lib64/gtkmm-2.4/include -I/usr/include/atkmm-1.6 -I/usr/include/giomm-2.4 -I/usr/lib64/giomm-2.4/include -I/usr/include/pangomm-1.4 -I/usr/lib64/pangomm-1.4/include -I/usr/include/gtk-unix-print-2.0 -I/usr/include/gdkmm-2.4 -I/usr/lib64/gdkmm-2.4/include -I/usr/include/glibmm-2.4 -I/usr/lib64/glibmm-2.4/include -I/usr/include/sigc++-2.0 -I/usr/lib64/sigc++-2.0/include -I/usr/include/cairomm-1.0 -I/usr/lib64/cairomm-1.0/include -DMAKE_POS0 -DEXACTNESS -g -O2 -MT pos0-bdb.o -MD -MP -MF ".deps/pos0-bdb.Tpo" -c -o pos0-bdb.o `test -f 'bdb.cpp' || echo './'`bdb.cpp; \
                 then mv -f ".deps/pos0-bdb.Tpo" ".deps/pos0-bdb.Po"; else rm -f ".deps/pos0-bdb.Tpo"; exit 1; fi
            bdb.cpp:32: error: ‘DbEnv’ has not been declared
            bdb.cpp:32: error: expected constructor, destructor, or type conversion before ‘plu_env’
            bdb.cpp:35: error: ISO C++ forbids declaration of ‘DbEnv’ with no type
            bdb.cpp:35: error: expected ‘,’ or ‘...’ before ‘*’ token
            bdb.cpp: In constructor ‘Inventory::Inventory()’:
            bdb.cpp:108: error: ‘plu_env’ was not declared in this scope
            bdb.cpp: At global scope:
            bdb.cpp:166: error: ISO C++ forbids declaration of ‘DbEnv’ with no type
            bdb.cpp:166: error: expected ‘,’ or ‘...’ before ‘*’ token
            bdb.cpp: In function ‘void errHndlr(int)’:
            bdb.cpp:167: error: ‘errMsg’ was not declared in this scope
            bdb.cpp: In member function ‘void Inventory::setPluEnv()’:
            bdb.cpp:224: error: ‘plu_env’ was not declared in this scope
            bdb.cpp: In member function ‘int Inventory::openPlu() const’:
            bdb.cpp:249: error: ‘plu_env’ was not declared in this scope
            bdb.cpp: In member function ‘int Inventory::createPlu() const’:
            bdb.cpp:360: error: ‘plu_env’ was not declared in this scope
            bdb.cpp: In member function ‘void Inventory::dbgIndex() const’:
            bdb.cpp:445: error: ‘plu_env’ was not declared in this scope
            bdb.cpp: In member function ‘const DbXml::XmlDocument Inventory::getDoc(ITEM_ROW* const&) const’:
            bdb.cpp:552: error: ‘plu_env’ was not declared in this scope
            bdb.cpp: In member function ‘int Inventory::insertItem(char*) const’:
            bdb.cpp:637: error: ‘plu_env’ was not declared in this scope
            bdb.cpp: In member function ‘int Inventory::selectItem(ITEM_ROW* const&, char* const&, xmlDoc*&) const’:
            bdb.cpp:840: error: ‘plu_env’ was not declared in this scope
            bdb.cpp: In member function ‘int Inventory::deleteItem(ITEM_ROW* const&) const’:
            bdb.cpp:919: error: ‘plu_env’ was not declared in this scope
            bdb.cpp: In member function ‘int Inventory::updateItem(ITEM_ROW* const&, char*) const’:
            bdb.cpp:1004: error: ‘plu_env’ was not declared in this scope
            make[3]: *** [pos0-bdb.o] Error 1
            make[3]: Leaving directory `/home/max/Dev/Pos/PosRepo01/src'
            make[2]: *** [all-recursive] Error 1
            make[2]: Leaving directory `/home/max/Dev/Pos/PosRepo01/src'
            make[1]: *** [all-recursive] Error 1
            make[1]: Leaving directory `/home/max/Dev/Pos/PosRepo01'
            make: *** [all] Error 2

            In my configure.ac file I have the following. If I switch lines and use the first with 2.4.16 in it it builds correctly.
            #berkeleyDb='/opt/BerkeleyDB/dbxml-2.4.16/install/include'
            berkeleyDb='/opt/BerkeleyDB/dbxml-2.5.16/install/include'
            AC_SUBST(berkeleyDb)

            $ pwd
            /opt/BerkeleyDB
            $ ls -l
            total 88444
            drwxr-xr-x 7 100 users 4096 Nov 14 2008 dbxml-2.4.16
            -rw-r--r-- 1 max users 37634783 Nov 14 2008 dbxml-2.4.16.tar.gz
            drwxr-xr-x 7 100 users 4096 Mar 31 08:04 dbxml-2.5.16
            -rw------- 1 max max 52819154 Mar 29 17:32 dbxml-2.5.16.tar.gz

            Thanks,

            dhk
            • 3. Re: DbEnv in 2.4.16 vs 2.5.16
              655560
              Hi,

              Since in 2.5, BDB XML uses BDB C API instead of BDB C++ API, so you need to use C API instead. e.g.: use DB_ENV to substituate for DbEnv respectively.

              Best regards,
              Rucong Zhao
              Oracle Berkeley DB XML
              • 4. Re: DbEnv in 2.4.16 vs 2.5.16
                637288
                Additionally to Rucong's reply, this link may be helpful:
                http://download.oracle.com/otndocs/products/berkeleydb/html/2.5.html

                Just look at the 2.5.13 changelog in the section "Changes That May Require Application Modification"

                Vyacheslav
                • 5. Re: DbEnv in 2.4.16 vs 2.5.16
                  701567
                  That looks like the problem. I don't know why they would do that. It looks like a bit of a nuisance to change, I hope they don't do this very often. I'll make the changes later. Thanks.
                  • 6. Re: DbEnv in 2.4.16 vs 2.5.16
                    701567
                    I still have a problem. In the documentation it says:

                    Changes That May Require Application Modification:

                    1. C++ applications are required to change the use of the Berkeley DB C++ objects in the public interface to their C equivalents. Such changes are mechanical, replacing DbEnv* with DB_ENV * and DbTxn * with DB_TXN * and only a few interfaces are affected. For example, XmlManager::XmlManager(DbEnv *, u_int32_t) becomes XmlManager::XmlManager::(DB_ENV *, u_int32_t). The DbEnv object has a method, DB_ENV DbEnv::get_DB_ENV() that can be used. Similarly, DbTxn has a method DB_TXN DbTxn::get_DB_TXN() that can be used.

                    I made the DbEnv* to DB_ENV * change and still have a problem.


                    The problem is where I declare my environment object. The way I was doing it is:
                    DbEnv::DbEnv my_env(0);

                    I this the statement "The DbEnv object has a method, DB_ENV *DbEnv::get_DB_ENV() that can be used." from the documentation is the substitute. However, what I tried didn't work.

                    What am I suppose to do here?

                    Thanks,

                    dhk
                    • 7. Re: DbEnv in 2.4.16 vs 2.5.16
                      637288
                      Hi,

                      you should completely eliminate usage of the DbEnv class: use the DB_ENV structure instead wherever you used DbEnv before. You don't need *DbEnv::get_DB_ENV() any longer. If the problem persists, please post the precise error message that you get during compilation.

                      Vyacheslav

                      Edited by: detonator413 on Apr 27, 2011 11:04 PM