Unable to connect to an Oracle Database


  
 Applies To 
  
 Product(s):MicroStation
 Version(s):V8i
 Environment: N/A
 Area: Database
 Subarea: Oracle
 Original Author:Carlos Martins, Bentley Technical Support Group
  

 

 

 

 

 

 

  

This technote presents a number of known issues that cause connection failure when trying to establish
a connection to an Oracle database from within MicroStation using the Oracle direct connection.

The MicroStation Connect to Database tool is used to connect to an external database. To connect
to an Oracle database using the Oracle direct connection (Oracle tab) set the Database Server to Oracle. In the Connect String field the connection statement has the following syntax: <user_name>/<password>@<database_alias>.


The table below identifies situations where the connection with the database fails. The Oracle error codes shown are messages exposed in the MicroStation debug session. These error codes may prove to be a basis to resolve the connection failure problem.

Problem

Setup*

MicroStation Message Center

MicroStation Database Debug
  Session
**

Possible reasons

Solution***

Unable to
  connect when using Oracle 10g Client

Client:  10g

Server:
  10g or 11g

Unsuccessful
  CONNECT statement

Database:
  NONE

ORA-12154: TNS: could not resolve
  the connect identifier specified

Oracle
  10g client does not support the parenthesis present in the path of the
  MicroStation default root installation directory. The MicroStation default
  installation directory (MSDIR variable) is

C:\Program
  Files\Bentley\MicroStation V8i (SELECTseries)\MicroStation

Install
  Oracle 11g Client or alternatively Install MicroStation V8i removing the
  parenthesis from the installation path

Unable to
  connect

Any
  combination of Oracle 10g and 11g

Unsuccessful
  CONNECT statement

Database:
  NONE

ORA-12170: TNS: Connect timeout
  occurred

Network
  issues or the possibly of the machine hosting the Oracle Server blocking the
  connection port

Connectivity
  on an I/O port is required. On Windows Servers in most cases TCP/IP port 1521
  is the standard port used.

Unable to
  connect

Any
  combination of Oracle 10g and 11g

Unsuccessful
  CONNECT statement

Database:
  NONE

ORA-12154: TNS: could not resolve
  the connect identifier specified

Wrong
  database_alias / service_name has been specified in the connect string

Specify
  the correct name of the database service in the connect string: <user_name>/<password>@<database_alias>

Unable to
  connect

Any
  combination of Oracle 10g and 11g

Unsuccessful
  CONNECT statement

Database:
  NONE

ORA-01017: invalid username/password; logon denied

Incorrect
  user or password specified

Specify
  the correct user and password in the connect string: <user_name>/<password>@<database_alias>

Unable to
  connect

Any
  combination of Oracle 10g and 11g

Unsuccessful
  CONNECT statement

Database:
  NONE

ORA-12541: TNS: no listener

TNSListener
  service is stopped

A
  listener is a service that is configured for a specific I/O port and network
  protocol. It listens on a port for incoming and outgoing requests and routes
  them to the instance. The service must be running at the server end

Unable to
  connect

Any
  combination of Oracle 10g and 11g

Unsuccessful
  CONNECT statement

Database:
  NONE

ORA-12514: TNS:listener does not
  currently know of service requested in the connect descriptor

Listener.ORA
  may contain for example the IP address despite the TNSNames.ORA being define
  with the computer name

Specify
  in Listener.ORA the computer name

 

 * Note 1: Even on a Windows 64 bit based Operating System, Oracle Client 32 bit must be installed since MicroStation is a 32 bit application.

 ** Note 2: By default one cannot debug database connection issues because the key in command session debug [on/off] is only available after completion of the database connection, when the server.ma is loaded. To workaround this set MS_SESSION_DEBUG=1, if this variable is set either at the Environment Level or as a
MicroStation Configuration variable, Session Debug information will begin populating the message window as soon as the first database operation is executed and thus one can debug connection issues. The debug session can be captured to a file using the key in command dmsg openmsgfile path/filename.txt, after concluding the action to be debugged key in command dmsg closemsgfile.

 *** Note 3: The assistance from a database administrator may be needed in some instances since access to the machine that hosts the Oracle server may be required.
 

Multiple Oracle Clients

If you have multiple Oracle clients installed on your system, ensure that the correct Oracle client files are used to connect to Oracle by setting the configuration variable MS_ORACLE_HOME in the configuration file "..\Bentley\MicroStation<version>\MicroStation\config\database\oracle.cfg".

If this variable is not set, MicroStation looks at the system registry and path to determine the Oracle Home directory. In that situation the environment variable “PATH” defines which Oracle Client version that will be used by MicroStation. The Oracle client version listed first by the Environment variable “PATH” will be the one used by MicroStation. To verify the list order simply type ‘path’ from a DOS command prompt as exemplified in the image below. The PATH” variable can be modified in Advanced System Settings.

 

See Also

MicroStation V8i Supported Database List

Session Debug and Logging Database Commands