This content has been marked as final.
Show 13 replies
-
1. Re: I create a database, but I can't find it on my harddisk. Why?
"Andrei Costache, Oracle-Oracle" Mar 30, 2007 8:42 AM (in response to 569973)Hi Lesslielee,
You'll find your database in the current working directory, or in the directory where you built your executable, depending on the situation.
You can change the #define directive to include an absolute path and filename for DATABASE, something like:
#define DATABASE "/home/test/LesslieData.db", or
#define DATABASE "C:\\test\\LesslieData.db" on Windows.
Regards,
Andrei -
2. Re: I create a database, but I can't find it on my harddisk. Why?
569973 Mar 30, 2007 12:47 PM (in response to "Andrei Costache, Oracle-Oracle")Thanks for your help.
But I used "find . -name 'LesslieData.db'" in the / directory to check, I couldn't find it.
I'll try again.
anyway thank you. -
3. Re: I create a database, but I can't find it on my harddisk. Why?
526060 Apr 2, 2007 4:15 AM (in response to 569973)Hi,
I just built and ran your test application on Windows. The database file "LesslieData.db" was created, and no errors were flagged.
Regards,
Alex -
4. Re: I create a database, but I can't find it on my harddisk. Why?
569973 Apr 3, 2007 3:05 AM (in response to 526060)Thank you for your test!
I built it on Linux, I don't know how to use Makefile, so that I use command gcc.
"gcc first.c -ggdb -I /usr/local/BerkeleyDB.4.5/include -L usr/local/BerkeleyDB.4.5/lib/libdb-4.5.a -ldb -lpthread -o first.out"
Is there anything wrong with my use of the compile? -
5. Re: I create a database, but I can't find it on my harddisk. Why?
526060 Apr 3, 2007 3:25 AM (in response to 569973)A more normal usage would be:
gcc first.c -ggdb -I/usr/local/BerkeleyDB.4.5/include -L/usr/local/BerkeleyDB.4.5/lib -ldb-4.5 -lpthread -o first.out
-L is used to specify a directory where libraries can be found
-l is used to specify the name of a specific directory -
6. Re: I create a database, but I can't find it on my harddisk. Why?
569973 Apr 3, 2007 3:39 AM (in response to 526060)Hi,
REALLY APPRECIATE your help!!!
One more question: in your sentence
"gcc first.c -ggdb -I/usr/local/BerkeleyDB.4.5/include
-L/usr/local/BerkeleyDB.4.5/lib -ldb-4.5 -lpthread -o
first.out"
what do "-ldb-4.5" and "lpthread" mean? -
7. Re: I create a database, but I can't find it on my harddisk. Why?
526060 Apr 3, 2007 3:51 AM (in response to 569973)Hi,
-ldb-4.5 is the name of the Berkeley DB library to use. The actual library file will be called libdb-4.5.{a/so}.
-lpthread, means to link against the pthread library.
Does the suggestion resolve your problem?
Regards,
Alex -
8. Re: I create a database, but I can't find it on my harddisk. Why?
569973 Apr 3, 2007 3:56 AM (in response to 526060)Hi, Alexander, thank you.
-ldb-4.5 is the lib name.
then I tried previously use "-L /usr/local/BerkeleyDB.4.5/lib/libdb-4.5.a -ldb",
is that correct?
and I think I have lots of questions with BDB, could we talk it by MSN or ICQ, or something else???
My MSN is lesslielee@hotmail.com
ICQ is 24293438 -
9. Re: I create a database, but I can't find it on my harddisk. Why?
526060 Apr 3, 2007 4:17 AM (in response to 569973)Hi Leslielee,
The difference is that you are providing the path and library name to the -L (library directory) compile option.
Then passing just "db" to the -l (library file) option.
You should be able to use:
"-l/usr/local/BerkeleyDB.4.5/lib/libdb-4.5.a" That is passing in a fully qualified library name, but the directory/file pair of options is generally better.
Do you see any error or warning messages when compiling your application? Can you compile and run the example applications included with Berkeley DB?
You can collate your questions and email me (alexander dot gorrod at oracle dot com), I will do my best to answer your questions.
Regards,
Alex -
10. Re: I create a database, but I can't find it on my harddisk. Why?
569973 Apr 3, 2007 6:35 AM (in response to 526060)Hi, Alexander.
I have to trouble you again...
I use the sentence you mentioned before,
" gcc first.c -ggdb -I /usr/local/BerkeleyDB.4.5/include -L /usr/local/BerkeleyDB.4.5/lib -ldb-4.5 -lpthread -o first.out"
There is no error or warning message appeared. But when I run "first.out", system give me error message as below.
"[root@localhost BerkeleyDB.4.5]# ./first.out
./first.out: error while loading shared libraries: libdb-4.5.so: cannot open shared object file: No such file or directory"
What's wrong with it? faint~@#$ -
11. Re: I create a database, but I can't find it on my harddisk. Why?
569973 Apr 3, 2007 7:58 AM (in response to 569973)Hi, Alexander
I've solve the problem.
It's the problem about compile configuration. I did not add the path "/usr/local/BerkeleyDB.4.5/lib/" into file "/etc/ld.so.conf", and never run the command "ldconfig".
Hooh, anyway, I solved it!!!
And, another question is :
[root@localhost Lesslielee]# ll
total
drwxr-xr-x 2 root root 4096 April 3 15:41 BDB_env
-rw-r--r-- 1 root root 3113 April 3 15:51 c_env.c
-rwxr-xr-x 1 root root 34102 April 3 15:52 c_env.out
-rw-r----- 1 root root 24576 April 3 15:54 __db.001
-rw-r----- 1 root root 163840 April 3 15:54 __db.002
-rw-r----- 1 root root 270336 April 3 15:54 __db.003
drwxrwxr-x 3 root root 4096 March 26 10:38 dbSetup
drwxr-xr-x 2 root root 4096 April 3 15:27 dbTest
-rw-r--r-- 1 root root 2677 April 3 15:40 test1.c
-rwxr-xr-x 1 root root 5934 April 3 15:40 test1.out
-rw-r--r-- 1 root root 8192 April 3 15:54 testDB.db
why are there three files called "__db.001, __db.002, _db.003"? They were created at the same time as "testDB.db" created. -
12. Re: I create a database, but I can't find it on my harddisk. Why?
526060 Apr 3, 2007 8:06 AM (in response to 569973)Congratulations!
The __db.XXX files contain the shared memory regions used by Berkeley DB. The regions contain all of the per-process and per-thread shared information (including mutexes), that comprise a Berkeley DB environment.
More information here:
http://www.oracle.com/technology/documentation/berkeley-db/db/ref/env/region.html
The default behavior is to create regions using the POSIX mmap interface, which creates the backing files you see.
Regards,
Alex -
13. Re: I create a database, but I can't find it on my harddisk. Why?
569973 Apr 3, 2007 9:03 AM (in response to 526060)Thank you very very very much, Alexander!!!
I'll read it, and I will try my best to study BDB.
Thanks a lot!!
sincerely, Lesslie

