Forum Stats

  • 3,839,332 Users
  • 2,262,484 Discussions
  • 7,900,936 Comments

Discussions

ORA-01017: invalid username/password; logon denied while calling createConnection from C++

I am trying to create the connection using OCI, but on executing the code I am getting the error

ORA-01017: invalid username/password; logon denied while calling from C++. This seems to be an old error and lots of posts on Google. But, I didn't find any post related to C++.

I have Oracle 19 c installed on Windows 10.

I am able to login into Oracle Sql Developer and didn't face any issue during login. I would appreciate it if someone throws any hint on this.

Thanks.

Environment *env;
Connection *conn;
const string userName = "system";
const string password = "password";
const string connectString = "";
int main()
{
Environment::createEnvironment(oracle::occi::Environment::THREADED_MUTEXED); 
env = Environment::createEnvironment(Environment::THREADED_MUTEXED);
	try {
		conn = env->createConnection(userName, password, connectString);
	}
	catch (const SQLException& e) {
		std::cout << e.what() << std::endl;
		exit(EXIT_FAILURE);
	}
}