Skip to Content.
Sympa Menu

freetds - [freetds] Nearly there connecting to ASA8 - but need final bit of help

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Alex Lake <alex AT digitalmail.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] Nearly there connecting to ASA8 - but need final bit of help
  • Date: Thu, 15 Dec 2011 11:40:40 +0000

Trying to connect to an ASA8 DB from an Ubuntu machine using FreeTDS.

After a bit of faffing around (and discovering that the FreeTDS heading is the DATABASE name, not the server name) I can connect with the isql commandline utility.

My files:

------- /etc/odbcinst.ini ----------------------------------------------------------------------
[FreeTDS]
Description = TDS driver (Sybase/MS SQL)
Driver = /usr/lib/odbc/libtdsodbc.so
Setup = /usr/lib/odbc/libtdsS.so
CPTimeout =
CPReuse =
UsageCount = 2
------- /etc/odbc.ini --------------------------------------------------------------------------
[bh2_m7003]
Driver = FreeTDS
Servername = bh2_m7003
Port = 2638
TDS_version = 4.2
------- /etc/freetds/freetds.conf --------------------------------------------------------------
[global]
# TDS protocol version
; tds version = 4.2

# 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

[bh2_m7003]
host = 192.168.1.90
port = 2638
tds version = 4.2
textsize = 64512
-----------------------------------------------------------------------------------------------

Now when I do:
isql bh2_m7003 dba <password>

I get:

+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>

Which is encouraging, but if I enter the SQL command "select 0", I get an error "SQLRowCount returns -1"

If I say "help" then I do get a list of tables
If I say "help <tablename>" then I get the table definition

Furthermore, in PHP, I'm doing this:

$dbh = new PDO($dbConfig['db_dsn'],$dbConfig['db_user'],$dbConfig['db_password']);
$sql="SELECT 0;";
$x = $dbh->prepare($sql,array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
$x->execute();
if ($x->errorCode()==0) {
while ($row = $x->fetch(PDO::FETCH_ORI_NEXT, PDO::FETCH_ASSOC)) {
echo "data=".$row[0];
}
}

And it connects, but is similarly unable to access the data

When I look at the DBServer console, the connection information suggests that I'm using CT-Library (which I believe is some Sybase-specific alternative to odbc) which is slightly unusual

I feel I'm nearly there, but that's not good enough!

Any ideas?




Archive powered by MHonArc 2.6.24.

Top of Page