Andrew Rousseau | 15 Sep 03:44 2014

MAMP, FreeTDS, ODBC, and ssh tunnel port forwarding almost working...

I am attempting to connect with php to a remote mssql server. Since the
mssql server is behind a firewall, I am using ssh tunnel with port
forwarding to access it from my Macbook.

$ ssh -N -L 1433:<mssql_server_ip>:1433 username <at> www.example.com

The tunnel works fine as I am able to use Navicat to connect to the mssql
server and I am able to telnet to it. I think I have freetds and odbc
installed correctly and running under MAMP locally. It is only php that is
unable to connect to the server. Which leads me to believe that there is
some small piece of my configuration that is causing it to fail. I also am
thinking that the tunnel and port forwarding may be an issue for freetds.

From php I am attempting to connect the same way I am successfully
connecting on my linux production server:

$db = new PDO('odbc:Driver=FreeTDS; Server=127.0.0.1; Port=1433;
Database=db_name; UID=user; PWD=password;');

Here is the output of a tdsdump:

$ TDSDUMP=/tmp/freetds.log TDSVER=7.1 tsql -H 127.0.0.1 -p 1433
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20009 (severity 9):
Unable to connect: Adaptive Server is unavailable or does not exist
OS error 61, "Connection refused"
There was a problem connecting to the server

(Continue reading)

venkata krishna Thaluru | 10 Sep 20:12 2014
Picon

share me 64 bit latest code and TDS version

Hi All,
Could you please share me the exact link for downloading the latest source
code for 64 bit  and share steps also.

Thanks in advance .

Thanks
Venkata Krishna
Yeung, Alinga | 10 Sep 19:16 2014
Picon

Request to map Sybase status code '3604' to SQLSTATE '01000'

Hi,

We use Sybase. We are porting our software to use Freetds. We come across a status code mapping from Sybase to
Freetds that results in a behavioural discrepancy in our software. 

In src/tds/mem.c, the Sybase status code '3604' is mapped to SQLSTATUS '23000'. This is causing our
software to fail.  

Sybase status code '3604' does not require any action to be taken. Our software treats the status code as
informational/warning and does not take any action. 

SQLSTATE '23000' indicates an error instead.

Locally we have changed mem.c to map the Sybase status code '3604' to '01000' which is a general warning, and
our software works fine.

We would like to request that Sybase status code '3604' be mapped to an informational SQLSTATUS, e.g. '01000'.

Thank you.

Alinga
John Anderson | 29 Aug 18:50 2014
Picon

FreeTDS + SQL Server 2012 + UTF-16LE

Hello!  I'm wondering if you had any tips on how to work with characters
larger than 0xFFFF?  We currently have the problem where we try to
insert/update a row in the database and it gets truncated at the character
and creates an invalid syntax:

For example this character:   \U0001f44d

We've tracked this down to the fact that FreeTDS is trying to convert this
to UCS-2 rather than UTF16-LE, which is what SQL Server 2012 uses.

For example if we say:

INSERT INTO table(name) VALUES(N' Hello \U0001f44d')

We get the error:

Unclosed quotation mark after the character string 'Hello ' because it
stops processing the rest of the query.

Is there a freetds.conf or environment setting we can use to tell it to use
UTF-16LE instead of UCS2 so that we can accept these larger character sets?

As a temporary solution we've started sending the raw UTF-16LE bytes to
FreeTDS but we prefer not having to do this.

Thanks,
John
Falk Morgenroth | 28 Aug 09:28 2014
Picon
Picon

Config parameter to start DB on Sybase ASA personal server

DB: Sybase ASA 10 (Adaptive Server Anywhere) on Windows 7 
Client: Debian Wheezy, freetds, php (odbc_connect() ) 
ODBC:   unixodbc 

I can connect to the database by using unixodbc / freetds driver as long it is running. (started by a ERP
windows client app) I get all data I need with php - everything is working fine. 

Unfortunately I can not connect to the database when it was stopped by the client app. (on close of the app) 

The Sybase personal server (EngineName) is still running and is waiting to receive DatabaseName and
DatabaseFilePath to start the DB again. 
- Sybase ASA is configured for AUTOSTART. 
- Firewall does not block 
- Tests with a windows machine, ODBC and Sybase driver work - its possible to start the DB by using the ODBC
only 

I figured out that I need to submit following parameter (which are available in Windows ODBC confiuration)
when connecting: 
EngineName=MyPersonalDBServer     --> Name of the personal server (Sybase calls it personal) 
DatabaseName=MyDatabase                --> Name of the database to start 
DatabaseFile=D:\mydatabasefile.db    --> Windows Path where database file is located on the hosting
machine 

Unfortunately I can not find a solution to do this by unixodb / freetds. I tried to add above parameter to
odbc.ini but freetds.log shows that it does not know / use these parameter 

   
odbc.ini 
---------------- 

(Continue reading)

venkata krishna Thaluru | 19 Aug 17:40 2014
Picon

Unable to load the driver libtdsodbc.so

Hi All,

I am connecting to MSSQL from sybase using freetds .I m getting the below
error.
like unable to load the driver libtdsodbc.so.

i have configured the odbc.ini
Driver=/abc/libtdsodbc.so
Servername =RemoteSQLServer

freetds.conf
host = 10.20.30.40
port = 1433
tds version = 8.0

Can you please share if i am missing any configuration details .

Thanks
Venkata krishna
Nunzio Luigi Puleio | 17 Aug 22:06 2014
Picon

latest FreeTDS on Centos 6.4 and latest SQL Server DB

Hello everyone!

I have CentOS 6.4 64bit webserver and a SQL Server 2008 DB.
I communicate with SQL Server with unixODBC but looks like it's not really
performant.
So I tried to set in odbc.ini TDS_Version = 9.0 and it started to be a bit
more performant.
BUT since doing tsql -C I see TDS Version as 4.2 so I guess it isn't really
performant so I am here asking you if to be more performant shall I have to
do makefile with latest freetds sources with patrameter  --with-tdsver=
*VER *settled as 7.2 ?

Thanks in advance.
Cheers,
Luigi
Nem W Schlecht | 14 Aug 17:45 2014

ntext 8000 char limit - still there?

Hello all,
   I'm using FreeTDS with Perl and I'm trying to insert large chunks of
text into a table with an NTEXT field.  My script runs and produces no
errors, but I'm only getting 8000 chars when I call
DATALENGTH(ntextfieldname) on the SQL side.  I found a discussion on this
back from 2004 in the FreeTDS list where it said this was a limitation of
the protocol.

Is this still a limit?  What is the accepted way of getting around this
limitation and inserting large-sized values into NTEXT fields?

My test code:
#!/usr/bin/perl

#CREATE TABLE testinsert (
#   querytext NTEXT
#);

use DBI;

my  <at> srvopts;
push( <at> srvopts, "server=MyServer");
push( <at> srvopts, "database=MyDatabase");
my $srv_opts_joined=join(';',  <at> srvopts);

my $dbh = DBI->connect("dbi:Sybase:$srv_opts_joined", 'user', 'secret');

my $sth = $dbh->prepare("
    INSERT INTO testinsert
        (querytext)
(Continue reading)

Richard Hughes | 7 Aug 20:58 2014
Picon

Mangled SQL due to mis-tracking of quotes and ODBC escapes

Hi there,

I wrote a stored procedure using some of SQL Server's XML functions
and discovered that, upon trying to run the create proc statement
through a FreeTDS/unixodbc connection, the content was getting mangled
and hence rejected.

Here's a reduced test case in Python:

import pyodbc
db =
pyodbc.connect('DRIVER={FreeTDS};SERVER=198.51.100.1;PORT=1433;DATABASE=master;UID=sa;PWD=password;QuotedID=Yes;AnsiNPW=Yes', autocommit=True)
cur = db.cursor()
cur.execute('''
set quoted_identifier on
set ansi_warnings on
set ansi_padding on
set ansi_nulls on
set concat_null_yields_null on
-- This doesn't work
declare  <at> x xml = '';
declare  <at> d datetime;
set  <at> x.modify('insert attribute d {sql:variable(" <at> d")} into (/e)[1]');
''')

It looks like src/odbc/native.c:to_native() is not caring about the
comment "--" so is losing track of whether we're in a string or not.
It then concludes that {sql:variable(" <at> d")} is an ODBC escape and
transforms it into just :variable(" <at> d"), which SQL Server rejects.
This means that you can make the above test case work by simply
(Continue reading)

Frediano Ziglio | 8 Aug 13:09 2014
Picon

R: [PATCH] Preserve enough digits when converting float to char.

Commited. I had to update dataread test.

-------- Messaggio originale --------
Da: "Craig A. Berry" <craigberry <at> mac.com> 
Data: 2014/08/07  6:46 PM  (GMT+00:00) 
A: FreeTDS Development Group <freetds <at> lists.ibiblio.org> 
Oggetto: [freetds] [PATCH] Preserve enough digits when converting float to	char. 

Patch inline for easy review and also attached for easy application.

From 3bbd7d18bef4469f52c14053c8370529a6e7ec15 Mon Sep 17 00:00:00 2001
From: "Craig A. Berry" <craigberry <at> mac.com>
Date: Thu, 7 Aug 2014 12:12:22 -0500
Subject: [PATCH] Preserve enough digits when converting float to char.

The floating point standard (IEEE 754) says that in order to make
a round trip conversion from binary floating point values to
character and back again, you need to preserve 9 digits for 32-bit
floats and 17 digits for 64-bit floats in order avoid loss of
precision.

We were only preserving 7 digits for singles and 16 for doubles,
so we could experience loss of precision when making such round-trip
conversions, such as bulking out and bulking back in again.
---
src/tds/convert.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/tds/convert.c b/src/tds/convert.c
index 5b49118..2d27856 100644
(Continue reading)

Craig A. Berry | 7 Aug 19:46 2014
Picon

[PATCH] Preserve enough digits when converting float to char.

Patch inline for easy review and also attached for easy application.

From 3bbd7d18bef4469f52c14053c8370529a6e7ec15 Mon Sep 17 00:00:00 2001
From: "Craig A. Berry" <craigberry <at> mac.com>
Date: Thu, 7 Aug 2014 12:12:22 -0500
Subject: [PATCH] Preserve enough digits when converting float to char.

The floating point standard (IEEE 754) says that in order to make
a round trip conversion from binary floating point values to
character and back again, you need to preserve 9 digits for 32-bit
floats and 17 digits for 64-bit floats in order avoid loss of
precision.

We were only preserving 7 digits for singles and 16 for doubles,
so we could experience loss of precision when making such round-trip
conversions, such as bulking out and bulking back in again.
---
 src/tds/convert.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/tds/convert.c b/src/tds/convert.c
index 5b49118..2d27856 100644
--- a/src/tds/convert.c
+++ b/src/tds/convert.c
 <at>  <at>  -1525,7 +1525,7  <at>  <at>  tds_convert_real(const TDS_REAL* src, int desttype, CONV_RESULT * cr)
 	switch (desttype) {
 	case TDS_CONVERT_CHAR:
 	case CASE_ALL_CHAR:
-		sprintf(tmp_str, "%.7g", the_value);
+		sprintf(tmp_str, "%.9g", the_value);
(Continue reading)


Gmane