cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
anom217
Level 8

Error connecting Oracle ADO database

I have a Basic MSI project and I'm trying to run an InstallScript function that connects to an Oracle 11g database to see if the user provided the correct credentials. But I always get back the error message "Oracle Error 1017:ORA-01017: invalid username/password:logon denied".

Here is the code for my function:

function MyADODBTest()
OBJECT objConnection;
STRING strConnection;
BOOL bResult;
STRING strUserName;
STRING strPassword;
STRING strDatabase;
STRING strFieldName;
STRING strError;
begin
bResult = FALSE;
strError = "";

strProvider = "OraOLEDB.Oracle";
strUserName = "SYS";
strPassword = "password";
strDatabase = "MyDatabase";

///////////////////////////////////////////////////////////////////////////
// Build Connection String //
///////////////////////////////////////////////////////////////////////////
strConnection = "Provider=" + strProvider + ";";
strConnection = strConnection + "User ID=" + strUserName + ";";
strConnection = strConnection + "Password=" + strPassword + ";";
strConnection = strConnection + "Data Source=" + strDatabase;

///////////////////////////////////////////////////////////////////////////
// Open and Retreive SQL Server Version //
///////////////////////////////////////////////////////////////////////////
try
set objConnection = CreateObject("ADODB.Connection");

if (IsObject(objConnection)) then
objConnection.ConnectionString = strConnection;
objConnection.Open;
bResult = TRUE;
endif;

set objConnection = NOTHING;
catch
set objConnection = NOTHING;
strError = Err.Description;
endcatch;

if (!bResult) then
MessageBox(strError, INFORMATION);
endif;

return (bResult);
end;


I believe it's making the connection, because if I change the provider name it gives a different error about not being able to find the provider. But for some reason it won't validate my login, even though I'm giving it the correct password. I've tried with both the SYS and SYSTEM users.

Anyone have any idea on why this isn't working?
Labels (1)
0 Kudos
(2) Replies
hidenori
Level 17

Have you tried to login as SYSDBA? For the Oracle Provider for OLE DB, you need to specify "AS SYSDBA" after your password in the Password attribute, such as "Password=mypwd AS SYSDBA".
0 Kudos
anom217
Level 8

No luck. I've tried SYS and SYSTEM and still get the same invalid password error. Here is my connection string which I log right before executing:

Provider=OraOLEDB.Oracle;User ID=SYS;Password=password AS SYSDBA;Data Source=MyDatabase

I assume since it's returning the invalid password error that I have the connection string correct and it is attempting to make the connection? I really have no idea where to go on this one. Any help?
0 Kudos