I have a legacy VB6 application which I've inherited. The issue I'm facing is that I'm getting the infamous
ORA-12638: Credential retrieval failed
error message whenever it tries to connect to one of our Oracle databases. I can connect fine from SQLPlus and Toad, however. I've Googled around and everyone seems to say that modifying their sqlnet.ora file to
SQLNET.AUTHENTICATION_SERVICES=(NONE)
did the trick. I have yet to find anyone with an alternative fix. Here is what my connection string looks like:
"PROVIDER=OraOLEDB.Oracle;DATA SOURCE=(DESCRIPTION = " & _
"(ADDRESS = (PROTOCOL = TCP)(HOST = server1)
(PORT = 1521))" & _
"(ADDRESS = (PROTOCOL = TCP)(HOST = server2)
(PORT = 1521))" & _
"(LOAD_BALANCE = yes) " & _
"(CONNECT_DATA = " & _
"(SERVER = DEDICATED) " & _
"(SERVICE_NAME = database_name_here) " & _
") " & _
"); " & _
"User Id=username_here;Password=password_here;"
As for my VB code, it's quite simple.
Private oracleDatabaseConnection As ADODB.Connection
Set oracleDatabaseConnection = New ADODB.Connection
oracleDatabaseConnection.Open oracleConnectionString
Anyone have any ideas?
Thank you. :)
I know this is a very old post but I have found a solution that has worked for me (Legacy VB6 Application):
Change the following entry in the sqlnet.ora file:
Original Entry - SQLNET.AUTHENTICATION_SERVICES= (NTS)
Modified Entry - SQLNET.AUTHENTICATION_SERVICES= (NONE)
Here is a LINK to the solution
Honestly this is one of those errors that can be caused by lots of different root problems.
On the assumption your database server is Windows, check its event log, both System and Application. You may find something there that is useful.
I have encountered this error in some cases because the account under which the Oracle service was running got locked.
I have also encountered it in cases where we never found the explanation, but we were always able to clear up the issue by having the user lock and unlock their PC.
Is the VB application running on a different machine than the client that can connect? If so, is it possible to test using a different client program on the same machine -- or is it possible to try the VB application on your machine?
Know it's an old question but it has started appearing with the recent Windows update.
The way to easily solve it is to set
SQLNET.AUTHENTICATION_SERVICES= (NONE)
in the sqlnet.ora.
If you are running a web app under IIS, restarting IIS seem to help. But this is one sucker of an issue that has not much reasoning behind.
I installed Oracle Database 11g Express Edition 32-bit on Windows 10 professional 64-bit (spanish edition).
After restart PC all works ok.
But the next day I get error using SQL*PLus and SQLTools 1.9 build 15:
ORA-12638: Credential retrieval failed
I modified the sqlnet.ora file so:
SQLNET.AUTHENTICATION_SERVICES= (NONE)
and now I can connect using SQLPlus, SQLTools 1.9 build 15.
If using IIS and for a VB app, it may help to create a new Data Source in the ODBC manager and referencing it by name (instead of by provider) in the connection string.
For example, if the name for the Data Source is "test_ds", I would replace
ObjConn.open "Provider=MSDAORA;User ID=myuser;password=mypassword;Data Source=MYDATASOURCEFROMTNSNAMES;Persist Security Info=False"
for
ObjConn.open "dsn=test_ds;pwd=mypassword"
Can't really explain the logic behind the solution, but it worked for me.
Note also that Windows client connections can fail with this error, when using Windows Hello login.
Whatever windows authentication for a connect like:
sqlplus un/pw#Dev
failed with ora-12638, when I logged into my laptop with Face recognition (ie. using Hello)
To get around this, either set SQLNET.AUTHENTICATION_SERVICES = (NONE)
or just login with your tradition windows username and password.
Related
I need to access unidata database from a server. I tried using vbscript.
Set conn = CreateObject("ADODB.Connection")
conn.Open"Provider=IBM.UniOLEDB.1;Data Source=myunidatadatasourcename;User ID=myuserid;Password=mypassword;Location=D:\info\mydatabase;"
uci.config file contains
<myunidatadatasourcename>
DBMSTYPE = UNIDATA
network = TCP/IP
service = udserver
host = xxx.xxx.xxx.xx
But I got an error
Can anyone help?
http://www.pickwiki.com/index.php/JavaSource has some good Uniobjects troubleshooting tips, though it's obviously java-centric. A couple of things to check and try are:
Make sure you can telnet to 31438 on the Unidata server. If not,
it's either not listening (run startunirpcd) or you have a firewall problem.
Try creating an ODBC connection and click the test button. The error messages are more informative.
If you have an ODBC connection, try removing the provider info. It's probably
not IBM any more, unless you have a really old client.
conn.Open"Data Source=ODBC Alias;User ID=myuserid;Password=mypassword"
Check out connectionstrings.com - it's super helpful for this kind of ODBC/OLEDB nonsense.
There's some setup involved on the Unidata side to allow SQL statements. If you want to try a quick test, point the ODBC to $UDTHOME/demo and try "SELECT CITY FROM CUSTOMER" which should run without errors.
I need to connect to a remote Oracle server from VBA. I do not want to install any additional drivers or software to connect as I need to distribute the Excel to the team.
I tried several connection strings giving errors like SQL_HANDLE_ENV failed. or Oracle client and networking components not found. or when use OraOLEDB.Oracle I get Provider not found.
Connection strings tried so far:
"Driver={Microsoft ODBC for Oracle}; CONNECTSTRING=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=servicename))); uid=username; pwd=Password;"
"PROVIDER=MSDAORA.Oracle;DATA SOURCE=hostname;USER ID=username;PASSWORD=Password"
"PROVIDER=MSDAORA;DATA SOURCE=hostname;USER ID=username;PASSWORD=Password"
"Driver={Oracle in OraClient11g_home1};Dbq=servicename;Uid=username;Pwd=Password;"
"Provider=OraOLEDB.Oracle;Data Source=hostname;User Id=username;Password=Password;"
There are some pre defined drivers in windows i suppose. But does it not work for oracle? I use windows 8
Any help greatly appreciated..
I did some more research and came across ODP.net. So the conclusion i think is either use Oracle Instant Client or ODP.net. But i am no sure if any .net Application like ODP.net will work without .Net framework. Please let me know if anyone came across this.
Almost every provider needs an Oracle Client installed. Exceptions are JDBC which is Java and does not work in VBA/Excel and the ODP.NET Mananged Driver. However, ODP.NET Mananged Driver is a .NET assembly and they are not working with COM which is used in VBA/Excel. You would have to write your own wrapper for it.
The .NET framework is part of every Windows installation, there should be no concerns.
btw, did you add Reference for Microsoft ActiveX Data Objects ... to you VBA project?
Looks like you cannot pass by the Oracle Instant Client.
Try this:
Provider=MSDAORA.1;Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = SERVER0123)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = PRODDB)));User Id=USER_ID;Password=USER_ID_PASSWORD
Obviously you need to replace the server, User ID and Password.
I have a working excel macro that connects using the following connection type:
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open ( _
"User ID=userid" & _
";Password=pass" & _
";Data Source=blank.blank.com" & _
";Provider=MSDAORA.1")
I can connect in one part of my network but when I try to use the same macro on another computer I can no longer connect. My thought is there is a networking issue and I need to be "more specific". So after some googling I've come across other data connection strings that utilize IP and port name.
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;
Coming from https://www.connectionstrings.com/microsoft-odbc-for-oracle/
Following Microsofts documentation then I get the following:
With cn
.Provider = "MSDAORA.1"
.ConnectionString = "Driver={Microsoft ODBC for Oracle};" & _
"Server=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=1.1.1.1)(PORT=xxxx))(CONNECT_DATA=(SID=DB)));" & _
"Uid=userid;Pwd=pass;"
.Open
End With
However I get an error: ORA-12560 TNS:Protocol adapter error
Some solutions indicate that I should restart the database, but it's running! I connect to it just fine the other way.
Does anyone have a better way of connecting "more specifically" that might help my networking problem or might be able to help me fix up my new way of connecting?
I have always used the option you originally used. The fact that it works on one machine and does not work on another indicates to me that you do not have the MSDAORA driver installed on the second computer. The machine requires that the ODBC driver exists on the machine for your code to function.
Go to ODBC and make sure you can create a test connection via the ODBC panel on the second machine to make sure ODBC is functional for the MSDAORA driver.
I see there is no test connection when using Microsoft ODBC for Oracle. There is for the Oracle driver. One way to test it is to open MS Access and create a linked table, using the Microsoft ODBC connection you created. It will prompt you for a password and if it succeeds you will link the table, and know it is working, or it will give you an ODBC error, and you will know it is not.
Or you could use the Oracle driver, which would require installing the Oracle Client driver, and changing your connection information to reflect that driver instead of the MS one.
This works fine for me:
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open ( _
"User ID=userid" & _
";Password=pass" & _
";Data Source=blank.blank.com" & _
";Provider=MSDAORA.1")
I am trying to connect into Oracle through Power Query > From Database > From Oracle Database and then I type BI_TST, which is within my TNSNAMES (located in: C:\oracle\product\10.2.0\client_2\network\ADMIN), and has the connection below inside:
BI_TST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = srv-oracle3.mycompany.com.br)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = bitst)
)
)
Also i have the variable path configured as TNS_ADMIN=C:\oracle\product\10.2.0\client_2\network\ADMIN.
When I use SQL Developer to connect, not using TNS put setting all the information manually, it works!
When I try to connect using TNS within Excel I get the error:
Message=ORA-12154: TNS:não foi possível resolver o identificador de conexão especificado
ErrorCode=-2146232008
Wich means in English: "could not resolve the connect identifier"
Could anyone please help me in this issue?
Thanks in advance!
Honestly, I've had my fill of tnsnames. I understand the idea behind it and can appreciate that, but I spend more time figuring out why it's not working than I do saving the extra keystrokes.
In my opinon, just bypass TNSnames use Oracle's ezconnect:
srv-oracle3.mycompany.com.br:1521/bitst
In place of:
BI_TST
This should work for ODBC as well. If you can't direct connect through PowerQuery's Oracle driver, try going through ODBC. While it's an additional layer you probably don't want, I doubt you'll notice a performance difference, and it may abstract the difficulties you normally have to deal with.
To clarify Hambone's response, to connect Excel to Oracle via Oracle client driver without using TNS Names:
Go to Control Panel > Administrative Tools > ODBC Data Sources
Go to File DSN tab
Choose Oracle driver (e.g. Oracle11gr1)
Provide a name for the new data source (any name)
When prompted for Service Name, enter host:port/servicename e.g. db123:1521/service123
Hope this works for everyone.
I recently picked up a project where I need to build some SSIS packages that extract data from a remote Oracle database and load the data into a Sql Server database. The Oracle database is an old 32-bit Oracle 8i database. The Sql Server is 64-bit Sql Server 2008R2.
I can connect to the Oracle database from an old Win XP workstation no problem. When I try and connect from the Sql Server, I can't set a handshake.
I installed The Oracle Client 11g on the Sql Server box, copied the tnsnames file from the Install\Network\Admin\Sample to Install\Network\Admin and added the entry that worked on the XP workstation. When I try and create an ODBC connection using the Oracle ODBC Drviver, I get:
*Unable to connect Sql State=08004 ORA-12154: TNS:could not resolve the connect identifier specified.*1
My guess is that the driver can't find the TNS file. Is there anything else I have to configure? I checked the exception code via duckduckgo and I could not find anything.
Thanks in advance.
OK, I found it
I had to go into the Environment variables and define the ORACLE_HOME path. Once I did that, it connected.
This post got me on the right track.
Thanks
You have to use both of either 64 bit or 32 bit as your machine configuration. Make sure your server configuration is correct.
This might help someone stuck for "identifier not resolved issue":
If you have already checked the environment variables : PATH, ORACLE_HOME, TNS_ADMIN, please give a close look to tnsnames.ora entry for the given dsn. I had not given proper indentation and it was failing because of that!
Here is the entry with accurate indentation:
<dsn> =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = <server>)(PORT = <port>))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = <servicename>)
)
)
I had a similar problem where I was getting garbage in the TNS Services name list and testing the connection took forever. I found this was caused be a typo in the system environment variable setting for the TNS_ADMIN variable, where I had a space after the directory eg c:\oracle\instantclient_ (where _ is a space)
Removed and corrected the list garbage and connected straight away.
Hope this helps.
Of course you must check your TNSNAMES.ora at
C:\your_oracle_folder\app\oracle\product\11.2.0\server\network\ADMIN\TNSNAMES.ora
You should see at the top what is your system name. In my case Oracle 11g Express is "XE". Then configure your ODBC 32 or 64 bits depending on your platform: