[Devel] unixODBC connection

Lenir lenirsantiago at yahoo.com
Fri Dec 23 23:03:09 CET 2005


Ok, so now that openser loads fine, here's the kicker, openser coredumps
when any of the tables are populated except for the version table. In my
case the only two tables that I use are permissions and domain.

Here's what I get:
WARNING: no fork mode 

stateless - initializing

 0(0) Maxfwd module- initializing

 0(0) ACC - initializing

 0(0) AUTH module - initializing

textops - initializing

Connected

Returned connection string was:

        DSN=SYBASE;UID=admin;PWD=password;

Segmentation fault (core dumped)

 

I tried running a trace on the file and this is what I got (not sure if im
doing this right):

 

(gdb) bt

No stack.

(gdb) core-file core.28339

Core was generated by `openser -f /etc/openser/openser.cfg'.

Program terminated with signal 11, Segmentation fault.

#0  0x0045bffb in ?? ()

(gdb) bt

#0  0x0045bffb in ?? ()

#1  0x007debfc in ?? ()

#2  0x0045c544 in ?? ()

#3  0x00521838 in ?? ()

#4  0x00521800 in ?? ()

#5  0x00000418 in ?? ()

#6  0x005153f1 in ?? ()

#7  0x005153f1 in ?? ()

#8  0x005153f1 in ?? ()

#9  0x005153f1 in ?? ()

#10 0xfffffffd in ?? ()

#11 0x00521838 in ?? ()

#12 0x007e2c40 in ?? ()

#13 0x007debfc in ?? ()

#14 0x0045c544 in ?? ()

#15 0x00000010 in ?? ()

#16 0x00000030 in ?? ()

#17 0x00521838 in ?? ()

#18 0x00000000 in ?? ()

(gdb)

 

  _____  

From: devel-bounces at openser.org [mailto:devel-bounces at openser.org] On Behalf
Of Lenir
Sent: Friday, December 23, 2005 4:44 PM
To: devel at openser.org
Subject: [Devel] unixODBC connection

 

Guys,

Im trying to use the unixodbc module using the FreeTDS drivers. I'm trying
to connect to Sybase. 

I can connect fine using both isql and tsql and connecting by both: using
DSN or specifying host, port UID and PWD, so I know for a fact that unixODBC
and FreeTDS are installed and working properly.

 

Here are my config files for unixODBC and FreeTDS:
[root at home ~]# cat /etc/odbc.ini 

[SYBASE]

Description             = FreeTDS ODBC Data Source

UID                     = admin

PWD                     = password

Driver                  = FreeTDS

Server                  = xx.xx.xx.xx

Port                    = 5000

Database                = database

DSN                     = database

UseCursor               = 1

TDS_Version             = 5

 

 [root at home ~]# cat /etc/odbcinst.ini 

# Example driver definitinions

#

#

[FreeTDS]

Description             = FreeTDS ODBC Driver

Driver          = /usr/lib/libtdsodbc.so

 

[root at home ~]# cat /etc/freetds.conf 

[global]

        tds version = 4.2

        dump file = /tmp/freetds.log

        debug level = 10

 

[SYBASE]

        host = xx.xx.xx.xx

        port = 5000

        tds version = 5.0

 

in my openser.cfg file I use the following for all DB related parameters

fifo_db_url="unixodbc://admin:password@xx.xx.xx.xx/SYBASE"

modparam("acc|usrloc|permissions|domain|speeddial|alias_db", "db_url",
"unixodbc://admin:password@xx.xx.xx.xx/SYBASE")

modparam("avpops", "avp_url","unixodbc://admin:password@xx.xx.xx.xx/SYBASE")

 

When I run openser I get the following:

WARNING: no fork mode 

stateless - initializing

 0(0) Maxfwd module- initializing

 0(0) ACC - initializing

 0(0) AUTH module - initializing

textops - initializing

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) ERROR:domain_db_init: cannot initialize database connection

 0(0) init_mod(): Error while initializing module domain

ERROR: error while initializing modules.

 

For whatever reason the module is not picking up the UID and PWD from the
db_url parameters.

 

The way I fixed the problem was by changing the file my_con.c, line 68: 

 

From:

        sprintf( stringDNS, "%s%s%s", "DSN=", id->database, ";");

to:

        sprintf( stringDNS, "%s%s%s", "DSN=", id->database,
";UID=username;PWD=password;");

 

And now works fine. Also, to add debug to figure out which SQL queries fail,
I changed the file dbase.c line 77:

 

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

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openser.org/pipermail/devel/attachments/20051223/0f6aaced/attachment.htm


More information about the Devel mailing list