Unable to connect from Unix box to Access database on Windows server - java

I saw answer mentioned by Gord in
Unable to connect to a database on a shared drive - UCanAccess.
I am able to access my db from Windows to Windows Server where my Access Database file resides.
But when I deploy the same code on Unix, I am not able to access my database. I am using the same URL as proposed by Gord.
My URL is:
datasource.crr.url=jdbc:ucanaccess://////abc.dch.com\\der\\Share\\SongUnflaggedTest\\Songs\ Unflagged.accdb;Skipindexes=true;memory=true.

Unlike Windows, most Linux/Unix environments are unable to directly access a file in a shared folder by simply using its UNC path, e.g.,
\\server\share\folder\file.ext
Instead, we normally have to tell the Linux/Unix box to mount the share at a point on the local filesystem (sort of like assigning a drive letter in Windows), and then use that as the starting point.
For example, if we mount the share
\\server\share
to a mount point on the local filesystem named
/mnt/servershare
then we can access the file using the path
/mnt/servershare/folder/file.ext
See this Ask Ubuntu question for an example.

Related

Java program is unable to write on mounted system in linux

I am currently working a scenario where we have to create a file in a shared directory in Linux as well as Windows.
I have gone through the following link to achieve it :
https://www.journaldev.com/878/java-write-to-file
https://it.toolbox.com/question/how-to-write-a-file-in-a-network-folder-without-using-ftp-031208
I was able to achieve it in windows network like giving the file name as (\\198.168.1.1\data\files)
But for the Linux first I used NFS to share a particular directory using below links :
https://alvinsim.wordpress.com/2012/06/21/mounting-nfs-from-linux-to-aix/
https://www.tecmint.com/how-to-setup-nfs-server-in-linux/
But got the following exception :
java.io.FileNotFoundException: /data/files (Read-only file system)
I found the following issue resolved in following thread, but I could not succeed :
https://askubuntu.com/questions/197459/how-to-fix-sudo-unable-to-open-read-only-file-system
Any advice is appreciated.
So finally I was able to figure what the problem was.
The entry which I made as per link in /etc/exports file is not sufficient.
We would need to use some options as well like (sync,rw,etc..) for allowing any manual modifications or modifications using any java program.
In my case, I should have used the options (rw,no_root_squash).
And it worked.
As very well explained in :
https://serverfault.com/questions/611007/unable-to-write-to-mount-point-nfs-server-getting-permission-denied/611013#611013?newreg=ce76e9417ca645da9487a5d9ccbf0371
From Docs on :
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/deployment_guide/s1-nfs-server-config-exports
root_squash — Prevents root users connected remotely from having root privileges and assigns them the user ID for the user nfsnobody. This effectively "squashes" the power of the remote root user to the lowest local user, preventing unauthorized alteration of files on the remote server. Alternatively, the no_root_squash option turns off root squashing. To squash every remote user, including root, use the all_squash option.

Impact to the web application when converting a local directory on to a NAS

We have a web application running at this point on Linux and weblogic setup.
There is one local directory /home/doc which stores the files used in our application.
At present, we make a call to this location via
Wls: virtual url mapping and wls:localPath in the weblogic configuration file.
My query is if this directory is pointing to NAS instead of local will this still work?
Also we access this path via our App url like this: https:///root/home/doc
This url is unprotected from the security authentication.
Will there be any impact to this? Can someone please suggest?
Yes it does not matter if the directory is on block storage or NFS/NAS so long as weblogic can read the files it will work just fine.

Connect to a shared drive in java

I need to connect to a windows shared drive so I can make a directory and then some files in that directory. I am not sure how I would go about this. Can you use any built in classes for java?
If you map the drive onto your machine you should be able to access the drive with the normal filepath "(Drive Letter):/"
Depending on your network configuration you might also be able to use the filepath "\(Server name)\"

Installing Java Desktop Application on Windows 7 O.S

I have a java desktop application connected to a derby database
the derby database has some dummy data for trial purposes.
The application is packaged together with the database(as embedded derby database).
When the application is installed on the desktop of my Windows 7 OS , I am able to
access the dummy data as expected. However, when the application is installed in the program file folder, I am not able to access the database as well as the data in the database.
Is there any explanation for this?
The "Program Files" folder is not writeable for a standard user (and for a good reason). Do not store any userdata there.
You need to put the database files into a different folder. This is what e.g. %APPDATA% is intended to be in Windows.
You can obtain the value of the %APPDATA% environment variable using the System.getenv() method.
From within Java you can also put it into a sub-directory the user.home directory using System.getProperty("user.home")

Accessing Windows directory from java application running on linux websphere

I am working on an application that generates excel reports from a report generated by Mainframe.
Input report location and ouput location for generated reports are on company common drive that is mapped on my local windows box.
Things were wokring fine from my eclipse since my account have access to those locations on common drive. I am using JAVA File io to access common drive.
But when I deployed on webpshere, it wasn't able to access common drive and I think it could be websphere is using different account to access common drive and that account doesn't have permissions.
My question is how to force Java File io to use particular account.
And also when I deploy application on linux websphere, will this work assuming, common drive will also be mapped on linux boxes.
The proper account must be specified at the time of mounting the network location. (This can be done in both Windows (net use command) and Linux (mount command).)
Then, access mounted network location from your Java application.

Categories