No Results are printed

359 views
Skip to first unread message

ravi

unread,
Oct 5, 2010, 7:40:10 AM10/5/10
to pymssql
Hello

We are trying to fetch information on ms sql server from linux box,
We have installed 1.0.2 which works fine on windows as expected.

We have installed this on linux box installation seems to work fine,
we were also able to see the results with tsql

pymssql does not seem to print the results

Here is the query

conn.execute_query('select pname as "JIRAProject",pkey as "ProjectKey"
from jira4db.jiraschema.project')
for row in conn:
print "JiraProject=%s, Key=%s" % (row['JIRAProject'],
row['ProjectKey'])

this does not seem to yield any result but freetds.log shows that it
can fetch the data.

Any help ?

Thanks
Ravi

Andrzej Kukuła

unread,
Oct 5, 2010, 8:08:33 AM10/5/10
to pym...@googlegroups.com
On Tue, Oct 5, 2010 at 13:40, ravi <ravi.venka...@gmail.com> wrote:
>
> conn.execute_query('select pname as "JIRAProject",pkey as "ProjectKey"
> from jira4db.jiraschema.project')
> for row in conn:
>    print "JiraProject=%s, Key=%s" % (row['JIRAProject'],
> row['ProjectKey'])
>
> this does not seem to yield any result but freetds.log shows that it
> can fetch the data.
>
> Any help ?

What do you get if you change the 'for' loop to:
for r in conn: print r

or the query and the 'for' loop to:
conn.execute_query('select getdate() as "currentDate"')
for r in conn: print r

Does that work?

Regards,
Andrzej

ravi

unread,
Oct 5, 2010, 8:45:24 AM10/5/10
to pymssql
Attaching the partial log

util.c:156:Changed query state from IDLE to QUERYING
write.c:140:tds_put_string converting 33 bytes of "select getdate() as
"currentDate""
write.c:168:tds_put_string wrote 66 bytes
util.c:156:Changed query state from QUERYING to PENDING
net.c:730:Sending packet
0000 01 01 00 4a 00 00 01 00-73 00 65 00 6c 00 65 00 |...J....
s.e.l.e.|
0010 63 00 74 00 20 00 67 00-65 00 74 00 64 00 61 00 |c.t. .g.
e.t.d.a.|
0020 74 00 65 00 28 00 29 00-20 00 61 00 73 00 20 00 |t.e.
(.). .a.s. .|
0030 22 00 63 00 75 00 72 00-72 00 65 00 6e 00 74 00 |".c.u.r.
r.e.n.t.|
0040 44 00 61 00 74 00 65 00-22 00 |D.a.t.e. ".|

dblib.c:4611:dbsqlok(0x9a640f0)
dblib.c:4641:dbsqlok() not done, calling tds_process_tokens()
token.c:539:tds_process_tokens(0x9a51350, 0xbff1c168, 0xbff1c164,
0x6914)
util.c:156:Changed query state from PENDING to READING
net.c:546:Received header
0000 04 01 00 39 00 58 01 00- |...9.X..|

net.c:600:Received packet
0000 04 01 00 39 00 58 01 00-81 01 00 00 00 20 00 3d |...
9.X.. ..... .=|
0010 0b 63 00 75 00 72 00 72-00 65 00 6e 00 74 00 44
|.c.u.r.r .e.n.t.D|
0020 00 61 00 74 00 65 00 d1-06 9e 00 00 3b 66 7e 00
|.a.t.e.. ....;f~.|
0030 fd 10 00 c1 00 01 00 00-00 |........ .|

token.c:554:processing result tokens. marker is 81(TDS7_RESULT)
token.c:1571:processing TDS7 result metadata.
mem.c:615:tds_free_all_results()
token.c:1596:set current_results (1 column) to tds->res_info
token.c:1603:setting up 1 columns
token.c:1542:tds7_get_data_info:
colname = currentDate (11 bytes)
type = 61 (datetime)
server's type = 61 (datetime)
column_varint_size = 0
column_size = 8 (8 on server)
token.c:1612: name size/wsize type/wtype
utype
token.c:1613: -------------------- --------------- ---------------
-------
token.c:1623: currentDate 8/8
61/61 0
util.c:156:Changed query state from READING to PENDING
dblib.c:4672:dbsqlok() found result token
dblib.c:1791:dbnumcols(0x9a640f0)
dblib.c:2733:dbcount(0x9a640f0)


Still no results are printed.


On Oct 5, 8:08 am, Andrzej Kukuła <akuk...@gmail.com> wrote:

Andrzej Kukuła

unread,
Oct 5, 2010, 8:47:45 AM10/5/10
to pym...@googlegroups.com
On Tue, Oct 5, 2010 at 14:45, ravi <ravi.venka...@gmail.com> wrote:
> Attaching the partial log

> Still no results are printed.

What freetds.conf settings are in effect?

Regards,
Andrzej

ravi

unread,
Oct 5, 2010, 9:02:01 AM10/5/10
to pymssql
Attaching the config file

# $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $
#
# This file is installed by FreeTDS if no file by the same
# name is found in the installation directory.
#
# For information about the layout of this file and its settings,
# see the freetds.conf manpage "man freetds.conf".

# Global settings are overridden by those in a database
# server specific section
[global]
# TDS protocol version
tds version = 7.0

# Whether to write a TDSDUMP file for diagnostic purposes
# (setting this to /tmp is insecure on a multi-user system)
; dump file = /tmp/freetds.log
; debug flags = 0xffff

# Command and connection timeouts
; timeout = 10
; connect timeout = 10

# If you get out-of-memory errors, it may mean that your
client
# is trying to allocate a huge buffer for a TEXT field.
# Try setting 'text size' to a more reasonable limit
text size = 64512

# A typical Microsoft server
[sqlserver]
host = vatlwasdb.atldev.com
port = 1433
tds version = 7.0


tsql -C
Compile-time settings (established with the "configure" script)
Version: freetds v0.83.dev.20101002
freetds.conf directory: /usr/local/freetds/etc
MS db-lib source compatibility: yes
Sybase binary compatibility: no
Thread safety: yes
iconv library: yes
TDS version: 7.0
iODBC: no
unixodbc: no


tsql info

[root@vlsubvspd bin]# tsql -S vatlwasdb.atldev.com -U readonly
Password:
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
1> select count(*) from jira4db.jiraschema.project
2> go

140
(1 row affected)
1>

1> select getdate() as "currentDate"
2> go
currentDate
Oct 5 2010 08:01:35:490AM
(1 row affected)

Thanks
Ravi

On Oct 5, 8:47 am, Andrzej Kukuła <akuk...@gmail.com> wrote:

Andrzej Kukuła

unread,
Oct 5, 2010, 9:13:30 AM10/5/10
to pym...@googlegroups.com
2010/10/5 ravi <ravi.venka...@gmail.com>:
> Attaching the  config file

Everything looks perfect. Unless there's incompatibility between this
new freetds you use and pymssql. I tested various versions up to, and
including, 0.82, but not this fresh dev build. Here are my settings:


Compile-time settings (established with the "configure" script)

Version: freetds v0.82
freetds.conf directory: /etc
MS db-lib source compatibility: no


Sybase binary compatibility: no
Thread safety: yes
iconv library: yes
TDS version: 7.0
iODBC: no

unixodbc: yes

Are you able to downgrade freetds to 0.82 stable and test if then
those queries are ok?

Regards,
Andrzej

ravi

unread,
Oct 5, 2010, 11:36:26 AM10/5/10
to pymssql
I have downgraded to freetds v0.82RC4 which seems to do the trick

Thanks for your support and time
Ravi

On Oct 5, 9:13 am, Andrzej Kukuła <akuk...@gmail.com> wrote:
> 2010/10/5 ravi <ravi.venkatasubba...@gmail.com>:

Andrzej Kukuła

unread,
Oct 5, 2010, 1:06:37 PM10/5/10
to pym...@googlegroups.com
On Tue, Oct 5, 2010 at 17:36, ravi <ravi.venka...@gmail.com> wrote:
> I have downgraded to freetds v0.82RC4  which seems to do the trick
>
> Thanks for your support and time

Thanks for your feedback, I'll look what changed and what can possibly
be wrong in pymssql.

Regards
Andrzej

Reply all
Reply to author
Forward
0 new messages