Solved

Extracting a MySql schema via ADO.NET

Posted on 2006-07-09
8
707 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

752 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