-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DB2 Support #112
Comments
Ok, there are 2 different models here.
So in the 2nd model there's an adapter per database (picked in the AdapterFactory) which is basically a much simpler version of the XSchemaReader in model 1. Instead of calling the connection.GetSchema() methods, it calls a set of custom queries which I wrote in ProviderSchemaReaders.Databases. Each query class is based on SqlExecuter, and is usually a single query, for instance to return table names or column details... (In some cases it gets more complex, because of different versions of databases, or just the nature of the metadata). So almost all the adapters look very simple because the code is something like: public override IList<DatabaseTable> Tables(string tableName)
{
return new Tables(CommandTimeout, Owner, tableName)
.Execute(ConnectionAdapter);
} The actual logic is in the implementation of the Tables class, which usually just simple sql against the database metadata tables (Information_Schema or for DB2 it's SYSCAT). So to implement the DB2 calls, you'd have to add a DB2 folder to the Databases, and start adding queries based on SqlExecuter for each type of metadata. In some cases you can just copy the sql from the Db2SchemaReader, which is doing exactly that for Sequences, Table descriptions etc. The standard ones- table names, columns - you may be able to copy what the connection.GetSchema does already, if you can decompile their source code. Hope this helps |
Hello again,
I am now trying to read DB2 schema. I have installed the free DB2 edition and client tools and can connect OK using the generic Factory method...
DbProviderFactory factory = DbProviderFactories.GetFactory("IBM.Data.DB2");
The ReaderAdapterFactory has code commented out which would select the Db2ISeriesSchemaReader, so it looks like some work has been done for this.
As it stands the generic ReaderAdapter is selected and no Tables etc are read from the DB schema.
Can you please let me know what is the difference between Adapters and Readers? Would it be fairly easy to create a DB2 adapter from the reader code?
Thanks
The text was updated successfully, but these errors were encountered: