32 Bit .UDL in 64 Bit Machine
I have an application written in VB 6.0 that uses a UDL file to reference my ODBC DSN. This application works fine in any 32 bit system.
When I move this application to 64 Bit machine I got this error:
Microsoft Error = -2147467259 ([Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified)
The point where this error triggers off is at this point
Dim MyConnection
Set MyConnection = New ADODB.Connection
With MyConnection
=== .ConnectionString = "File Name=" & app.path & "\" & QBConn & ".UDL;"
.Open
End With
I created my DSN on the 32 bit ODBC in my 64bit machine (C:\WINDOWS\SYSWOW64\odbc32.exe) but my program points to the 64 Bit () but but the request DSN is not located there.
How do I change this line?
.ConnectionString = "File Name=" & app.path & "\" & QBConn & ".UDL;"
To be able to read my DSN using the ODBC from this location:
C:\WINDOWS\SYSWOW64\odbc32.exe
Thanks
Victor
Re: 32 Bit .UDL in 64 Bit Machine
Just hard-code the path or you might be able to save the path in a file and read it into your program.
Re: 32 Bit .UDL in 64 Bit Machine
Both system and file DSNs (just like ODBC) are ancient technology and security hazards.
However if you insist on this and have trouble with your UDL (which is really for OLEDB) check your UDL's contents. I suspect that it isn't pointing to your 32-bit system DSN, probably because it was edited using the 64-bit oledb32.dll!
See: How to run 32-bit UDL file on a 64-bit Operating System