• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 850
  • Last Modified:

Lotus Notes showing errors while opening documents in NSF(nsf file) Database.

hi all..
i m developing an application using vc++ ,it creates and saves documents in nsf file.
Appilication is working well but in output (nsf file) some documents (mails etc) showing error when open these documents.The errors are listed below.
1.NSD is running
2.Table is malfound
3.insufficient memory
4.some part of document is using another version of notes
and etc...
i have tried many solution like compacting database,reinstalling notes,restarting windows etc..but not working for me.

please help.
thanks in advance.
  • 9
  • 9
1 Solution
Sjef BosmanGroupware ConsultantCommented:
> Application is working well...
Apparently not.

These error do not normally occur in any standard Notes client with any standard Notes database. I'd say that the probability is more than 99% that your application screws up the database. If you have a very large application, with a lot of code, I'm afraid is would be nearly impossible for us to help you in finding the problem.

What I'd suggest is to start with a new database, build a test application that uses the document creation functions of your current code, run that test application 1000 times, and find out if the code works under all circumstances.

Most likely you add items or other building blocks of a Notes document the wrong way, with the wrong parameters or so, anyway something that Notes expect in a different way. Notes is not fool-proof when working with the C-API, it expects you to behave correctly.
davinder101Author Commented:
Application is working well because only some documents(1 out of 100-500) are causing problem.and i m giving correct aruments to functions i used and working well for all other documents.and when when i m createing and saving these document (through Application) no error occured at that time.
Sjef BosmanGroupware ConsultantCommented:
What are you trying to suggest? That Notes is wrong? In many cases you might be right, but the odds are not on your side. If you treat Notes nicely it won't fail. Occasionally, due to system crashes or so, a database may get corrupt. In that case you can repair it using the Fixup utility. But plain crashes as you describe them are generally caused by incorrect application code.

The question you asked is too general to be answered. Either you start extensive tests as I suggested or you show all the code you have. I can't guarantee that you get a satisfactory answer, for there aren't many here with a lot of Notes-API-experience.

Which version of Notes and what APIs are you using?
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

As above, need some more testing and also monitoring other parts of the machine. Could be that it only happens under high loads suggesting a timeout situation or only with specific document types etc.

What client version are you running and have you tried any other version ?
davinder101Author Commented:
I have  tyied Lotus Notes 6,7,8. but the results are same and i m using api_4_6.0.
and i m using API to Append Items in database and Update Items and at last saving the note.
Sjef BosmanGroupware ConsultantCommented:
davinder101Author Commented:
API is Lotus C++ API Toolkit for Notes/Domino 3.0i Multiplatform.
Sjef BosmanGroupware ConsultantCommented:
Seems recent enough.

Now how can we help you? You gave us very little to work on, so you can't expect miracles to happen.

Am I correct that you are the same person who miwed C-API and C++-API calls? 10 to 1 your problem is there, the C-API is much more difficult in its use than the C++-API. Forget about errors in Notes or in the API, the probability is very high that it is your application. It might seem to work correctly, but it could be overwriting/destroying memory while running.
davinder101Author Commented:
yes you are right i am same person,and i have no problem when i m appending(writing) data to nsf file.
now what i want is to correct the error when i m appending and saving these documents,i usually do this when any error occured.
but these are documents that have no errors at that time and create problems when open the documents in nsf file.
how can i resolve these errors?
Sjef BosmanGroupware ConsultantCommented:
Look at it like this: I myself have no problem over here with driving on the wrong side of the road. Other people do.

Meaning: if you don't follow the rules and guidelines of programming in C with both the APIs, you're bound to get hurt when you use Notes to inspect the database. Notes is standard, so you have to do EXACTLY what Notes expects in the database.

If you create only one document in the database, and then open the database and that document, does Notes complain/crash?

What code do you use to create the document? And to create fields? Do you use the memory allocation functions that are required?
davinder101Author Commented:
The Code to create fields and documents is as follows


//Some Steps to create a DataBase

hdb      =      Db.GetDatabaseHandle(TRUE);// Get Handle Of DataBase

//Now Creating a Note using C Api.
NSFNoteCreate (hdb, &hMemo)

//Now Append Some Items in note

//Now add the note in database
NSFNoteUpdateExtended(hMemo, 0 );



Actually i have data in canonical format, i m giving data to NSfItemAppend() and updating note using NSFUpate()
and saving the note.and calling this module repeatedly.

i am using API functions only to write canonical data that i have in a nsf file.
i think API functions are not reliable. am i right?
Sjef BosmanGroupware ConsultantCommented:
Do you use NSFNoteClose?
Do you check the return values of your function calls, to see if there are errors?

Why don't you use only the C++ API ?? Why is that necessary, in your view?
See also

> i think API functions are not reliable. am i right?
IMHO, you are not right at all. There are many, many applications written in C using the APIs. Those developers may have had some problems too, but their applications all seem to run without problems.

The user's guide contains a simple example how to create a document:
davinder101Author Commented:
i m using c++ API calls in my program,i m using only NSFItemAppend() of c API,because in c++ API trere is no function that can add fields multiple time in same note.like "Body" i can Append data in many segments for body more than 65K.
but in c++ i can't.
CreateItem() function is not able to append body multiple times as far as i use it.
it gives error "item already exist."
except this nowhere i m using c API in my application.

>Do you check the return values of your function calls, to see if there are errors?
yes i m checking every time when  i use API calls.
Sjef BosmanGroupware ConsultantCommented:
If I understand the documentation correctly, it should be possible to suppress the error you'd normally get when you create a duplicate item, for non-rich-text items. See

For rich-text items, I suppose you have to use the C++ LNRichText class. What I *assume* is that that class takes care of item duplication itself. I have no proof, but a simple test should be enough.
davinder101Author Commented:
hi........ i trie LNRichText class but it is not very useful to me because it neeed data in seperately in segments.while i have a data bunch "Body" and adding it to database.
now i have no problem in adding fields(data) through API but having problems i already told u "errors" in created database.

is there any method to repair database or comact database to get rid of these kind of errors?
Sjef BosmanGroupware ConsultantCommented:
In Notes, yes, you can compact a database, and there is Fixup. Both tools can, AFAIK, also be used from the command line. The easiest way however is to execute these actions from the Domino Admin client.

Why are you so persistent to do things your way? It is a good quality for developers, you'll learn a lot that way, but sometimes it might be better for progress to just follow the rules. There are times when, if you want to turn left, you have to turn right 3 times...
davinder101Author Commented:
Thanks for your support.
i will back to you if i will have problem.
i have solved some problems.

davinder101Author Commented:
Answer was easy to implement.
and i manage to get rid of problem.
Sjef BosmanGroupware ConsultantCommented:
Ah, at last. Well done!

Could you tell me some more about how you dealt with the problem in the end? Thanks!

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 9
  • 9
Tackle projects and never again get stuck behind a technical roadblock.
Join Now