LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

berkeley database

Hi, It's me again Smiley Indifferent

As the title say, I'm trying to link the "berkeley database" library, to LabView, through the "Call Library Function Node". The functions are recognized well by LabView, but some functions in the library doesn't work as is expected :s.. so my question is, if someone have some similar, of if you know that what i'm trying to do is possible ?

http://www.sleepycat.com/ -> that's the page of the library of berkely database Robot Indifferent
0 Kudos
Message 1 of 8
(3,447 Views)
I'v only used it indirectly when it was used in other Open Source software (SubVersion) that I'm currently linking to LabVIEW. As such it is hard to give you more detailed information about if and how calling it directly through the CLN whould work. Maybe you can elaborate on some of the problems you are seeing so we can take a more detailed look.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 8
(3,438 Views)
Well first of all thanks for answer, what i'm doing exactly is make a library (.so) where I call to functions of berkeley database, they are basic functions, in the library I'm doing I have this functions:

/*This function calls all berkeley library functions and others declared in this file, returns error msgs*/
char *database_test(char *char_data)
{
    int result;
    char *filename = "prueba.db";
    DB* database_ptr = NULL;

    /* This function open de data base, and here is where the things get some wrong, because, it should create the database if doesn't exist and return a succesful value, but it returns a successful value although doesn't create the database, and if this exist still return successful (which in this case it's ok)*/
    result = open_database(&database_ptr, filename);
    if(result != 0)
        strcpy(char_data, db_strerror(result));

    /* Leaving that problem of above, this cause another problem because don't get any data stored in the database*/
    char_data = get_all_records(database_ptr, char_data);
    result = database_ptr->close(database_ptr, 0);
    if(result != 0)
       strcpy(char_data, db_strerror(result));

    return char_data;
}

Well I don't want you to think I want you make my program :s, so that's why I don't put here the content of the other functions, but just I want to say that I've compiled the same code of above as "stand alond" program in C as usually and it works fine, but by compiling as library and linking to LV don't work as it's expected ....

Thanks in advanced

0 Kudos
Message 3 of 8
(3,433 Views)
Do you think is about pointers again Smiley Indifferent ?
0 Kudos
Message 4 of 8
(3,425 Views)


@nmxnmx wrote:
Well first of all thanks for answer, what i'm doing exactly is make a library (.so) where I call to functions of berkeley database, they are basic functions, in the library I'm doing I have this functions:

/*This function calls all berkeley library functions and others declared in this file, returns error msgs*/
char *database_test(char *char_data)
{
    int result;
    char *filename = "prueba.db";
    DB* database_ptr = NULL;

    /* This function open de data base, and here is where the things get some wrong, because, it should create the database if doesn't exist and return a succesful value, but it returns a successful value although doesn't create the database, and if this exist still return successful (which in this case it's ok)*/
    result = open_database(&database_ptr, filename);
    if(result != 0)
        strcpy(char_data, db_strerror(result));

    /* Leaving that problem of above, this cause another problem because don't get any data stored in the database*/
    char_data = get_all_records(database_ptr, char_data);
    result = database_ptr->close(database_ptr, 0);
    if(result != 0)
       strcpy(char_data, db_strerror(result));

    return char_data;
}

Well I don't want you to think I want you make my program :s, so that's why I don't put here the content of the other functions, but just I want to say that I've compiled the same code of above as "stand alond" program in C as usually and it works fine, but by compiling as library and linking to LV don't work as it's expected ....

Thanks in advanced



You only specify a relative database name. So it is up to the current directory setting for the current process (LabVIEW here) where the file will be generated. I'm not sure about Linux but on Windows numerous system calls can change the current directory and I'm pretty sure LabVIEW does call such functions on Linux to achieve a similar behaviour there.

So I would think that the file actually does get created (or maybe not since you have no write or execute access to that directory) but you are looking for it in the wrong place. I would definitely try to pass a full name to the function and of course preferably to a directory you have write and execute rights too 😉

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 5 of 8
(3,424 Views)
Well really thanks so much. You were right, so I'm really very angry with myself, I'm an idiot, how couldn't I realize that...

Smiley Happy Thanks you ..
0 Kudos
Message 6 of 8
(3,411 Views)

Does National Instruments have any plans to directly support Berkeley database?  Or any other databases?

Thanks,

Chris

Chris Reyerson
Optical Systems Engineer
Arete Associates
Tucson, AZ
0 Kudos
Message 7 of 8
(3,361 Views)


@Chris Reyerson wrote:

Does National Instruments have any plans to directly support Berkeley database?  Or any other databases?


NI is not really in the business of databases so they won't develop their own ;-). And with the Database Connectivity Toolkit they have a good offer to connect to any database that has ODBC and/or ADO connectivity (for Windows clients that is).

Other than that I doubt they will ever integrate something like a generic database in LabVIEW itself. The reasons are myriad. Support issues, whatever database they choose it would not fit at least 70% of the needs of most users as it would be either to complex, to simple, or to limited, maintenance: since code you integrate needs to be maintened and there are both commercial products and Open Source projects that specifically target a certain type of database and always will be more dedicated and commited to the database aspect of their product than NI ever could be.


So why wait for NI to do something they most likely never will do and not integrate your favorite Open Source database yourself?

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 8 of 8
(3,354 Views)