on 2013 Feb 22 4:50 PM
I have an .MDB file that opens in MSAccess that I would like to import into SA 12.
I created a 32 bit ODBC system DSN "Testing" that points to the file using the Microsoft Access Driver (.mdb,.acdb).
I opened the 32 bit Sybase Central and try to connect to it using ODBC and I get an error
Could not connect to the database Cannot open database '(unknown)'. [Microsoft][ODBC Microsoft Access Driver] Cannot open database '(unknown)'. It may not be a database that your application recognizes, or the file may be corrupt. SQLCODE=-1206 SQLSTATE=HY000 Connection parameters: User= Password=*** DSN=Testing ENC=NONE
So I think maybe I was greedy trying to connect directly. Instead, I'll open up a blank database and use the remote server feature to query and import the data.
I used the Create Remote Server Wizard and picked TestSRV as the name, Microsoft Access as the driver and ODBC as the connection type. Then it asks me about the connection information. This is where I get fuzzy. I tried the DSN name and that didn't work, I tried DSN=Testing and that didn't work. I googled MSAccess connection string and came up with this: Driver={Microsoft Access Driver (.mdb, .accdb)};DSN=Testing;
But that complains about Variable 'Microsoft Access Driver (.mdb, .accdb)' not found.
I figure there is something I'm missing in the connection string but I am having trouble finding good examples or syntax of connection strings because it seems to depend on the situation and the direction (into SA or from SA to something else) what syntax to use.
Any and all help would be appreciated.
Request clarification before answering.
I have successfully tried to create an Access MDB (with MSACCESS 2003) within one table T_Test and created a SQL Anywhere 12.0.1 database with a remote server connection to the Access MDB. There were no problems doing that.
Here, using the DSN name for the remote server definition does work as expected.
Steps I've used after creating both the Access MDB (located as C:\\ACC_TEST.MDB) and the SA database):
CREATE SERVER "SVR_ACC" CLASS 'MSACCESSODBC' USING 'ACC_Test';
CREATE EXISTING TABLE "DBA"."FT_Test" AT 'SVR_ACC;C:\\acc_test;;T_Test';
That straightforward way, I can now simply access the Access table's contents in the SA database:
Basically it seems that although the ODBC DSN contains the MS Database file location, it's still required that this location is explicitly contained in the proxy table definition (however, in my case, that information was added automatically by the Proxy Table Wizard) - I've just copied the Wizard-generated statements here.
Note: The MSACCESS mdb I'm using does use the default security concept (i.e. no explicit "users" and "permission" and the like), so there is no need to specify particular credentials for the remote server.
Another note: As Siger, I'm using both a 32-bit SQL Anywhere engine and 32-bit ODBC DSNs. When using a 64-bit engine, one would need to assure the MSACCESS DSN is a 64-bit one, too, as the remote server facility requires an ODBC driver with the appropriate bitness.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, the requirement that the database engine and the ODBC driver used for Remote Data Access need to have the same bitness is documented in this Karim answer - just to note that this is different for other "external calls" (aka remote procedures).
User | Count |
---|---|
61 | |
8 | |
7 | |
6 | |
6 | |
4 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.