From: Marcos P. <msa...@gr...> - 2003-01-24 11:24:25
|
Hello there. I am getting Sybase.Error: ct_options when connecting to MSSQL or Sybase. If I comment out the CS_OPT_CHAINXACTS line, it seems to work for simple selects. tsql from freetds, today's version works fine, so I suppose my freetds.conf file is right. What is the next place to look? I get the following when connecting to MSSQL2000: marcos@cynar:~/sybase-0.36pre3$ python -c "import Sybase;Sybase._ctx.debug =3D 1;Sybase.connect('cazalla','sa','xxx')" ct_con_alloc(ctx0, &conn) -> CS_SUCCEED, conn0 ct_con_props(conn0, CS_SET, CS_USERNAME, "sa", CS_NULLTERM, NULL) -> CS_SUCCEED ct_con_props(conn0, CS_SET, CS_PASSWORD, "xxx", CS_NULLTERM, NULL) -> CS_SUCCEED servermsg_cb servermsg_cb ct_connect(conn0, "cazalla", CS_NULLTERM) -> CS_SUCCEED ct_options(conn0, CS_SET, CS_OPT_CHAINXACTS, 1, CS_UNUSED, NULL) -> CS_FAIL ct_cancel(conn0, NULL, CS_CANCEL_ALL) -> CS_SUCCEED Traceback (most recent call last): File "<string>", line 1, in ? File "Sybase.py", line 768, in connect strip, auto_commit, delay_connect, locking) File "Sybase.py", line 608, in __init__ self.connect() File "Sybase.py", line 633, in connect self._raise_error(Error, 'ct_options') File "Sybase.py", line 621, in _raise_error raise exc(text) Sybase.Error: ct_options ct_con_props(conn0, CS_GET, CS_CON_STATUS, &value, CS_UNUSED, NULL) -> CS_SUCCEED, CS_CONSTAT_CONNECTED ct_close(conn0, CS_OPT_STATS_IO) -> CS_SUCCEED ct_con_drop(conn0) -> CS_SUCCEED I have this freetds.log Starting log file with debug level 99. 2003-01-23 17:20:51.977855 iconv will convert client-side data to the "" character set 2003-01-23 17:20:52.000075 Connecting addr 192.168.222.235 port 1433 with TDS version 8.0 2003-01-23 17:20:52.062367 inside tds_process_login_tokens() Received header @ 2003-01-23 17:20:52.067664 0000 04 01 01 8d 00 34 01 00 |.....4..| Received packet @ 2003-01-23 17:20:52.067873 0000 e3 1b 00 01 06 6d 00 61 00 73 00 74 00 65 00 72 |.....m.a .s.t.e.r| 0010 00 06 6d 00 61 00 73 00 74 00 65 00 72 00 ab 7c |..m.a.s. t.e.r..|| 0020 00 45 16 00 00 02 00 31 00 43 00 61 00 6d 00 62 |.E.....1 .C.a.m.b| 0030 00 69 00 61 00 64 00 6f 00 20 00 65 00 6c 00 20 |.i.a.d.o . .e.l. | 0040 00 63 00 6f 00 6e 00 74 00 65 00 78 00 74 00 6f |.c.o.n.t .e.x.t.o| 0050 00 20 00 64 00 65 00 20 00 62 00 61 00 73 00 65 |. .d.e.=20 .b.a.s.e| 0060 00 20 00 64 00 65 00 20 00 64 00 61 00 74 00 6f |. .d.e.=20 .d.a.t.o| 0070 00 73 00 20 00 61 00 20 00 27 00 6d 00 61 00 73 |.s. .a.=20 .'.m.a.s| 0080 00 74 00 65 00 72 00 27 00 2e 00 07 43 00 41 00 |.t.e.r.' ....C.A.| 0090 5a 00 41 00 4c 00 4c 00 41 00 00 00 00 e3 08 00 |Z.A.L.L. A.......| 00a0 07 05 0a 0c d0 00 00 00 e3 17 00 02 0a 75 00 73 |........ .....u.s| 00b0 00 5f 00 65 00 6e 00 67 00 6c 00 69 00 73 00 68 |._.e.n.g .l.i.s.h| 00c0 00 00 ab 68 00 47 16 00 00 01 00 27 00 43 00 68 |...h.G.. ...'.C.h| 00d0 00 61 00 6e 00 67 00 65 00 64 00 20 00 6c 00 61 |.a.n.g.e .d. .l.a| 00e0 00 6e 00 67 00 75 00 61 00 67 00 65 00 20 00 73 |.n.g.u.a .g.e. .s| 00f0 00 65 00 74 00 74 00 69 00 6e 00 67 00 20 00 74 |.e.t.t.i .n.g. .t| 0100 00 6f 00 20 00 75 00 73 00 5f 00 65 00 6e 00 67 |.o. .u.s ._.e.n.g| 0110 00 6c 00 69 00 73 00 68 00 2e 00 07 43 00 41 00 |.l.i.s.h ....C.A.| 0120 5a 00 41 00 4c 00 4c 00 41 00 00 00 00 ad 36 00 |Z.A.L.L. A.....6.| 0130 01 07 01 00 00 16 4d 00 69 00 63 00 72 00 6f 00 |......M. i.c.r.o.| 0140 73 00 6f 00 66 00 74 00 20 00 53 00 51 00 4c 00 |s.o.f.t.=20 .S.Q.L.| 0150 20 00 53 00 65 00 72 00 76 00 65 00 72 00 00 00 | .S.e.r. v.e.r...| 0160 00 00 08 00 00 c2 e3 13 00 04 04 34 00 30 00 39 |........ ...4.0.9| 0170 00 36 00 04 34 00 30 00 39 00 36 00 fd 00 00 00 |.6..4.0. 9.6.....| 0180 00 00 00 00 00 |.....| 2003-01-23 17:20:52.068976 inside tds_process_default_tokens() marker is e3(ENVCHANGE) 2003-01-23 17:20:52.069084 inside tds_process_default_tokens() marker is ab(INFO) 2003-01-23 17:20:52.069333 inside tds_process_default_tokens() marker is e3(ENVCHANGE) 2003-01-23 17:20:52.069417 inside tds_process_default_tokens() marker is e3(ENVCHANGE) 2003-01-23 17:20:52.069502 inside tds_process_default_tokens() marker is ab(INFO) 2003-01-23 17:20:52.069796 inside tds_process_default_tokens() marker is e3(ENVCHANGE) 2003-01-23 17:20:52.069890 increasing block size from 4096 to 4096 2003-01-23 17:20:52.069990 inside tds_process_default_tokens() marker is fd(DONE) 2003-01-23 17:20:52.070071 inside tds_process_end() more_results =3D 0, was_cancelled =3D 0=20 2003-01-23 17:20:52.070156 inside tds_process_default_tokens() setting state to COMPLETED Sending packet @ 2003-01-23 17:20:52.070276 0000 01 01 00 22 00 00 01 00 73 00 65 00 6c 00 65 00 |...".... s.e.l.e.| 0010 63 00 74 00 20 00 40 00 40 00 73 00 70 00 69 00 |c.t. .@. @.s.p.i.| 0020 64 00 |d.| Received header @ 2003-01-23 17:20:52.078838 0000 04 01 00 1d 00 34 01 00 |.....4..| Received packet @ 2003-01-23 17:20:52.079068 0000 81 01 00 00 00 00 00 34 00 d1 34 00 fd 10 00 c1 |.......4 ..4.....| 0010 00 01 00 00 00 |.....| 2003-01-23 17:20:52.079179 processing result tokens. marker is=20 81(TDS7_RESULT) 2003-01-23 17:20:52.079291 tds7_get_data_info:1089:=20 type =3D 52 (smallint) column_varint_size =3D 0 colname =3D=20 colnamelen =3D 0 2003-01-23 17:20:52.079407 processing row tokens. marker is d1(ROW) 2003-01-23 17:20:52.079478 processing row. column is 0 varint size =3D 0 2003-01-23 17:20:52.079611 processing row. column size is 2=20 2003-01-23 17:20:52.079678 clearing column 0 NULL bit 2003-01-23 17:20:52.079738 processing row tokens. marker is fd(DONE) 2003-01-23 17:20:52.079808 inside tds_process_end() more_results =3D 0, was_cancelled =3D 0=20 2003-01-23 17:20:52.079976 inside tds_process_result_tokens() state is COMPLETED 2003-01-23 17:20:52.080054 leaving tds_process_login_tokens() returning 1 2003-01-23 17:20:52.080143 leaving ct_connect() returning 1 2003-01-23 17:20:52.080385 inside ct_options() action =3D CS_GET option =3D 7 2003-01-23 17:20:52.080544 inside ct_cancel() Sending packet @ 2003-01-23 17:20:52.080615 0000 06 01 00 08 00 00 01 00 |........| Received header @ 2003-01-23 17:20:52.082576 0000 04 01 00 11 00 34 01 00 |.....4..| Received packet @ 2003-01-23 17:20:52.082852 0000 fd 20 00 fd 00 00 00 00 00 |. ...... .| 2003-01-23 17:20:52.082930 inside tds_process_end() more_results =3D 0, was_cancelled =3D 1=20 2003-01-23 17:20:52.088732 inside ct_con_props() action =3D CS_GET property =3D 26 2003-01-23 17:20:52.088965 inside ct_close() 2003-01-23 17:20:52.089404 inside ct_con_drop() --=20 gpg --recv-keys --keyserver wwwkeys.pgp.net B9AD9B1B |
From: Marcos P. <ra...@ar...> - 2003-01-24 11:09:45
|
Hello there. I am getting Sybase.Error: ct_options when connecting to MSSQL or Sybase. If I comment out the CS_OPT_CHAINXACTS line, it seems to work for simple selects. tsql from freetds, today's version works fine, so I suppose my freetds.conf file is right. What is the next place to look? I get the following when connecting to MSSQL2000: marcos@cynar:~/sybase-0.36pre3$ python -c "import Sybase;Sybase._ctx.debug = 1;Sybase.connect('cazalla','sa','xxx')" ct_con_alloc(ctx0, &conn) -> CS_SUCCEED, conn0 ct_con_props(conn0, CS_SET, CS_USERNAME, "sa", CS_NULLTERM, NULL) -> CS_SUCCEED ct_con_props(conn0, CS_SET, CS_PASSWORD, "xxx", CS_NULLTERM, NULL) -> CS_SUCCEED servermsg_cb servermsg_cb ct_connect(conn0, "cazalla", CS_NULLTERM) -> CS_SUCCEED ct_options(conn0, CS_SET, CS_OPT_CHAINXACTS, 1, CS_UNUSED, NULL) -> CS_FAIL ct_cancel(conn0, NULL, CS_CANCEL_ALL) -> CS_SUCCEED Traceback (most recent call last): File "<string>", line 1, in ? File "Sybase.py", line 768, in connect strip, auto_commit, delay_connect, locking) File "Sybase.py", line 608, in __init__ self.connect() File "Sybase.py", line 633, in connect self._raise_error(Error, 'ct_options') File "Sybase.py", line 621, in _raise_error raise exc(text) Sybase.Error: ct_options ct_con_props(conn0, CS_GET, CS_CON_STATUS, &value, CS_UNUSED, NULL) -> CS_SUCCEED, CS_CONSTAT_CONNECTED ct_close(conn0, CS_OPT_STATS_IO) -> CS_SUCCEED ct_con_drop(conn0) -> CS_SUCCEED -- Marcos Sánchez Provencio <ra...@ar...> |
From: Dave C. <dj...@ob...> - 2003-01-24 20:16:07
|
> I am getting Sybase.Error: ct_options when connecting to MSSQL or > Sybase. If I comment out the CS_OPT_CHAINXACTS line, it seems to > work for simple selects. tsql from freetds, today's version works > fine, so I suppose my freetds.conf file is right. What is the next > place to look? The CS_OPT_CHAINXACTS option is there to conform to the DB-API specification http://www.python.org/topics/database/DatabaseAPI-2.0.html Connection Objects commit() Commit any pending transaction to the database. Note that if the database supports an auto-commit feature, this must be initially off. An interface method may be provided to turn it back on. Database modules that do not support transactions should implement this method with void functionality. I probably should silently ignore problems setting this option... > I get the following when connecting to MSSQL2000: > > marcos@cynar:~/sybase-0.36pre3$ python -c "import > Sybase;Sybase._ctx.debug = 1;Sybase.connect('cazalla','sa','xxx')" > ct_con_alloc(ctx0, &conn) -> CS_SUCCEED, conn0 > ct_con_props(conn0, CS_SET, CS_USERNAME, "sa", CS_NULLTERM, NULL) -> > CS_SUCCEED > ct_con_props(conn0, CS_SET, CS_PASSWORD, "xxx", CS_NULLTERM, NULL) -> > CS_SUCCEED > servermsg_cb > servermsg_cb > ct_connect(conn0, "cazalla", CS_NULLTERM) -> CS_SUCCEED > ct_options(conn0, CS_SET, CS_OPT_CHAINXACTS, 1, CS_UNUSED, NULL) -> > CS_FAIL > ct_cancel(conn0, NULL, CS_CANCEL_ALL) -> CS_SUCCEED > Traceback (most recent call last): > File "<string>", line 1, in ? > File "Sybase.py", line 768, in connect > strip, auto_commit, delay_connect, locking) > File "Sybase.py", line 608, in __init__ > self.connect() > File "Sybase.py", line 633, in connect > self._raise_error(Error, 'ct_options') > File "Sybase.py", line 621, in _raise_error > raise exc(text) > Sybase.Error: ct_options > ct_con_props(conn0, CS_GET, CS_CON_STATUS, &value, CS_UNUSED, NULL) -> > CS_SUCCEED, CS_CONSTAT_CONNECTED > ct_close(conn0, CS_OPT_STATS_IO) -> CS_SUCCEED > ct_con_drop(conn0) -> CS_SUCCEED Can you try this patch (to 0.36pre3) for me (contains changes for Valerie R. Coffman as well)? - Dave --- Sybase.py 23 Jan 2003 10:11:02 -0000 1.56 +++ Sybase.py 24 Jan 2003 01:13:55 -0000 @@ -158,6 +158,8 @@ fmt.count = count if fmt.datatype == CS_VARBINARY_TYPE: fmt.datatype = CS_BINARY_TYPE + if fmt.maxlngth > 65536: + fmx.maxlength = 65536 status, buf = cmd.ct_bind(i + 1, fmt) if status != CS_SUCCEED: raise Error('ct_bind') @@ -629,8 +631,7 @@ self._raise_error(Error, 'ct_connect') self._is_connected = 1 status = conn.ct_options(CS_SET, CS_OPT_CHAINXACTS, not self.auto_commit) - if status != CS_SUCCEED: - self._raise_error(Error, 'ct_options') + self.auto_commit = (status != SUCCEED) finally: self._unlock() if self.database: -- http://www.object-craft.com.au |
From: Marcos P. <ra...@ar...> - 2003-01-25 06:32:52
|
First, thank you for the module in general and for the fast answer in particular. I suppose you meant - if status != CS_SUCCEED: - self._raise_error(Error, 'ct_options') + self.auto_commit = (status != CS_SUCCEED) ^^^^^^ Well, now it connects alright, but I don't get auto-commit off, do I? I do want standard dbapi behavior. Would it be ok to just execute c.execute('set implicit_transactions on') on the connection? El vie, 24-01-2003 a las 02:16, Dave Cole escribió: > > I am getting Sybase.Error: ct_options when connecting to MSSQL or > > Sybase. If I comment out the CS_OPT_CHAINXACTS line, it seems to > > work for simple selects. tsql from freetds, today's version works > > fine, so I suppose my freetds.conf file is right. What is the next > > place to look? > > The CS_OPT_CHAINXACTS option is there to conform to the DB-API > specification > > http://www.python.org/topics/database/DatabaseAPI-2.0.html > > Connection Objects > commit() > > Commit any pending transaction to the database. Note that if the > database supports an auto-commit feature, this must be initially > off. An interface method may be provided to turn it back on. > > Database modules that do not support transactions should > implement this method with void functionality. > > I probably should silently ignore problems setting this option... > > > I get the following when connecting to MSSQL2000: > > > > marcos@cynar:~/sybase-0.36pre3$ python -c "import > > Sybase;Sybase._ctx.debug = 1;Sybase.connect('cazalla','sa','xxx')" > > ct_con_alloc(ctx0, &conn) -> CS_SUCCEED, conn0 > > ct_con_props(conn0, CS_SET, CS_USERNAME, "sa", CS_NULLTERM, NULL) -> > > CS_SUCCEED > > ct_con_props(conn0, CS_SET, CS_PASSWORD, "xxx", CS_NULLTERM, NULL) -> > > CS_SUCCEED > > servermsg_cb > > servermsg_cb > > ct_connect(conn0, "cazalla", CS_NULLTERM) -> CS_SUCCEED > > ct_options(conn0, CS_SET, CS_OPT_CHAINXACTS, 1, CS_UNUSED, NULL) -> > > CS_FAIL > > ct_cancel(conn0, NULL, CS_CANCEL_ALL) -> CS_SUCCEED > > Traceback (most recent call last): > > File "<string>", line 1, in ? > > File "Sybase.py", line 768, in connect > > strip, auto_commit, delay_connect, locking) > > File "Sybase.py", line 608, in __init__ > > self.connect() > > File "Sybase.py", line 633, in connect > > self._raise_error(Error, 'ct_options') > > File "Sybase.py", line 621, in _raise_error > > raise exc(text) > > Sybase.Error: ct_options > > ct_con_props(conn0, CS_GET, CS_CON_STATUS, &value, CS_UNUSED, NULL) -> > > CS_SUCCEED, CS_CONSTAT_CONNECTED > > ct_close(conn0, CS_OPT_STATS_IO) -> CS_SUCCEED > > ct_con_drop(conn0) -> CS_SUCCEED > > Can you try this patch (to 0.36pre3) for me (contains changes for > Valerie R. Coffman as well)? > > - Dave > > -- Sybase.py 23 Jan 2003 10:11:02 -0000 1.56 > +++ Sybase.py 24 Jan 2003 01:13:55 -0000 > > @@ -158,6 +158,8 @@ > fmt.count = count > if fmt.datatype == CS_VARBINARY_TYPE: > fmt.datatype = CS_BINARY_TYPE > + if fmt.maxlngth > 65536: > + fmx.maxlength = 65536 > status, buf = cmd.ct_bind(i + 1, fmt) > if status != CS_SUCCEED: > raise Error('ct_bind') > @@ -629,8 +631,7 @@ > self._raise_error(Error, 'ct_connect') > self._is_connected = 1 > status = conn.ct_options(CS_SET, CS_OPT_CHAINXACTS, not self.auto_commit) > - if status != CS_SUCCEED: > - self._raise_error(Error, 'ct_options') > + self.auto_commit = (status != SUCCEED) > finally: > self._unlock() > if self.database: -- Marcos Sánchez Provencio <ra...@ar...> |
From: Dave C. <dj...@ob...> - 2003-01-25 08:11:27
|
> First, thank you for the module in general and for the fast answer > in particular. > > I suppose you meant > - if status != CS_SUCCEED: > - self._raise_error(Error, 'ct_options') > + self.auto_commit = (status != CS_SUCCEED) > ^^^^^^ > > Well, now it connects alright, but I don't get auto-commit off, do > I? I do want standard dbapi behavior. > > Would it be ok to just execute > c.execute('set implicit_transactions on') on the connection? Does anyone know if there is a standard way to disable auto commit on both Sybase and SQL Server? - Dave -- http://www.object-craft.com.au |