[Devel] unixODBC connection

Lenir lenirsantiago at yahoo.com
Wed Dec 28 09:06:32 CET 2005


Ok, I did more testing, sometimes the modules startup fine if I don't use
all numbers (ip addresses) in some of the fields of some tables (ie.
trusted, domain), or if I start or end the values with a blank space, but
its not always the same. 

 

Also, I figured out how to do a backtrace correctly, here it is:

 

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=sybasetds;UID=sa;PWD=DialerR0x;

 0(0) AVPops - initializing

 0(0) permissions - initializing

 0(0) WARNING: File not found: /usr/local/etc/openser/permissions.allow

 0(0) Default allow file (/usr/local/etc/openser/permissions.allow) not
found => empty rule set

 0(0) WARNING: File not found: /usr/local/etc/openser/permissions.deny

 0(0) Default deny file (/usr/local/etc/openser/permissions.deny) not found
=> empty rule set

Connected

Returned connection string was:

        DSN=sybasetds;UID=admin;PWD=password;

*** glibc detected *** free(): invalid pointer: 0x08ec15c8 ***

 

Program received signal SIGABRT, Aborted.

[Switching to Thread -1208084800 (LWP 7823)]

0x0017f7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2

(gdb) bt

#0  0x0017f7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2

#1  0x001bf7d5 in raise () from /lib/tls/libc.so.6

#2  0x001c1149 in abort () from /lib/tls/libc.so.6

#3  0x001f340a in __libc_message () from /lib/tls/libc.so.6

#4  0x001f9b3f in _int_free () from /lib/tls/libc.so.6

#5  0x001f9eba in free () from /lib/tls/libc.so.6

#6  0x0032b85e in tds_dstr_free (s=0x8ec15c8) at tdsstring.c:71

#7  0x0030cd5f in desc_free_record (drec=0x8ed87c0) at descriptor.c:140

#8  0x0030cf4c in desc_free_records (desc=0x8ec0f60) at descriptor.c:152

#9  0x00305704 in odbc_populate_ird (stmt=0x8ed8968) at odbc.c:2269

#10 0x003060db in _SQLFetch (stmt=0x8ed8968) at odbc.c:2649

#11 0x00306172 in SQLFetch (hstmt=0x8ed8968) at odbc.c:2777

#12 0x0052f6b6 in SQLFetch () from /usr/lib/libodbc.so.1

#13 0x00f01510 in convert_result (_h=0x8147bb8, _r=0x8147e20) at res.c:193

#14 0x00eff445 in store_result (_h=0x8147bb8, _r=0xbffe944c) at dbase.c:339

#15 0x002d5c15 in reload_trusted_table () at trusted.c:371

#16 0x002d61e8 in init_trusted () at trusted.c:125

#17 0x002d3395 in mod_init () at permissions.c:460

#18 0x08084a93 in init_mod (m=0x811da10) at sr_module.c:460

#19 0x08084a47 in init_mod (m=0x811dab0) at sr_module.c:457

#20 0x08084a47 in init_mod (m=0x811db50) at sr_module.c:457

#21 0x08084a47 in init_mod (m=0x811dbf0) at sr_module.c:457

#22 0x08084a47 in init_mod (m=0x811dc90) at sr_module.c:457

#23 0x08084a47 in init_mod (m=0x811dd30) at sr_module.c:457

#24 0x08084a47 in init_mod (m=0x811ddd0) at sr_module.c:457

#25 0x0806426d in main (argc=1, argv=0xbffe96e4) at main.c:1450

(gdb)

 

  _____  

From: Lenir [mailto:lenirsantiago at yahoo.com] 
Sent: Friday, December 23, 2005 5:03 PM
To: 'Lenir'; devel at openser.org
Subject: RE: [Devel] unixODBC connection

 

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/20051228/8ce6c84b/attachment.html


More information about the Devel mailing list