Odbc dsn-less conection string error IM002 - windows

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

Related

Export Database connection to Oracle Developer

I have a database Connection established in odbcad and Microsoft Access (aswell as working in Excel) via ODBC and want to also get it working in Oracle SQL developer.
It is a Windows SQL Server as far as i know and I have tried several Settings, of which None works. I have also installed Driver for ODBC. I would like to Import Settings into SQL developer as applied in MS Access, is there any possibility?
No, SQL Developer is a Java application and uses a JDBC driver.
But if you look at the odbc properties for your connection, those should largely translate to what you need to define a basic connection.
Oracle:
Server name or IP address of the DB, port # for the listener, and the name of the SID or Service, plus a valid username and password is all you need to connect to Oracle.
What error do you get when you try to connect?
Show us what you're trying.
Update:
You're trying to connect to SQL Server but you're getting"
Native SSPI library not loaded
You're trying to use OS Authentication for your connection. For this to work with the jTDS driver, you need to copy a DLL file named ntlmauth.dll (which is for NT authentication) under the jtds-x.x.x-dist\x86\SSO\ or jtds-x.x.x-dist\x64\SSO\, to any directories in the PATH environment.
Please update your question such that's it's clear you're connecting to SQL Server and share the error message so others can find it.
I imagine this question is a duplicate of many previous iterations of the same challenge.

IIS site not connecting to Oracle database

I have a server with IIS that hosts web sites.
Some of those web sites (Silverlight) must connect to an Oracle Database to perform queries via OleDb, but they cannot.
Here are the results of what I tested :
'msdaora' provider is not registered on local machine when I run it in the web site
ORA-01019: unable to allocate memory in the user side (when I try to connect with a test console program without administrator status)
Connection OK (with the same test console program WITH administrator status)
ORA-12154: TNS:could not resolve the connect identifier specified when trying to switch to another method of connection (from OleDb to Oracle.ManagedDataAccess.Client)
I went through countless info about these kind of errors but I couldn't find any working solution.
Here is what I tested :
giving "create global objects" right to the relevant users (no change at all)
installing several Oracle clients one after another. Best result is with 10.2 client 64b (where my test program can connect while having administrator rights). The install is clean (no several Oracle folders nor several Oracle environment variables at the same time)
disabling warnings concerning the administrator elevation (ie no confirmation pop up during elevation) : no change at all
checking RAM usage (plenty of memory under the foot)
Additional infos :
The connection string is
Provider=msdaora;Data Source=HOSTNAME;User Id=USER;Password=PASSWORD
Same connection string used with OleDb and Oracle.ManagedDataAccess.Client.
The tsnames.ora file exists (and works, as show my succesful attempt with the administrator test program)
It's working on an older web server, but there are too much differences for me to find any meaningful one (different Windows, 32/64b, different IIS versions, different Oracle client)
Any idea ?
There are several points:
Microsoft msdaora provider for OLE DB is deprecated for ages. You should prefer the Oracle Provider OraOLEDB.Oracle.
Oracle Client and OLE DB provider and IIS application have to have the same architecture, i.e. all must be either 32 bit or 64 bit, you cannot mix them. (ancient msdaora is not available for 64 bit). However, ODP.NET Managed Driver (Oracle.ManagedDataAccess) works for both 32 bit and 64 bit.
When you use ODP.NET Managed Driver then Provider=MSDAORA is not needed in ConnectionString. I assume such attributes is ignored or you just missed to mention it.
Version of Oracle Client and OLE DB provider must match (even minor version). Due to COM limitation you cannot install more than one OLE DB provider for 32 bit and 64 bit each.
Search pattern for tnsnames.ora file in OLE DB is different to search pattern in ODP.NET Managed Driver. Verify following items:
OLE DB reads your Registry for TNS_ADMIN value, the ODP.NET Managed Driver does not.
ODP.NET Managed Driver uses your .NET config file (i.e. web.config, machine.config) to determine location of tnsnames.ora file, the OLE DB does not.
According documentation ODP.NET Managed Driver does take into account the TNS_ADMIN Environment variable and folder %ORACLE_HOME%\network\admin. However, according to my tests it does anyway.
Regarding connection failure is depending on "Rus as Administrator" check permissions of your Oracle installation folder.

Migrating VB6 code to use 64-bit ODBC DSN

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.

Odbc connection not working if not defined as DSN entry

I have a problem with installing ODBC driver under Windows (7, 64bit) to connect to Oracle database. They kind of work - I mean I can define a DSN entry and open connection using "DSN=foobar" connection string but I can't use something more generic like passing full connection string to OdbcConnection or basing it on tnsnames.ora file. In both cases I get
"Data source name not found and no default driver specified"
What client software are you using? The answer is probably going to be, use ADO

VB6 "Provider cannot be found."

I have a few applications written in VB6 that are all using the same connection string on the same machine. They are using the ODBC provider with the SQL Server Native Client 10.0 driver and connecting with explicit username and password.
At run-time, one of the applications throws an exception when I try to connect to the database:
3706: Provider cannot be found. It may not be properly installed.
I don't understand why this one application is having an issue when the others are working fine. The references are the same, down to the version number.
Try installing MDAC on your machine.
If you are using the program on another system and using Access you will need to download and install http://www.microsoft.com/download/en/details.aspx?id=23734 if access is not installed on the system

Resources