Frediano Ziglio | 23 Mar 19:55 2015
Picon

New release is getting ready

Hi,
   although there is no dates planned nor any release
candidate/beta/alpha/whatever my TODO list for the release is getting
shorter! As somebody would have noted I mostly updated documentation
to reflect changes.

The only big point left is SSL certificate check (there are no code at
all although I'll have a look at curl implementation and there are
explanation on how to test). I want this in the release as it is a no
back compatible change so is better to have in a release.

Any help or test is really appreciated.

Frediano
Daniel Fazekas | 21 Mar 06:33 2015
Picon

UTF-16 support

I'm testing the recently committed UTF-16 support.

I believe this line in src/tds/config.c's tds_config_login() is wrong:
connection->use_utf16 = login->use_utf16;

It only ends up turning off the UTF-16 support you asked for in the configuration files, which previously
got read into the "connection" structure, with a zero from the "login" structure. So the "use utf-16 = yes"
line from freetds.conf gets overwritten and ignored.
Simply removing the line works, or wrapping it like all the other boolean options:
if (login->use_utf16) {
	connection->use_utf16 = login->use_utf16;
}

Then everything appears to work fine with dblib and ctlib.
Jeffrey Shaw | 20 Mar 16:05 2015
Picon

dblib either truncates nvarchar, or makes NULLs empty strings

Hello,
I am having two problems. If I set the tds version to 7.1, empty strings
are selected as NULL.

If I set the tds version to something else, strings longer than 255
characters are truncated.

My guess is that in the case of tds version 7.1, types marked with * at
http://www.freetds.org/tds.html#types are using "size == 0" when checking
for null, rather than the correct "size == -1". "size == 0" is an empty
string, whereas "size == -1" is NULL.

It isn't clear to me where in the source this check is happening, so I'm
applying here for help.

I've tried CentOS 7's FreeTDS .91 and also freetds-dev-0.92.965.

Thanks,
Jeff
David Horman | 19 Mar 16:47 2015

Occasional "Query failed" with LAMP to MSSQL 2000 server on intensive queries

Hi,

Apologies in advance if this is a bit vague - I'm not expecting anyone
to be able to figure out what's going on from the following description,
I'm really looking more for advice on how to investigate further.

For the last few years I've been happily using FreeTDS to query an
ageing SQL Server 2000 server using PHP scripts running on a Centos 6
server. Recently, though, the amount of data I've been working with, and
the number of complex queries, has increased to the point where I
sometimes see long-running, intensive queries failing after
approximately (but this is not a firm measurement) a minute with the
following output:

PHP Warning:  mssql_query(): Query failed in [script_name] on line 131

Warning: mssql_query(): Query failed in [script_name] on line 131

Then, it seems, any further queries attempted shortly after in the same
script fail with, for example:

Warning: mssql_query(): Unable to set query in [script_name] on line 162

PHP Warning:  mssql_query(): Unable to set query in [script_name] on
line 162

This seems to occur more often if the server is particularly busy, such
that I have tried to carefully time my cronjobs not to overlap at night.
I've never seen a large query fail when I run it directly in SQL Server
Management Studio Express.
(Continue reading)

Ajmer Dhariwal | 17 Mar 13:40 2015

freebcp failing silently with format file that (tries to) remove double quotes

I have an input csv file that has every column quoted in double quotes ("").
I have simplified the problem down to a two row csv file.
There are 4 columns and two are empty.
I am using the format file to strip out the quotes by specifying the quotes
as separators and I just can't get it to work - it fails silently with no
output or errors
The format file works fine
I then decided to copy the format file to my Windows 7 desktop and tried
the exact same thing via bcp and it worked fine - the data hit the target
table with the quotes stripped. Obviously, they're using completely
different mechanisms but I would have expected the format files to behave
similarly.
In my own experimentation I can change the separator and make the
corresponding changes to the format file and it works fine but I was
wondering if anyone had tackled a similar issue because I cannot change the
quoting in some of the input files.

I'm escaping the quotes via \"

Format file and sample csv with dummy data are attached.
Data is being exported from the 4 col csv file into a simple two col table
consisting of nvarchar(30) and nvarchar(80) respectively (SQL Server 2012).

freebcp version $Id: freebcp.c,v 1.59 2011/03/13 21:32:49 jklowden Exp $

Keep up the good work by the way - freetds and freebcp are lifesavers!

Thanks,
Ajmer

(Continue reading)

Alistair Roberts | 17 Mar 02:51 2015
Picon

SQL Server Availability Groups

Hi,

Does FreeTDS support SQL 2014 Availability Groups?

We are looking at migrating from SQL 2008 to SQL 2014 and then use
Availability Groups for the databases.

Ideally we are looking at using a sole IP but we may need to go with the
multi-subnet approach for the AG listener.

Are there any compatibility issues with FreeTDS and SQL 2014?

Regards

Alistair Roberts
Velichko Yuriy | 13 Mar 15:09 2015
Picon

