Ok, I tried using the FreeTDS driver for unixodbc and I got a more detailed
error message that might shine a light:
Failed to connect
The driver reported the following diagnostics whilst running
SQLDriverConnect
IM007:1:0:[unixODBC][FreeTDS][SQL Server]Could not find UID parameter
HYC00:2:0:[unixODBC][FreeTDS][SQL Server]Driver not capable
0(0) auth_db:str_fixup: Unable to open database connection
0(0) ERROR: fix_expr : fix_actions error
ERROR: error -1 while trying to fix configuration
These are my entries in /etc/odbc.ini
[SYBASE]
Driver = /usr/local/lib/libtdsodbc.so
Description = Sybase Server
Trace = Yes
Trafcefile = /tmp/odbc.log
#Servername = JDBC
Server = xx.xx.xx.xx
Port = 5000
DSN = database
Database = database
#UserID = username # I tried using both UID and UserID, had same
results
UID = username
Password = passwd
TDS_Version = 5
These are my entries in /etc/freetds.conf:
[SYBASE]
host = xx.xx.xx.xx
port = 5000
tds version = 5
For whatever reason the module is not picking up the UID and PWD from the
db_url parameter i.e. modparam("usrloc|auth_db", "db_url",
"unixodbc://username:passwd@xx.xx.xx.xx/SYBASE")
The way I fixed the problem was by changing the file my_con.c, line 69:
From:
sprintf( stringDNS, "%s%s%s", "DSN=", id->database,
";");
to:
sprintf( stringDNS, "%s%s%s", "DSN=", id->database,
";UID=username;PWD=passwd;");
And now works fine. Also, to add debug to figure out which SQL queries fail,
I changed the file dbase.c line 75:
From:
LOG(L_ERR, "Return value: %d\n", ret);
To:
LOG(L_ERR, "Return value: %d, Performing query: %s\n", ret,
_s);
Now everytime a query fails it'll say the result msg, as well as the actual
query that failed.
Lenir
_____
From: devel-bounces(a)openser.org [mailto:devel-bounces@openser.org] On Behalf
Of lenirsantiago(a)yahoo.com
Sent: Thursday, December 08, 2005 12:59 PM
To: devel(a)openser.org; users(a)openser.org
Subject: [Devel] unixODBC Database Connection Problem
Guys,
Im trying to use unixodbc.so to connect to a Sybase database using Sybase
native ODBC drivers. This is the entry that I have on:
/etc/odbc.ini:
=============
[SYBASE]
Description = Sybase ODBC Data Source
UserID = username
Password = passwd
Driver = ASE
Server = xx.xx.xx.xx
Port = 5000
Database = database
UseCursor = 1
/etc/odbcinst.ini
============
[ASE]
Description = Sybase ODBC Driver
Driver = /opt/sybase/ODBC-12_5/lib/libsybdrvodb.so
FileUsage = -1
UsageCount = 1
The database is on a remote host. I can connect from the openser server
using unixodbc's isql tool, as such:
[root@ser openser]# isql SYBASE username passwd
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
This proves that unixodbc is installed correctly and that the Sybase odbc
driver is installed and functioning properly.
However when I try to run openser (debug=4) I get the following:
0(0) fixing /usr/local/lib/openser/modules/auth_db.so www_authorize
0(0) db_init: Connection 'unixodbc://username:passwd@xx.xx.xx.xx/SYBASE'
not found in pool
Failed to connect
The driver reported the following diagnostics whilst running
SQLDriverConnect
0(0) auth_db:str_fixup: Unable to open database connection
0(0) ERROR: fix_expr : fix_actions error
ERROR: error -1 while trying to fix configuration
0(0) XLOG: destroy module ...
0(0) DEBUG: tm_shutdown : start
0(0) DEBUG: unlink_timer_lists : emptying DELETE list
0(0) DEBUG: tm_shutdown : emptying hash table
0(0) DEBUG: tm_shutdown : releasing timers
0(0) DEBUG: tm_shutdown : removing semaphores
0(0) DEBUG: tm_shutdown : destroying tmcb lists
0(0) DEBUG: tm_shutdown : done
0(22871) shm_mem_destroy
0(22871) destroying the shared memory lock
[root@ser openser]#
This is a snippet of my openser.cfg
------------------------------START--------------------------------
debug=4
fork=no
log_stderror=yes
listen=yy.yy.yy.yy
port=5060
children=4
server_signature=no
dns=no
rev_dns=no
check_via=no
syn_branch=yes
memlog=1000
sip_warning=no
fifo_mode=0666
fifo="/tmp/openser_fifo"
fifo_db_url="unixodbc://username:passwd@xx.xx.xx.xx/SYBASE"
reply_to_via=no
loadmodule "/usr/local/lib/openser/modules/mysql.so"
loadmodule "/usr/local/lib/openser/modules/postgres.so"
loadmodule "/usr/local/lib/openser/modules/unixodbc.so"
loadmodule "/usr/local/lib/openser/modules/sl.so"
loadmodule "/usr/local/lib/openser/modules/tm.so"
loadmodule "/usr/local/lib/openser/modules/rr.so"
loadmodule "/usr/local/lib/openser/modules/maxfwd.so"
loadmodule "/usr/local/lib/openser/modules/usrloc.so"
loadmodule "/usr/local/lib/openser/modules/registrar.so"
loadmodule "/usr/local/lib/openser/modules/acc.so"
loadmodule "/usr/local/lib/openser/modules/auth.so"
loadmodule "/usr/local/lib/openser/modules/auth_db.so"
loadmodule "/usr/local/lib/openser/modules/auth_radius.so"
loadmodule "/usr/local/lib/openser/modules/uri.so"
loadmodule "/usr/local/lib/openser/modules/uri_radius.so"
loadmodule "/usr/local/lib/openser/modules/mediaproxy.so"
loadmodule "/usr/local/lib/openser/modules/nathelper.so"
loadmodule "/usr/local/lib/openser/modules/textops.so"
loadmodule "/usr/local/lib/openser/modules/domain.so"
loadmodule "/usr/local/lib/openser/modules/avpops.so"
loadmodule "/usr/local/lib/openser/modules/avp_radius.so"
loadmodule "/usr/local/lib/openser/modules/permissions.so"
loadmodule "/usr/local/lib/openser/modules/xlog.so"
loadmodule "/usr/local/lib/openser/modules/options.so"
#loadmodule "/usr/local/lib/openser/modules/group.so"
loadmodule "/usr/local/lib/openser/modules/speeddial.so"
loadmodule "/usr/local/lib/openser/modules/group_radius.so"
modparam("usrloc", "db_mode", 0)
modparam("usrloc", "timer_interval", 60)
modparam("usrloc", "desc_time_order", 1)
modparam("permissions", "db_mode", 1)
modparam("permissions", "trusted_table", "trusted")
modparam("permissions", "default_allow_file",
"/etc/ser/permissions.allow")
modparam("permissions", "default_deny_file",
"/etc/ser/permissions.deny")
modparam("usrloc|auth_db", "db_url",
"unixodbc://username:passwd@xx.xx.xx.xx/SYBASE")
---------------------------------END----------------------------------------
-
Any suggestions?
Lenir