Extracting data from an ODBC source to text

Posted on 2008-11-13
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
    LVL 30

    Assisted Solution

    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

    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

    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.
    LVL 30

    Expert Comment

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

    Accepted Solution

    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

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

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
    In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
    Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now