dbTalk Databases Forums  

How to start a demo (BerkeleyDB.4.4.20----build_vxworks)under vxworks5.5?

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss How to start a demo (BerkeleyDB.4.4.20----build_vxworks)under vxworks5.5? in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
huang0730 (Offline)
Junior Member
 
Posts: 2
Join Date: May 2006

Default How to start a demo (BerkeleyDB.4.4.20----build_vxworks)under vxworks5.5? - 05-10-2006 , 10:03 PM






Hello,I have a question :
My host: Windows xp
My target: VxSim

I added BerkeleyDB22.wpj to my workspace and set a new build to SIMNTgnu,then I create my own project test.wpj building to SIMNTgnu.After that ,I downloaded them to vxSim successfully. when I spawn a task in WindSh like this :sp db_function

Errors come here:
__fop_file_setup: Retry limit (100) exceeded
ERROR:errno = 0x11
0x1cb92b8 (s1u0): 00 task is working
DB->put: method not permitted before handle's open method
0x1cb92b8 (s1u0): 01 task is working
ERROR:errno = 0x16
DB->get: method not permitted before handle's open method
ERROR:errno = 0x16
0x1cb92b8 (s1u0): 02 task is working
OK
0x1cb92b8 (s1u0): task is working


test.c

#include"sys/types.h"
#include"vxWorks.h"
#include"taskLib.h"
#include"stdio.h"
#include"stdlib.h"
#include"string.h"
#include"db.h"
#include"pthread.h"





#define DATABASE "host:F:/demo.db"
/*#define DATABASE "demo.db"*/

/*void print()
{
printf("hello kkkkk\n");
}*/


STATUS print_error(int ret)
{
if(ret!=0)
{
printf("ERROR:%s\n",db_strerror(ret));
}
}

STATUS db_function()
{
DB *dbp;
DBT key;
DBT data;
int ret;
FILE *fp;




memset(&key,0,sizeof(key));
memset(&data,0,sizeof(data));

key.data="sport";
key.size=strlen("sport")+1;
data.data="football";
data.size=strlen("football")+1;


ret=db_create(&dbp,NULL,0);
print_error(ret);



/*if((fp=fopen(DATABASE,"w+"))==NULL)
{
printf("can not open file\n");
} */

dbp->set_errfile(dbp, stderr);

ret=dbp->open(dbp,NULL,DATABASE,NULL,DB_BTREE,DB_CREATE,06 64);
print_error(ret);


logMsg("00 task is working\n",0,0,0,0,0,0);

ret=dbp->put(dbp,NULL,&key,&data,DB_NOOVERWRITE);
logMsg("01 task is working\n",0,0,0,0,0,0);
print_error(ret);



ret=dbp->get(dbp,NULL,&key,&data,0);
print_error(ret);



logMsg("02 task is working\n",0,0,0,0,0,0);

ret=dbp->close(dbp,0);
print_error(ret);


printf("OK\n");
logMsg("task is working\n",0,0,0,0,0,0);
}

Where is the problem?
Would you like to tell me a simple application like this ?

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.