On 12/16/2011 8:54 AM, André Warnier wrote:
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 the
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).

I do all the db connection handling explicitly in my code, rather than letting TC handle it, so that's not an issue. *If* the capability exists to do it in java, I can easily execute it before making the db connection.



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.

Thanks for the suggestions. Another hack I'm considering is copying the dbf to a local drive, or even inside my context path, and accessing it from there. I've got lots of playing to do...

D

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to