Migrating VB6 code to use 64-bit ODBC DSN - vb6

I have a legacy VB6 application, which is making ODBC connections to a proprietory 3rd party database using ODBC.
Dim con As Object ' New ADODB.Connection
Set con = CreateObject("ADODB.Connection")
con.Open ("DB64bitDSN")
It used to work until now. Recently they have installed 64 bit version of the 3rd party database. The 3rd party database automatically creates a 64 bit ODBC DSN during installation, and the same is working when I connect using Excel's Data Connection Wizard, and using ODBC DSN as the data source.
But my code is giving error:
Error Description: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
Error Source: Microsoft OLE DB Provider for ODBC Drivers
How should I change my code to make it work? Do I need to add a reference to any library and modify my code?
Thanks.

You do not need to change the code. You need to ask "them" to create a 32-bit ODBC DSN. VB6 requires this in order to connect.
There is more information on this Microsoft page.
Extract from the page
To manage a data source that connects to a 32-bit driver under 64-bit
platform, use c:\windows\sysWOW64\odbcad32.exe.

Related

Odbc dsn-less conection string error IM002

i want to build an app in cpp, my OS win 10. I have downloaded driver from microsoft docs site.
driver Microsoft odbc for oracle
The issue is with SQLDriverConnect in connection string
If i try to use e.g. this string "driver={Microsoft ODBC for Oracle};uid=name;pwd=passwd;server=//ip:port/aaa",
Throws 2 errors 01500 and IM002. the issue is probably with server arg. so tried this string "DRIVER=Microsoft ODBC for Oracle; UID=name; PWD=passwd;DBQ=(SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ip)(PORT=port))(CONNECT_DATA=(SID=aaa))));",
First error fixed but there is still second one IM002. From this [microsoft docs][1] i know that error is with Data source name. I do not want to setup DSN in windows, just want app to be portable without setting dsn
What i am doing wrong, i am beginner in the company and never worked with oracle
Thank you
Note: IP is intranet company DB for customers (because of security)
[1]: https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqldriverconnect-function?view=sql-server-ver15

rs.update fails on Win Server 2016 - Microsoft][ODBC driver for Oracle]General error

I've moved a legacy Classic asp app to Windows server 2016
in large part to resolve TLS 1.0 browser issues. The website works just like it should except for one problem. Updating a DB record fails.
I've set up syswow64 DNS and used a 32 bit Oracle 11g express install on the webserver to talk with the Oracle 11g standard DB. Everything seems to be fine with the application except when updating a sequence table. The code worked fine previously on windows server 2008.
rs.open sql, cn, adOpenDynamic, adLockPessimistic, adCmdText
If CheckNativeError(cn, SQL, Current_Sub_name) then
fGet_Next_SEQ_ID = ""
exit function
END IF
Opening and reading the recorset works and now need to update the
rs("NEXT_SEQ") = NEXT_SEQ (next seq = 222250)
rs.Update
Receives the following error.
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC driver for Oracle]General error
I'm thinking it is unable to update possibly by a driver issue involving a TLS 1.2 issue but I cannot find the answer why or what to do about it. Other settings for the website are correct, enable 32-bit code.. app pool, etc.
32 bit Driver used: Microsoft ODBC for Oracle
Switching to the Oracle XE driver instead of the Microsoft for Oracle driver fixed the issue. I've tested all the pages and it works fine. Looks like the Microsoft 32 bit driver will not be useful any longer with the TLS 1.2

UFT connection with Redshift

We are getting error while trying to connect UFT with Redshift:
Dim dbConnection
Srvname = "Driver={Amazon Redshift (x64)};Server=serverName; Database=DBName; UID=****; PWD=****; Port=****;"
Set dbConnection = CreateObject("ADODB.Connection")
dbConnection.Open Srvname
Error coming as:
Datasource name not found and no default driver specified.
But with all same credential we can able to connect redshift with "SQL Workbench".
SQL Workbench is using a different Connector (most probably JDBC or some other technology). The ADODB.Connection Object is trying uses the ODBC Drivers installed for the Operating System, so first things frist you need to install the ODBC Driver.
After this is don, depending on your credential management policy, you may need to simply use the proper Connection String or configure stuff in the ODBC wizard of Microsoft Windows.
SQL Workbench uses Amazon Redshift JDBC compatible driver. Try downloading ODBC driver. Follow the below link

Connecting to Oracle from Excel

I need to call an SQL request on an Oracle database from an Excel Sub. Here is the VB code I'm using to connect:
Set cn = New ADODB.Connection
With cn
.Provider = "MSDAORA.1"
.Properties("Data source") = "INSTANCENAME"
.Properties("User Id") = "USER"
.Properties("Password") = "PWD123"
.Open
End With
When I call it from a 32-bits Excell to a 32-bits Oracle client, it works well. But the target is a 32-bits Excel and a 64-bit Oracle client (I can't change this config). In this case I get the following error:
Oracle client and networking components were not found. These components are supplied by Oracle Corporation and are part of the Oracle Version 7.3.3 or later client software installation. Provider is unable to function until these components are installed.
Is it possible to call a 64-bit Oracle client from a 32-bits Excel using the same component or should I use another driver?
Any other idea is welcome.
EDIT : I can't install another Oracle client, so I can't use ODBC

SSIS: ODBC Connection Issue in BIDS 2008

I have an oracle DB i need to talk to so i installed the drivers and added it to the system DSN Data Sources. IM ON SQL SERVER 2008 R2 64bit
In BIDS, I can see the name of the DataSource, however when i go to enter it in the connection manager I get the following error:
TITLE: Connection Manager
Test connection failed because of an error in initializing provider. ERROR [IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
Any Ideas on how to resolve this?
I can connect to the Oracle DB through SQL Plus so i know i have connectivity.
Thanks!
When you installed the 11g client, I assume you did a custom install and installed the ODBC driver, right? And you set your ODBC DSN up using the Oracle Driver, not the Microsoft Driver? Did you test the DSN with the ODBC wizard?
#kevin
The Test connection failed because of an error in initializing provider. ERROR [IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
this error can be resolved by using a 32 bit driver for oracle connectivity and setting the package runtime properties to set 64 bit runtime= false.
also create a odbc dsn by using the 32 bit oracle driver.on 64 bit machines search for odbc32.exe. the path for it is the following C:\Windows\SysWOW64\odbcad32.exe.
run this as an administrator and use this DSN in your SSIS package and the issue will be resolved.

Resources