Extracting data from an ODBC source to text

Posted on 2008-11-13
Medium Priority
Last Modified: 2013-11-30

I need to extract data automatically on schedule (perhaps with a batch file) from an ODBC source using a query, SELECT DISTINCT field1,field2 FROM tablename, etc and dump this in a text file with a record on each line. Any suggestions?
Question by:jlsergeant
  • 3
  • 2
LVL 30

Assisted Solution

nmcdermaid earned 300 total points
ID: 22957534
There are a few options. What kind of data Is the ODBC source pointing at?
If the ODBC data source is pointing at a SQL Server then you can use the BCP command line tool to export data directly, assuming you have SQL Server tools installed.
If its not SQL Server, then you may be able to download a database specific tool to do it for you. You could also use VBScript and ADO to connect to the data source and export the text file (this does not require you to install anything special and should work against any ODBC source)
All of these options are command line driven so you can use whatever scheduler you want to run them.
Post back what database the ODBC source is pointing at.

Author Comment

ID: 22957567
The source data resides within the 'sage Timberline' application. (Beyond this i'm unsure, perhaps btrieve. but i really don't know)

It has an ODBC driver and I would like to extract automatically via this driver. Currently I can extract manually using 3rd party tools. If you have any script source it would be greatly appreciated.
LVL 30

Expert Comment

ID: 22957626
The concept is to write a VBScript which uses ADO to connect to the ODBC data source, retrieves the dataset and writes it to a file.
I don't have a script on me. I may be able to cook one up before I leave work in about 20 minutes.
I've heard that the timberline ODBC driver can be a bit dodgy though.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 30

Expert Comment

ID: 22957660
Sorry.. VBScript is very handy but a real pain to debug. I'll get back to it on Monday.
LVL 29

Accepted Solution

Bill Bach earned 1200 total points
ID: 22960115
There are several available tools that allow for simple extraction.  If you just want to script it from a command line, then try SQLExec, a tool from Goldstar Software (who also provides Pervasive database support for Timberline and other similar environments).  SQLExec offers a number of export options, and while writtenoriginally for Pervasive databases, it will work on just about any valid ODBC data environment.  You may find other similar tools available on the 'Net as well.

If you are integrating Timberline with other environments, then you may wish to look at the entire class of ETL (extract/transform/load) tools, such as Pervasive's Data Integrator or open-source solutions from Jaspersoft or Pentaho.  These tools allow you to extract data, manipulate it as needed, and send it into another environment quite easily.  Many come with schedulers for repeat-processing, too, and can even watch for other "trigger" data, such as files appearing in a directory or FTP site.

Author Closing Comment

ID: 31516641
Thanks guys, I'm going to buy SQLEXEC. It does everything required.

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question