Hi:
I am testing to read-write access file from linux box to Windows box. I am able to make a connection. However when the program calls statement.executeQuery() call. Program throws an below exception:
java.sql.SQLException: An unknown Access database file
Here is my code:
java.sql.Connection access = getNewAccessDBConnection(server);
System.out.println("Connection made: "+access);
Statement statement = access.createStatement();
System.out.println("Statement made: "+statement);
ResultSet rs = statement.executeQuery("SELECT TYPE FROM Lab"); //I get issue in this line
Please advice.
Thanks
B
|
Just want to add in the exiting question.
First I get following exception:
"Failed to load database sites! For more information, please use SQLException.getNextException()."
So when I used SQLException.getNextException(); it says
"java.sql.SQLException: An unknown Access database file "
B
|
What's your jdbc url? If you can visit that mdb file locally, then it should be a security issue, which happened often betwen Linux client and Windows server. You can try SAMBA protocol if you failed to load shared map driver.
|
I have actually mapped windows directory URL with some linux path.
Linux path is /inet/projects/CreditCard/resources/ACCESS
The above path is basically mapped to Windows system where .mdb file is there. Morever I can go to above linux path (which eventually goes to windows) and create/delete files.
Anyhow I just tried samba protocol and here is what I am getting now:
Server: jdbc:access:smb://cps-nt21/projects/Sites/sites.mdb
Connection made: hxtt:access/SMB://CPS-NT21/PROJECTS/SITES/SITES.MDB
Statement made: com.hxtt.sql.ah@4139eeda
java.sql.SQLException: jcifs.smb.SmbAuthException: Logon failure: account currently disabled.
Failed to load database sitesggg! For more information, please use SQLException.getNextException().
|
>jdbc:access:smb://cps-nt21/projects/Sites/sites.mdb
>java.sql.SQLException: jcifs.smb.SmbAuthException: Logon failure:
>account currently disabled.
You haven't right. Try jdbc:access:smb://auser:apasswd@cps-nt21/projects/Sites/sites.mdb .
>Linux path is /inet/projects/CreditCard/resources/ACCESS
>The above path is basically mapped to Windows system where .mdb file is there.
>Morever I can go to above linux path (which eventually goes to windows) and
>create/delete files.
Please check your jdbc url since path is case sensitive on Linux, but not on Windows.
|
Resolved it.
There were two issues:
1. As you said Linux is case senstive and once HXTT creates the connection object; it automatically change path to upper case. So it was not able to find the file.
2. I had to convert MDB file to latest version and then it worked.
Thanks for all help
B
|
>>Connection made: hxtt:access/SMB://CPS-NT21/PROJECTS/SITES/SITES.MDB
>1. As you said Linux is case senstive and once HXTT creates the connection
> object; it automatically change path to upper case. So it was not able to
> find the file.
What's your jdbc url? It seems that you're using upper case. HXTT should not conver your path.
>2. I had to convert MDB file to latest version and then it worked.
But HXTT Access supports MS Access 95 ~2007.
|