Odbc connection not working if not defined as DSN entry - windows

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

Related

How to structure Oracle in OraClient11g_home1 connection string with host, service-name and port

In Oracle, I have a 32-bit driver to connect in my 32-bit ODBC Oracle in OraClient11g_home1.
I want to connect using host, port, service-name, uid, pwd (as I do in Oracle SQL Developer). But the only versions of connection string that I can find use TNSNames.ora, which I can't modify.
For example I found this connection string:
Driver={Oracle in OraClient11g_home1};Dbq=myTNSServiceName;Uid=myUsername;Pwd=myPassword;
But dbq here is a TNS name. How can I modify this connection string to include host, port, and service-name?
Edit:
I also tried this:
"Driver={Oracle in OraClient11g_home1};SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SERVICE_NAME=MyOracleSID)));uid=myUsername;pwd=myPassword;"
But I got an error:
[RODBC] ERROR: state HY000, code 12560, message [Oracle][ODBC][Ora]ORA-12560: TNS:protocol adapter error
Please try this:
'DRIVER={Oracle in OraClient11g_home1};DBQ=x.x.x.x:MyPort/MySID;UID=username;PWD=password'
First SQL Developer connect via JDBC not ODBC.
Are you using SID or service name to connect?
DB Version? Os?
You are using an old terrible (32bit) and unsupported version anymore as far as i know full of bugs.
Try to think about it but in any case try to replace SERVER= with CONNECTSTRING= or SERVICE_NAME with SID

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

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.

Oracle odbc connection

I'm trying to connect using different ODBC clients (Advanced query tools and ODBC Query Tool) to my remote Oracle database but every time getting the following error : ORA-12560: TNS:protocol adapter error
my connection settings are:
Driver={Microsoft ODBC for Oracle};dbq=192.168.10.11:1521/TEST_DB;Uid=username;Pwd=password;
Could you please explain what is wrong in my connection settings or am I need to configure something else?
Somewhere in your connection string, the Oracle SID or Service Name needs to be specified. The following are two examples, with one specifying SERVICE_NAME and the other specifying SID:
Driver={Microsoft ODBC for Oracle};Server=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=199.199.199.199)(PORT=1523))(CONNECT_DATA=(SID=dbName)));Uid=myUsername;Pwd=myPassword;
Driver={Microsoft ODBC for Oracle};Server=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=199.199.199.199)(PORT=1523))(CONNECT_DATA=(SERVICE_NAME=dbName)));Uid=myUsername;Pwd=myPassword;
Check your driver documentation to make sure you are including all of the required connection options. I believe the minimum required details are server, port, SID or SERVICE Name, UID, and PWD.
Tony Hall
Driver={Microsoft ODBC for Oracle};
CONNECTSTRING=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=server)(PORT=7001))(CONNECT_DATA=(SERVICE_NAME=myDb)));
Uid=myUsername;Pwd=myPassword;

Specify a default driver for ODBC

I have a legacy VB6 app which builds a DSN based on a parameter in a config file. The parameter is an ODBC connection, and the connection has a name (DSN-NAME) which maps a server (DBSERVER) to a driver ("SQL Server Native Client").
Generally, it builds a DSN like this:
DSN=DSN-NAME;User=foo;Password=bar
If I specify a hostname in the file, it builds a connection string which says
DSN=DBSERVER;User=foo;Password=bar
The error message reported is:
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
This suggests to me that there is perhaps a way of specifying a default driver, which may mean I can specify just the server name in the config file, and not need to create the ODBC connection.
(I am aware these can be created automatically; this is just to simply installation, and to satisfy my curiosity).
How do you specify a default driver? If I can set the default driver to SQL Server Native Client, can I then say DSN=DBSERVER and connect?
Edit: the point was to try and do this without changing the connection string. All the research suggested this isn't actually possible, but he wording of the dialog suggested it might be.
I had the same problem and fixed it by using the 32-bit ODBC admin to create a 32-bit DSN rather than the 64-bit admin in Administrative Tools which only creates 64-bit DSN which don't work.
The 32-bit ODBC Manager is located at C:\Windows\SysWOW64\odbcad32.exe
See this article "Data source name not found and no default driver specified" on Corey Gilmore's blog.
To specify a default driver, use DRIVER= in the connection string:
DRIVER=driver name here;DATABASE=mydb;USER=foo;PASSWORD=bar
The driver name is the name that appears in the Control Panel ODBC config tool for each driver. Note you will need to supply the info which would normally come from the DSN, in this case the database name.
You can achieve what you want by appending ";SERVER=dbserver" to your connection string.
There is already a server specified in your DSN, but the SERVER keyword in your connectionstring will override that.
http://msdn.microsoft.com/en-us/library/ms715433(VS.85).aspx
Use a DSN-less connection string...it can be created 'on the fly' to exactly suite your purposes....no piddling with odbcad32.cpl or reg/ini files to control/configure a dsn required.
see http://support.microsoft.com/kb/147875
for details

Resources