[Mono-list] sqlmetal on Mono 2.6 preview

Costantino Pipero cos at beeond.net
Tue Dec 8 18:09:19 EST 2009

Thank you Jonathan,

there is actually a sqlmetal.bat in the bin dir that does what you 

Anyway, I got passed that and the password thing (see 

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)

/code:AdventureWorks.cs /provider=MySQL

DbLinq Database mapping generator 2008 version 0.19
for Microsoft (R) .NET Framework version 3.5
Distributed under the MIT licence (http://linq.to/db/license)

>>> Reading schema from MySQL database
sqlmetal failed:ByteFX.Data.MySqlClient.MySqlException: You have an error in 
r SQL syntax; check the manual that corresponds to your MySQL server version 
 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) 

I really don't know how to troubleshoot this one. THanks again for the help

From: "Jonathan Pryor" <jonpryor at vt.edu>
Sent: Monday, December 07, 2009 10:51 PM
To: "Costantino Pipero" <cos at beeond.net>
Cc: <mono-list at lists.ximian.com>
Subject: Re: [Mono-list] sqlmetal on Mono 2.6 preview

> On Mon, 2009-12-07 at 19:42 -0500, Costantino Pipero wrote:
>> No matter what syntax I try (I am trying to connect to a MySQL db
>> called "adventureworks"), I get the same error.
> As a side note, you're missing the /provider option, so you should
> actually be seeing an error message about missing the /provider option,
> not spew about a TypeLoadException.  That said...
>> For example:
>> C:\Program Files\Mono-2.6\lib\mono\2.0>sqlmetal /server:localhost:3306 
>> /namespace:sdventureworks /code:AdventureWorks.cs /language:csharp
> You're launching it wrong.  This will use .NET to start sqlmetal...
>> returns
>> Unhandled Exception: System.TypeLoadException: Could not load type
>> 'DbLinq.Facto
>> ry.ObjectFactory' from assembly 'System.Data.Linq, Version=,
>> Culture=neut
>> ral, PublicKeyToken=b77a5c561934e089'.
>>    at DbMetal.Program.Main(String[] args)
> ...and (obviously?) .NET's System.Data.Linq.dll won't contain
> DbLinq.Factory.ObjectFactory.
> You need to use Mono to start sqlmetal, thus ensuring that Mono's class
> library is used to launch the app, e.g.
>        path\to\mono.exe path\to\sqlmetal.exe ...
> - Jon

More information about the Mono-list mailing list