Solved

Extracting a MySql schema via ADO.NET

Posted on 2006-07-09
8
706 Views
Last Modified: 2010-08-05
Hi,

I'm trying to use an OleDbConnection object to extract the schema from a MySql database. I'm using the OleDbConnection.GetOleDbSchemaTable method, which seems to work on other databases but not on MySql.

My connection string is "Server=localhost;Database=test;Uid=gerard;Pwd=pass;"

When I try and open the OleDbConnection object, I get the message:
"No error information available: E_FAIL(0x80004005)."

Can I connect to a MySql database via an OleDbConnection object, or do I need to use a MySqlConnection object? If the latter, how do I extract the schema?

Many thanks
Gerry
0
Comment
Question by:gamesmeister
  • 5
  • 3
8 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 17070251
Gerry,

I would suggest getting the .NET MySql data provider.

Bob
0
 
LVL 4

Author Comment

by:gamesmeister
ID: 17070829
Bob,

I have that, which is where I get the MySqlConnection object from. However, it doesn't offer the same interface as the OleDbConnection object, and I couldn't see any method for extracting a schema.

By the way, I'm working with .NET 1.1 - is there anything in .NET 2.0 that would help here?

Many thanks
Gerry
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17072217
1) I haven't seen anything better with 2.0.

2) What do you mean the MySqlConnection doesn't "offer the same interface as OleDbConnection"?

3) Which version are you using?

Bob
0
Industry Leaders: 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 4

Author Comment

by:gamesmeister
ID: 17074691
1) Ok, thx

2) Specifically, OleDbConnection offers the method "GetOleDbSchemaTable" to retrieve the database schema, which is not offered by the DB specific provider objects such as MySqlConnection or DB2Connection.

3) Version 5.0 of MySql, version 1.1 of the framework

Thanks
Gerry
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17074856
Gerry,
What information do you need from the schema?

Bob
0
 
LVL 4

Author Comment

by:gamesmeister
ID: 17075086
Typical DB object data ie. table names, column data for each table (name, length, datatype, default value, optionality), indices, primary and foreign keys.
0
 
LVL 4

Author Comment

by:gamesmeister
ID: 17076354
Actually, I think I've found it.

I'm pretty new to MySql, so I've only just come across the inherent schema tables within each DB instance on the server. Just going to have a play, then will allocate the points to you - if you have any further suggestions, they're very welcome

Cheers
Gerry
0
 
LVL 4

Author Comment

by:gamesmeister
ID: 17077012
Yeah, I'm able to extract all the schema data I need via the INFORMATION_SCHEMA tables on the MySql database.

As always, thanks for your time and help Bob
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

735 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