Unable to establish connection with database

Started by yuyang0571, September 13, 2009, 11:31:22 AM

Previous topic - Next topic

yuyang0571

HI,My friends,
   I install NETXMS server(0.2.27) in windows server 2003,and my database is oracle (9i),which is installed  in the same sever.When config my server,I failed to connect oracle,'unable to connect to database'.
and run "netxmsd -–debug=7",It said,"Unable to establish connection with database".
The following is listed by the config procedure:
Database engine: Oracle
Database driver: oracle.ddr
Create new database: no
Initalize database: yes

Database server: localhost
Database name: zhmg (this DB is existing,but during config,this item can't be modified )
Database user: system

Where is wrong?

thank you very much.

macro


yuyang0571

HI,macro,the attached file is my netxmsd.conf.

macro

I assume that you have tested your connection to Oracle DB with some other tools (e.g. sqlplus) and everything is in order. The only problem you have is to get NetXMS to connect to DB. If this is not the case please test Oracle connectivity first.

There are two problems with your netxmsd.conf:


  • For Oracle, DBServer parameter must be set to your Oracle SID, not the hostname. This is the main problem which prevents NetXMS from connecting to your database

  • Setting DBLogin to system (Oracle's administrator username) is a very very very bad idea. NetXMS doesn't need admin rights and by using "system" you are not only giving it full admin rights but also cluttering system schema with absolutely foreign objects. Please create a separate username, assign "connect" and "resource" roles to it and you'll be fine.

The proper netxmsd.conf file looks like this:

# Driver - Oracle
DBDriver = oracle.ddr
# Oracle SID (check tnsnames.ora)
DBServer = ODB1
# Not used by NetXMS Oracle driver
DBName = netxms_db
# Oracle user name (schema)
DBLogin = NETXMS
# Oracle user password
DBPassword = NETXMS

yuyang0571

HI,macro
    I try again based on your suggestion,but It still failed.
    The following configuration is from my netxmsd.conf:
       DBDriver = oracle.ddr
       DBServer = zhmg #this is my oracle SID
       DBName = zhmg
       DBLogin = netxms
       DBPassword = netxms

The following messages is done at this try:

SQL> CREATE USER netxms IDENTIFIED BY netxms;

the user is created.

SQL> grant connect,resource to netxms;

authorized successfully。

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
zhmg

and at command line,
c:\sqlplus netxms/netxms
can connect oracle successfully.


Bset regards

macro

Are you still getting "Unable to establish connection with database" message?

Please try the following:

1. Run cmd.exe, then set NLS_LANG environment variable to say AMERICAN_AMERICA.UTF8,
then from the same window start netxmsd

2. If #1 doesn't help run cmd.exe and check if the Oracle environment variables are ok
(ORACLE_HOME, PATH to Oracle binaries, TNS_ADMIN) - if not set them to proper
locations

3. If #1 and #2 dont help and you're using Oracle instant client try to specify fully
qualified TNS name instead of SID in DBServer parameter of netxmsd.conf
Please see explanation here:
http://www.oracle.com/technology/tech/oci/instantclient/ic-faq.html#A4428

Hope this helps

yuyang0571

HI,macro
many thanks ,It works! when I set envionment according to your suggestion 1 and 2.

[email protected]

Hi,
     Iam getting the below error when iam restarting the nxdbr

[root@localhost ~]# /usr/local/bin/nxdbmgr init /usr/local/share/netxms/sql/dbinit_mysql.sql
NetXMS Database Manager Version 0.2.31

Configuration file OK
Unable to connect to database netxms@localhost as netxms


and this is my netxmsd.conf

[root@localhost ~]# cat /etc/netxmsd.conf
#
# Sample configuration file for NetXMS server
#

#
# DBDriver
#
# Database driver to use
#
# UNIX example:
  DBDriver = /usr/local/lib/libnxddr_mysql.so
#
# Windows example:
# DBDriver = mysql.ddr

#
# DBServer
#
# Database server (ODBC source name for ODBC driver)
#
# Example:
DBServer = localhost

#
# DBName
#
# Database name (not used by ODBC driver)
#
# Example:
DBName = netxms

#
# DBLogin
#
# Database user name
#
# Example:
DBLogin = netxms

#
# DBPassword
#
# Database user's password
#
# Example:
DBPassword = trx123

#
# LogFailedSQLQueries
#
# Controls logging of failed SQL queries.
# Possible values: "yes" (default) or "no".
#
# Example:
LogFailedSQLQueries = yes

#
# LogFile
#
# Server's log file. To write log to syslog (or Event Log on Windows),
# use {syslog} as file name.
#
# Examples:
LogFile = {syslog}
LogFile = /var/log/netxms


Can Some one please help me how to fix this

Thanks
Subbu