[Mono-list] sqlmetal on Mono 2.6 stable

Jonathan Pryor jonpryor at vt.edu
Tue Jan 19 13:40:45 EST 2010

On Sun, 2010-01-17 at 19:59 -0500, Costantino Pipero wrote:
> I parked this issue for a while and reinstalled my code in a fresh OpenSuse 
> 11.2 setup (with the latest Mono stable release and MySQL 5.1...).
> I tried sqlmetal again with all the options that we discussed and I am stuck 
> with the same results.
> Using
>        sqlmetal 
> "/databaseConnectionProvider=MySql.Data.MySqlClient.MySqlCOnnection.MySqlData" 
> "/conn:Server:localhost;Database=adventureworks;Uid=root;Pwd=xyz" 
> /code:awmodel.cs

Offhand, that's not a fully-qualified assembly name, and it's
mis-capitalized.  You likely want:

        "/databaseConnectionProvider=MySql.Data.MySqlClient.MySqlConnection, MySql.Data"

You'll also want /provider:MySql or sqlmetal will attempt to use
Microsoft SQL Server SQL when communicating with the DB (which is likely
wrong ;-).

> I get the following error
> LoaderFactory.Load(schemaType=MySqlSchemaLoader, dbConnType=MySqlConnection)
> Failed on setting 
> ConnectionString=Server:localhost;Database=adventureworks;Uid=root;Pwd=xyz
> LoaderFactory.Load() failed: Array index is out of range.
> sqlmetal failed:System.IndexOutOfRangeException: Array index is out of 
> range.
>   at ByteFX.Data.Common.DBConnectionString.ParseKeyValuePairs (System.String 
> src) [0x00000] in <filename unknown>:0
>   at ByteFX.Data.Common.DBConnectionString.Parse (System.String 
> newConnectString) [0x00000] in <filename unknown>:0
>   at ByteFX.Data.Common.DBConnectionString.SetConnectionString 
> (System.String value) [0x00000] in <filename unknown>:0
>   at ByteFX.Data.MySqlClient.MySqlConnection.set_ConnectionString 
> (System.String value) [0x00000] in <filename unknown>:0
>   at DbMetal.Generator.Implementation.SchemaLoaderFactory.Load 
> (DbMetal.Parameters parameters, System.Type dbLinqSchemaLoaderType, 
> System.Type databaseConnectionType, System.Type sqlDialectType) [0x00000] in 
> <filename unknown>:0

Odd; it apparently doesn't like your connection string.  Why, I can't
say.  Perhaps it doesn't like using ':' as a delimiter in your
"Server:localhost" section?

I also find it troubling that it's going into ByteFX.Data, which implies
to me that it's not finding your MySql.Data provider (which somewhat
makes sense as you mis-typed the MySql.Data provider, above).

 - Jon

More information about the Mono-list mailing list