Solved

Extracting a MySql schema via ADO.NET

Posted on 2006-07-09
8
704 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

777 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