[Mono-list] sqlmetal on Mono 2.6 preview

Jonathan Pryor jonpryor at vt.edu
Wed Dec 9 11:20:52 EST 2009


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