Subject Re: [IBO] "Cannot open file" error
Author Joe Martinez
>In the first place, the logic of this is flawed. What happens if a remote
>client user omits the Server entry? The app will try to find a local
>server, and deliver the error you have observed.

Well, that's what I'd expect. I tell my clients to leave the Server entry
blank for a local connection, and fill it in for a remote
connection. Wouldn't my logic be correct for that? If the remote client
omits the Server entry, I would EXPECT it to look for a local server, and
return an error message if the server (or database file) doesn't exist.

>In the second place, don't mess around with paths in your handlers, e.g.
>converting the Server property to empty string. Provided you put in the
>correct protocol entry, IBO will parse a correct Database path and protocol
>for you. Unlike your code, it won't blow away the ability of the app to
>connect if you end up with a credibility gap between the human client and
>the software client. You can then put in error handling that safely
>assumes the user entered garbage if a connection error is thrown.

I'm not sure what you're telling me to do. IBO will parse a correct
Database path and protocol from what? Shouldn't I set the Server and Path
based on the user's input?

>Tip: hard-wire TCP/IP and give 'localhost' for the Server in the case
>where you are sure that the client and the server are on the same
>box. cpLocal is very flukey and it's certainly not thread-safe.

Ok. That sounds good. I've never had any problems with it before, though.

>Also, it's a good rule to call methods for database operations, not set
>properties. So call MyDB->Connect and provide error-handling for it. Same
>goes for queries: call Open (for scrollables), First (for unbuffered
>cursors) or Execute (for DML queries), don't do it by setting the Active


>Next, I'm willing (this time) to look at the text copy of your DFM, if just
>to eliminate any other application-level possibilities.

Here it is:

object MyDB: TIBODatabase
AliasName = 'Main'
LoginPrompt = True
DatabaseName = 'SMRDBS_MAN'
Left = 96
Top = 384