1

The JDBC Connections section of the help file http://reference.wolfram.com/mathematica/DatabaseLink/tutorial/DatabaseConnections.html gives me the impression that I can connect to a MS Access Database (*.accdb) using the following statements:

<< DatabaseLink`;
conn = OpenSQLConnection[JDBC["odbc", "MTData.accdb"]];

where MTData.accdb is the name of my database. I have verified that the file does exist using FileNames[]. Upon executing the statements above, however, I receive the following error message:

JDBC::error: "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified ...".

Typing JDBCDriverNames[] gives a list with "Microsoft Access(ODBC)"

Would somebody please be able to clarify whether I should be able to access a MS Access database using these statements? Thanks.

EDIT:

I have also tried accessing the database by providing a DSN (Data Source Name), created by opening the ODBC Source Administrator (as I have a 64-bit operating system, but 32-bit Office, I used the program at location C:\Windows\SysWOW64\odbcad32.exe). Executing the following code, where "MTDB" is the DSN: conn = OpenSQLConnection[JDBC["odbc", "MTDB"]];, I get the following error message:

JDBC::error: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application

MLD
  • 619
  • 4
  • 14
  • If it's just a matter of forcing the use of a 32-bit JVM, you can launch one as follows. You probably already have a 32-bit Java installed at the following location, and if not, you can install one from java.com. Needs["JLink`"]; ReinstallJava[CommandLine->"C:\\Program Files (x86)\\Java\\jre7\\bin\\javaw"]. – Todd Gayley Jul 30 '13 at 14:39
  • @ToddGayley Thank-you! This works - I am able to access the database using the data source name (created using C:/Windows/SysWOW64/odbcad32.exe) and using conn = OpenSQLConnection[JDBC["odbc", "mydatasourcename"]]; Note however that I could not connect using a named connection. Given that this question is marked a duplicate, perhaps it is worthwhile putting your answer in the other question. – MLD Jul 31 '13 at 01:17
  • I have added the above remark into that older question. – Todd Gayley Jul 31 '13 at 15:54

0 Answers0