[Mono-list] sqlmetal on Mono 2.6 stable

Costantino Pipero cos at beeond.net
Sun Jan 17 19:59:06 EST 2010


Jonathan,

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


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

Anyone has any idea? Thank you all for the support

Cos

--------------------------------------------------
From: "Jonathan Pryor" <jonpryor at vt.edu>
Sent: Wednesday, December 09, 2009 11:20 AM
To: "Costantino Pipero" <cos at beeond.net>
Cc: <mono-list at lists.ximian.com>
Subject: Re: [Mono-list] sqlmetal on Mono 2.6 preview

> Inline...
>
> On Tue, 2009-12-08 at 18:09 -0500, Costantino Pipero wrote:
>> But it still gets an error complaining about worng "syntax near '?db'"... 
>> it
>> looks like it's not resolving the database name that I pass in the conn
>> string (I also try using separate arguments instead of the conn, but very
>> same error)
>>
>> C:\PROGRA~1\Mono-2.6\bin>sqlmetal
>> /conn:Server=localhost;Database=adventureworks;Uid=root;Pwd=somePwd
>> /code:AdventureWorks.cs /provider=MySQL
> ...
>> >>> Reading schema from MySQL database
>> sqlmetal failed:ByteFX.Data.MySqlClient.MySqlException: You have an error 
>> in
>> you
>> r SQL syntax; check the manual that corresponds to your MySQL server 
>> version
>> for
>>  the right syntax to use near '?db' at line 3
>>   at ByteFX.Data.MySqlClient.Driver.ReadPacket () [0x00000]
>>   at ByteFX.Data.MySqlClient.Driver.Send (DBCmd cmd, System.Byte[] bytes)
>> [0x000
>> 00]
>> [...]
>
> You trimmed out the most important bit.  It's rather hard to diagnose
> things without a full stack trace. :-)
>
> (It occurs to me that a --verbose option would likely be useful so that
> we can tell what SQL queries sqlmetal is executing, though I don't know
> how easy this would be to add...)
>
> Another possibility is that MySQL doesn't like your ADO.NET provider.
> Sqlmetal will use Mono's included ByteFX.Data ADO.NET provider by
> default, and I've seen some reports that this occasionally doesn't work
> with recent MySQL releases.
>
> If you have the MySQL.Data assembly, you can use that explicitly by
> using the /databaseConnectionProvider option:
>
>        sqlmetal 
> "/databaseConnectionProvider=MySql.Data.MySqlClient.MySqlConnection, 
> MySql.Data" ...
>
> I don't know if this will work for you, but it might.
>
> - Jon
>
> 


More information about the Mono-list mailing list