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)

venkata krishna Thaluru | 13 Jul 07:52 2014
Picon

Unclosed quotation mark

Hi All,
I am exporting data to MSSQL server and getting below error.

ODBC error (42000). [FreeTDS][SQL Server]Unclosed quotation mark after the
character string ' test

Could you please share your thoughts and ideas to resolve it or any know
issue in freeTDS ,please share it.

Thanks
Venkata Krishna
9600185503
Matevž Mrak | 11 Jul 08:31 2014
Picon

[unixODBC][Driver Manager]Function sequence error

I am using mxODBC with unixODBC and FreeTDS driver 8.0 on OSX to connect
MSSQL Server 2008 R2 on other Windows machine in network.

I can connect with python and execute queries but when creating database
with script I am getting this error:

InterfaceError: ('HY010', 0, '[unixODBC][Driver Manager]Function
sequence error', 5258)
 - File "/Users/matevzmrak/Desktop/praksa_fajli/projekt/ana/ana/srv/orm/driver.py",
line 101, in execute[0m[31m15:28:59.787 0.0.0.0 {unknown} - Query to
execute: sp_pkeys 'Currencies' - File
"/Users/matevzmrak/Desktop/praksa_fajli/projekt/ana/ana/srv/orm/driver.py",
line 102, in execute

at this qry:

http://shrani.si/f/30/P8/3E6CUA0m/screen-shot-2014-07-10-a.png

*freetds.conf:*

[DSNmy]
host = 10.13.7.248
port = 1433
tds version = 8.0
client charset = UTF-8

*odbc.ini:*

[ODBC Data Sources]
DSNmy    = mysqlDriver
(Continue reading)

Ola Karlsson | 6 Jul 15:32 2014
Picon

Problem with nvarchar output

Hi
I'm using Freetds with PHP5 to access a SQL server but I'm having trouble with the output parameters.
I have two parameters, one SQLINT4 and one SQLVARCHAR. The int is working but I don't get any returns from the varchar.

Is there anything special that needs to be done when outputting nvarchar?

PHP binds,
mssql_bind($stmt, ' <at> ErrorMsg',$ErrorMsg,SQLVARCHAR,true,false,4000);
mssql_bind($stmt, ' <at> OrderNr',$OrderNr,SQLINT4,true,true,8);

SQL parameters,
 <at> ErrorMsg nvarchar(4000) output
 <at> OrderNr Jeeves_OrderNo output

Sql server,
SQL Server 2008 R2

Freetds server,
Ubuntu 12.04 3.5.0-51-generic

Tsql -C
Version: freetds v0.91
freetds.conf directory: /etc/freetds
MS db-lib source compatibility: no
Sybase binary compatibility: yes
Thread safety: yes
iconv library: yes
TDS version: 4.2
iODBC: no
unixodbc: yes
(Continue reading)


Gmane