Solved

Extracting a MySql schema via ADO.NET

Posted on 2006-07-09
8
702 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
Comment Utility
Gerry,

I would suggest getting the .NET MySql data provider.

Bob
0
 
LVL 4

Author Comment

by:gamesmeister
Comment Utility
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
Comment Utility
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
 
LVL 4

Author Comment

by:gamesmeister
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
Gerry,
What information do you need from the schema?

Bob
0
 
LVL 4

Author Comment

by:gamesmeister
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

728 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

12 Experts available now in Live!

Get 1:1 Help Now