How to create User DSN for *.accdb from commandline in Windows?

brainless picture brainless · Oct 5, 2012 · Viewed 7.5k times · Source

I work in an environment where DSN-Less connection is not possible due to some restrictions. I need to create User DSN for "Microsoft Access Driver (*.mdb,*.accdb)". the .accdb file is located in local disk.

I have tried C:\>odbcconf configdsn "Microsoft Access Driver (*. mdb,*.accdb)" "DSN=crt1|SERVER=c:\a.accdb". But this doesn't seem to work.

How to do it?

Answer

bohica picture bohica · Oct 5, 2012
odbcconf configdsn "SQL Server" "DSN=fred|Database=dave"

works for me. I don't have a 64 bit MS Access driver on this 64 bit machine to try. You don't show the error. Why not add /Lv x.log and see what is in the log file.

However, is this a 64 bit machine? If it is I doubt you've got a 64 bit MS Access driver installed and odbcconf will be attempting to add a 64 bit DSN. If it works with c:\windows\syswow64\odbcconf then that will likely be your answer.

c\windows\syswow64\odbcconf configdsn "Microsoft Access Driver (*.mdb)" "DSN=fred;Database=dave"

works for me to create a 32 bit DSN.