when i am trying to debug my project. I am getting error while trying to establish a database connection. My connection is failing.
I am using Rogwave Library to connect to database.
I am using oracle database.
The Following is my code
Code:
RWDBDatabase oDBWork = RWDBManager::database ( sDBAccessLib,
sDBName, sDBUser, sDBPassWd, sDBServerName );
oDBWork.defaultConnections(3);// dbTools verwaltet 3 Connection
// Get and test a DB connecetion
RWDBConnection oConn1 = oDBWork.connection();
RWDBConnection oConn2 = oDBWork.connection();
RWDBConnection oConn3 = oDBWork.connection();
if ( (!oDBWork.isValid()) || (!oConn1.isValid()) || (!oConn2.isValid()) || (!oConn3.isValid()) )
{
oSAPAuftragLog->WriteLogFile ("Can't connect to data base <" + sDBName + ">");
cout << ProgTitel << ": Can't connect to data base " << sDBName << endl;
EndProg (FALSE);
return 1;
}
The below are my runtime values:
Code:
- sDBAccessLib {...}
- data_ {???}
std::allocator<char> {...}
+ _C_data 0x00bb3dec "or84315d.dll"
- sDBName {...}
- data_ {???}
std::allocator<char> {...}
+ _C_data 0x00bb333c "AVVT"
- sDBUser {...}
- data_ {???}
std::allocator<char> {...}
+ _C_data 0x00bb34bc "Master"
- sDBPassWd {...}
- data_ {???}
std::allocator<char> {...}
+ _C_data 0x00bb33fc "Test"
- sDBServerName {...}
- data_ {???}
std::allocator<char> {...}
+ _C_data 0x100b2f54 ""
If i try to connect toad to oracle database. I am able to connect it.
Code:
Database: AVVT
User / Schema: Master
Password: Test
Connect as : Normal
Connect Using: OraHome81 (Oracle Root)
The below is the error i am getting in my log. while trying to connect through my program
Code:
15.07.2011 20:27:33 [SERVERERROR] ORA-12154: TNS:could not resolve the connect identifier specified
Error number : 12154
Server:
15.07.2011 20:28:07 Can't connect to data base <AVVT>
In case to modify the TNS File. Please expalin in details.
Which location i will find the TNS File ?.
what to modify in TNS FIle ?.
How Toad is able to connect to database ?.
In toad there is a button called TNSNames Editor.
If i click that i am able to find the below entries.
Code:
File Name : C:\Oracle\Ora81\Network\Admin\tnsnames.ora
AVVP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.135.41.49)(PORT = 6210))
)
(CONNECT_DATA =
(SID = AVVP)
)
)
AVVT =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.135.43.21)(PORT = 6210))
)
(CONNECT_DATA =
(SID = AVVT)
)
)
AVV2P =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.150.128.45)(PORT = 1565))
)
(CONNECT_DATA =
(SID = AVVP)
)
)
Please help me to find out why my program is not connecting to oracle database.