I've got a BDB where all the keys & values are just ascii. I am able to read and write the BDB directly using the C++ interface provided by Oracle. I am using this .NET interface to also read and write from a C# application. I am successfully able to write things to the BDB that I can then read from C++ as expected. But I can't seem to get reading to work in the C# / .NET layer. Basically, here is what my code looks like, but it is returning Not Found for keys that I know are there.
AT a first glance I don't see an error.
Are you reading data written through the C++ API?
Maybe you check if the keys written through C++ contain the null terminator?
If that is not the case, can you post a complete piece of code (writing + reading) where you can duplicate the problem?
Karl
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hmm...poking around a bit more...I have no trouble reading in C# entries that were written in C#, and I am able to read entries that were written by a previous process that is already complete. I think that the problem is that I need to look into environments, so processes running at the same time can work together better. Sorry for the not-quite-right question. I'm off to read up on environments now...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've got a BDB where all the keys & values are just ascii. I am able to read and write the BDB directly using the C++ interface provided by Oracle. I am using this .NET interface to also read and write from a C# application. I am successfully able to write things to the BDB that I can then read from C++ as expected. But I can't seem to get reading to work in the C# / .NET layer. Basically, here is what my code looks like, but it is returning Not Found for keys that I know are there.
string keyStr = "Report";
byte[] keyBytes = System.Text.Encoding.ASCII.GetBytes(keyStr.ToCharArray());
DbEntry key = DbEntry.InOut(keyBytes);
DbEntry data = DbEntry.Out(new byte[2048]);
BerkeleyDb.ReadStatus result = _analysisBDBBtree.Get(null, ref key, ref data, 0);
Is there anything clearly wrong with this? I've tried a few variations on it, but had no luck.
Thanks for any pointers!
AT a first glance I don't see an error.
Are you reading data written through the C++ API?
Maybe you check if the keys written through C++ contain the null terminator?
If that is not the case, can you post a complete piece of code (writing + reading) where you can duplicate the problem?
Karl
Hmm...poking around a bit more...I have no trouble reading in C# entries that were written in C#, and I am able to read entries that were written by a previous process that is already complete. I think that the problem is that I need to look into environments, so processes running at the same time can work together better. Sorry for the not-quite-right question. I'm off to read up on environments now...
Just to follow up, environments was in fact the problem. Once I got those set up and working, the above code worked fine.
Glad you got it working.