?
Solved

Extracting a MySql schema via ADO.NET

Posted on 2006-07-09
8
Medium Priority
?
711 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 1500 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

719 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