Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delphi app on Citrix server :Directory is controlled by other.NET file 3

Status
Not open for further replies.

StevenK

Programmer
Jan 5, 2001
1,294
GB
I'm starting another thread as I now have a clearer picture of the problem I've been having :

I've developed a couple of delphi 5 applications against SQL Server and paradox.
My client has now installed these applications onto a Citrix server - one of which works without a problem.
The other gives an error when started up.
The error being :
"Directory is controlled by other .NET file.
Directory: C: File: \\SERVER1\FOLDER1\APP1\TEMPBDE\PDOXUSRS.LCK"
The 'TempBDE' being a folder I force the creation of at start up and set this to be the 'Session.PrivateDir' path for the application.

Can anyone enlighten me as to how this can be worked around ?
I am not familiar with Citrix and currently do not have access to such a set-up so I'm kind of working blind here.

Would the root of the problem be the set up of the BDE on the client machine or on the server itself ?
Which one of these comes into play in regards to the setting of the 'NetDir' in the BDE Administrator setup ?
Similarly do I need to consider the 'LocalShare' property on server / client ?

Any help would be greatly appreciated.
Thanks in advance.
Steve
[steven.keclik@s3t.co.uk]
 
Steve,

Unlike Paradox for Windows, Delphi lets you modify the net file location at Runtime. Remember, all users need to share the same NET FILE location.

What I suspect is happening is that the application is assuming the NET File is supposed to be on the local user's workstation; it probably needs to be somewhere on the server itself.

LocalShare only comes into play when a user is sharing files on their machine. I would set LocalShare TRUE on the server, but unless you're sharing files on the individual workstations as well, I don't think that will gain much.

Hope this helps...

-- Lance
 
So, is this message being caused by a problem on the BDE settings on the client machine side or on the citrix server side ?
Which should I look at to solve this problem ?
Thanks again.
Steve
 
The problem is most probably happening on the citrix server side from your description. Citrix is just another flavor of a "terminal server". The only program users are running localluy is the citrix-terminal software. The terminal software is like a super robust version of PC-anywhere. Your software running on the citrix server maybe in use simultaneously by multiple sessions. If your app assumes any particular drive mappings, you must make sure all users logging onto citrix server get the same drive mapping setup during their login sequence. Also during login, a Citrix user can be assigned a "user" directory on the citrix server unique from other users who maybe using the citrix server. This is a good place to store temporary user specific files.
When I ported an app to a Citrix server, I ended up putting a lot more error checking code in around file operations. When my app was a local app, reading and writing config files there never was a problem. When my app was a shared app, occaisionally there would be simultanaiety conflicts.
Good Luck
 
hi Steven

Why not try what I suggested before about the unique dirs and see if it helps. It'll only take a few lines of code and may fix the problem. Here's my code if it helps - It could probably do with a clean up, was written very quick for the bug fix:

//Create the dir and store in globals

function CreateReportDir(ShortDirName : string) : string;
var res : boolean;
begin
res := false;
result := '';
if DirectoryExists('c:\Asummit\'+ShortDirName) then
Remove_dir('c:\Asummit\'+ShortDirName);
if not DirectoryExists('c:\Asummit\'+ShortDirName) then
res := CreateDir('c:\Asummit\'+ShortDirName);
if not res then
raise Exception.Create('Can not create C:\Asummit\'+ShortDirName);
result := 'c:\Asummit\'+ShortDirName;
end;

function CreateBDEDir(UsrName : string;uid : integer) : boolean;
var sTemp, stime : string;
Tme: TSystemTime;
begin
DateTimeToSystemTime(now, tme);
stime := intToStr(tme.wHour) + intToStr(tme.wMinute) + intToStr(tme.wSecond) + intToStr(tme.wMilliseconds)
+'_'+intToStr(tme.wDay) + intToStr(tme.wMonth);
if length(intToStr(tme.wYear)) = 4 then
begin
stime := stime+intToStr(tme.wYear)[3];
stime := stime+intToStr(tme.wYear)[4];
end
else stime := stime+intToStr(tme.wYear);
sTemp := sTime+'_'+IntToStr(UiD)+UsrName;
TRY
Globals.SessionDir := Globals.CreateReportDir(sTemp);
result := true;
EXCEPT
result := false;
MessageDlg('Unable to create the temporary BDE directory: '+Sessiondir +#13#10+
'Sharing violations may occur.',mtWarning,[mbok],0);
END;
end;

//in top level db access unit, you need
TRY
if CreateBDEDir(user.UserName, user.UserID) then
begin
session.NetFileDir := 'c:\Yourlocal';
Session.PrivateDir:= SessionDir;
end;
:


Let us know how you get on.

cheers
lou
 
Weez : Thanks for the suggestions and the code. Surely this will result in my having a multitude of created directories on the server paths ?
Will this cause upset ?
Would I need to have my client run a clean up on these directories once they have served their purpose ?
Excuse all the questions - my concerns are due to the fact that I have not dealt with a citrix server set-up before so I'm treading (very) carefully.
Thanks again
Steve
 
hi

You need a RemoveDir procedure which is run when the user logs out.

The only time a dir is left stranded is if the app or citrix link crashes.

I use to check once a week for stray dirs. You could enhance your RemoveDir, so it removes all dirs with the users name in it.

lou

p.s. ... assuming doing this dir thing will actually get rid of your problem. I think you will have to do a dummy run with it and see, I afraid.
 
Thanks for the feedback on this one - sorry I've not gotten around to praising you until now.
Have been told that my application(s) now work without hitch on the citrix server following the setting up of personal (date/time) stamped 'PrivateDir's.
Thanks again.
Steve
 
hi Steven

Out of interest, what version of Citrix are you using? I originally used v1.8 but I think it's come on a bit since then.

At my current company they want to put my apps on Citrix and I was wondering whether I need to do the same again - you may have answered the question for me with this post.

lou
 
My client (in question) is using Citrix Metaframe Xpe on a Windows 2000 Server.
It's not something that I have access to, hence me asking lots of questions - as I was in the dark (and applying some degree of guess work).
Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top