views:

418

answers:

2

I am working with some data I obtained that is read with a program using an embedded Advantage Database Server. The program was not written by me and does not have all of the functionality that I need. I would like to convert this data to a different format so that I can work with it more freely, such as MySQL.

I know that Sybase provides some tools for converting a single local database into SQL, which is very nice. This would work fine, except that the authors of this program create a new folder containing a new database for every new document that a users is working with. So there could be 100s of separate database folders each with 100s of .ADT files in them.

I am looking for a way to automate the process of converting these .ADT files and their schema to basically anything else. I've had more luck with almost all the other formats I've had to work with in the past, this one has been most troublesome. I don't need indexes, views, or any of that. I only need to export the tables to another format so that I can process some of the data.

So the solution I'm looking for here is just a way to automate the conversion of a single Advantage Database Server local database to SQL. So I have a folder of .ADT files that represent the database.

I included Ruby and Python in the tags because using one of these scripting languages would be ideal, but any solution would be great.

The route I'm on right now is trying to work with the ODBC drivers, but I'm having trouble and hoped that there was an easier solution.

Thanks!

Chase Gray

+2  A: 

Advantage has a dbi (Perl) driver you could use to access the tables in their existing ADT format. Also has JDBC and OLE DB drivers. See all of them at http://devzone.advantagedatabase.com/dz/content.aspx?key=20&Release=13

Note that link is to the version 9.1 drivers. You will want to grab a driver that is equal to or older than the Advantage server that is running (unless the client is using the Advantage Local Server, in which case it won't matter).

Jeremy Mullin
Let's say that I just have a single .ADT file representing a single table.Is there no easy way to convert that or just extract the rows?
Chase M Gray
There is a utility, Advantage Data Architect (ARC), that allows you to export/convert a table to a number of different formats. You can download it from the Advantage Developer Zone: http://devzone.advantagedatabase.com/ Just download the version of ARC that your ADS server is or you can use the Local Server dlls included with ARC to open the table locally to do the conversion.
Joshery
+1  A: 

After some asking and searching it seems that there isn't something like what I was looking for.

I spent a little while earlier today putting something together based on the Ruby DBF gem. I'm not finished, but it works like I want it to. I'll have to finish up the tests and add the exporting of SQL, etc. but hopefully somebody else finds this question and can retrieve information from a .ADT file without having to install anything.

Here is the link to the project. It'll be in progress for the rest of the night probably. It's pretty minimal right now, but over time I'll probably add to it.

http://github.com/chasemgray/Ruby-ADT http://chase.ratchetsoftware.com/2010/02/reading-advantage-database-server-files-adt-in-ruby/

Now getting data out should be as simple as this.

require 'adt'

table = ADT::Table.new("test.adt")

table.each do |record|
  puts record.name
  puts record.email
end

Thanks for your help,

Chase Gray

Chase M Gray