Skip to Content.
Sympa Menu

freetds - Re: [freetds] bulk copy API

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: mgrosman AT pathcom.com
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>, jklowden AT schemamania.org
  • Subject: Re: [freetds] bulk copy API
  • Date: Wed, 07 Apr 2010 12:18:41 -0400

----- Message from jklowden AT schemamania.org ---------
Date: Wed, 7 Apr 2010 09:46:25 -0400
From: jklowden AT schemamania.org
Reply-To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
Subject: Re: [freetds] bulk copy API
To: FreeTDS Development Group <freetds AT lists.ibiblio.org>


On Wed, Apr 07, 2010 at 10:31:56AM -0400, mgrosman AT pathcom.com wrote:
So, if I understand correctly, I'll have to open a separate connection
via dblib's dbopen() to use bcp API.

Are there any plans to move bcp support to ODBC? Microsoft's 2008 SQL
Server is the last one which supports dblib connections.

I have an interest in ODBC BCP. More interest than time, though. I'm happy to apply patches and offer advice....

Don't worry about end-of-life for DB-Library. As far as the server is concerned, ODBC is practically indistinguishable from db-lib. As an open source project, we can make sure the bytes arriving at the server are the same regardless of the API used.

What Microsoft means by "won't be supported" is that they will (may) modify the server in such a way that NTWDBLIB.DLL -- which they haven't updated since 2002 or so -- won't work. I expect the next version of the server to require ANSI_DEFAULTS session properties, or something like that. It could even be simpler: the login packet has a "client is ODBC" flag. It's set ON for ODBC connections and OFF (of course) for db-lib. The server could just refuse connections with it OFF. Cf. http://msdn.microsoft.com/en-us/library/dd304019%28PROT.13%29.aspx, the "fODBC" bit.

File it under "planned obsolescence". They'd do the same thing with the C standard library if they could. (_CRT_SECURE_NO_WARNINGS, anyone?) Ask Joel about Fire and Motion.

Whatever happens, as long as the server speaks TDS, FreeTDS's db-lib will be able to adapt. That promise doesn't come from me; it's courtesy of the LGPL and copyright law.

--jkl
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds



----- End message from jklowden AT schemamania.org -----

Your words are encouraging. For now I'm planning to port an application that doesn't use bcp to UNIX platform, so bcp is not critical. But we have another app that uses bcp API extensively to upload large chunks of data to temporary tables without any indexes and then run stored procedures to incorporate temp table into the permanent tables already having millions of records.

The application first opens ODBC connection handle, then issues CREATE TABLE to create a temp table, then makes bcp calls to upload a file with corresponding format description file to the temp table, then issues a call to a stored procedure passing it a name of the temp table, so that the data can be stored in other tables.
BCP is used on the same connection so that it would see the temporary table. That's why I cannot combine ODBC API with dblib's bcp API - they will use different connections.
Otherwise a big redesign of the application would be required, which is difficult. So I guess that app stays on Windows for the time being.

Thanks,
Mike




Archive powered by MHonArc 2.6.24.

Top of Page