How to connect via windows authentication?

Hello!

I can't figure out how to connect to SQL Server via windows auth using
fretds library (dblib).

In examples is shown how to connect via the SQL authentication.

Is there example for windows auth.
Should I change conf file, or set specific info to the LOGINREC for
dbopen() ?
Richard Hughes | 12 Mar 20:36 2015
Picon

ODBC bcp

Hi all,

I wanted to be able to bulk copy into SQL Server from an ODBC
application, so attached is my *work in progress* attempt at making
this happen, for the purpose of early feedback about the approach.

The only other attempt I can find at doing this was [0], which seemed
extremely hacky and may have required significant code in the user
application. My attempt tries to do it 'properly' and I've been
testing it with an application which builds unaltered on both Windows
and Linux.

The patch steals a large amount of code from dblib/bcp.c but, in
order to give myself an achievable goal, it implements *only* bcp in
from RAM; all of the file I/O stuff has been ripped out. I believe
this is a very sane and useful subset to have because my application
does the bcp as one step of a single larger transaction and hence
needs to use the existing ODBC connection. People wanting the file I/O
bit probably don't have this constraint and hence can just use dblib
or freebcp.

A very useful document is [1] which lists the API differences from
dblib. The most annoying is probably that all errors must go through
SQLGetDiagRec rather than dblib's error handling, which is what
necessitated so much copy-and-paste. A future task is to look at how
this could be rationalized.

The HDBC problem should be discussed. Because the driver manager has
no idea about the bcp APIs, the first parameter that all the functions
receive is a driver manager HDBC, not a TDS_DBC*.
(Continue reading)

subhendu.ray | 10 Mar 14:43 2015

Re: setting the default database ("asa database")

Hi Frediano,

Please find the requested details below.

Context:
As per the freetds.conf<http://www.freetds.org/userguide/freetdsconf.htm> documentation, 'ASA
database' should set up the default database when connected to the database server instance.
ASA database    valid database name     servername [section] name       Specifies the name of the default database
when connecting to an ASA server. A TDS 5.0 login packet has a field called lservname. For most TDS servers,
lservname is a user-defined string with no inherent meaning. ASA servers, however, requires that
lservname contain a valid database name, and sets that as the default database for the connection.
FreeTDS normally fills lservname with the [section] text.. This entry instead sets the database name
independently of the [section] name.

Example of the freetds.conf:
[FOOBAR_DEV]
    host = db_at_foo.fqdn.com
    instance = FOO_DEV_INSTANCE
    tds version = 7.0
    asa database = BAR

Problem: The default database was not set correctly when connected to "FOOBAR_DEV" DSN.

Solution:
Left file: src\tds\config#2.c
Right file: src\tds\config#3.c
                     } else if (!strcmp(option, TDS_STR_ASA_DATABASE)) {
<                             tds_dstr_copy(&connection->server_name, value);
---
                           } else if (!strcmp(option, TDS_STR_ASA_DATABASE)) {
(Continue reading)

Daniel Fazekas | 7 Mar 19:03 2015
Picon

dblib assertion crash on connection timeouts

I think it would be preferable if dblib in the current development version wouldn't just crash the host
process with an assertion if a connection attempt times out.
dbutil.c:193: _dblib_check_and_handle_interrupt: Assertion `dbproc != ((void *)0) &&
!dbdead((dbproc))' failed.

For example, doing a
bsqldb -S microsoft.com
or trying any other firewalled or non-responsive address.

Returning INT_CANCEL on DBDEAD in _dblib_check_and_handle_interrupt seems to be nicer.
Victor Volpe | 7 Mar 18:52 2015
Picon

PHP CLI MSSQL crash

Hi, the PHP script below are running fine in webserver but not in CLI. Maybe PHP are passing invalid pointers
to the dbopen() function of FreeTDS.

Ps.: No output in the FreeTDS debug file and the tsql are running fine. Submited to the PHP Bug Tracking
System too: https://bugs.php.net/bug.php?id=69184

Any help will be appreciated.

Test script:
<?php
if (mssql_connect("100.100.100.100", "sa", "thisissparta"))
print "Connection success\n";
else
print "Connection error\n";
?>

Actual result:
(gdb) run test.php
Starting program: /usr/bin/php test.php
[New LWP 100886]
[New Thread 808c06400 (LWP 100886/php)]

Program received signal SIGBUS, Bus error.
[Switching to Thread 808c06400 (LWP 100886/php)]
0x0000000801cc3f7a in dbopen () from /usr/local/lib/libsybdb.so.5
(gdb) bt
#0 0x0000000801cc3f7a in dbopen () from /usr/local/lib/libsybdb.so.5
#1 0x0000000801c9da97 in tdsdbopen () from /usr/local/lib/libsybdb.so.5
#2 0x000000080635a1c1 in getpwent () from /lib/libc.so.7
#3 0x00000008063591b0 in getpwent_r () from /lib/libc.so.7
(Continue reading)


Gmane