tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: Access dbf files outside context/docbase
Date Fri, 16 Dec 2011 13:54:46 GMT
David kerber wrote:
> On 12/16/2011 6:03 AM, André Warnier wrote:
>> André Warnier wrote:
>>> David Kerber wrote:
>>>> On 12/15/2011 4:47 PM, Pid wrote:
>>>>> On 15/12/2011 20:56, David kerber wrote:
>>>>>> I am trying to figure out how to access .dbf files that are on a
>>>>>> networked drive from my TC 5.5.xx server. I have no trouble with
>>>>>> coding; it all works fine from my Eclipse dev environment. I believe
>>>>>> the issue is tomcat's contexts on the production server. I've seen
>>>>>> plenty of suggestions for just reading and streaming files from
>>>>>> outside
>>>>>> the docbase, but nothing for accessing them for database purposes.

>>>>>> I'm
>>>>>> using the Microsoft DBF driver.
> ...
>>> Are you sure that the driver understands UNC path notation ?
>>> What if you "map" that path to a "device letter" on the local system,
>>> and try to connect using that local path ?
>> Addendum : but if your are indeed running Tomcat as a Service, then the
>> previous explanation from Mark Eggers is more likely to be the problem.
>> (and my suggestion won't help, because it's still a network drive, and
>> the LocalSystem account does not have access to Windows network
>> resources (like network drives and printers e.g.)).
> I already knew that, and should have mentioned it in my original post 
> (sorry for the lack of details).  I'm running TC as a service on Windows 
> server 2008, as a user that does have permissions for the network and 
> the drive where the db is located, not as Local system.
>> You should try starting Tomcat under your own user-id, in a command
>> window, using the startup.bat script, and then see if it can connect.
>> If it can then, then your problem is the LocalSystem account.
>> If it still can't, then it may be the UNC path notation.
> Hmm, good idea; I hadn't thought that it just may not like UNC notation. 
>  I hope that's not the problem, because if I have to have a drive 
> letter, then I think I'll have to have the user actually logged onto the 
> server.
Not necessarily. I have software (in perl, not in Java) which runs as a Windows Service 
and needs to access network directories. In that software, I execute the O.S. command
net use \\server\\share {[password] /USER:\domain\userid}
In perl, that's "$status = system($command)".
In Java, I don't know (and I don't know how you would persuade Tomcat to do that before 
opening your db connection either).

What I have noticed sometimes, is that the "net use" is succesful (as per its exit code),

but then the first access to that "drive" doesn't succeed, but the second and after do.
So I also do a dummy "dir" or something, ignoring the result, right after the "net use".
I know it's a terrible hack, and I'm just mentioning it here in case that would hit you 
too, so that you may know to not necessarily give up if it doesn't work right away.

There may be more elegant ways to do this under Java, such as Samba's jcifs library.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message