Novice needs help

110 views
Skip to first unread message

Sid Price

unread,
Jan 9, 2011, 7:52:34 PM1/9/11
to DbLinq
Hello,

I am working on a project that needs to work with either a desktop DB
(SQL Express 2008) or a remote DB (MySQL). I have downloaded and
installed the MySQL connector and I am able to connect to a test MySQL
DB.

I plan on using LINQ for access of the databases and found DBLinq, it
looks like it is what I need to access MySQL using LINQ. However, I am
not a DB expert and I just don't understand what steps I need to take
to get DBLinq working with VS 2008 and VB.NET. I have read the
instructions but really don't understand the steps I need to take.

Also, when it comes to deploying my application is there anything
special I need to do in order to use DBLinq so that I can offer the
user an option to enter the URL to the NySQL database at runtime.

Please could someone help me get this set up.

Many thanks,
Sid.

Sadık Eser

unread,
Jan 10, 2011, 2:45:30 AM1/10/11
to dbl...@googlegroups.com
Download dblinq binaries and copy "Mysql.Data.dll" in the same forder with "DbMetal.exe"

using command line execute DbMetal.exe with the following parameteters, with making necessary replaces.

DbMetal.exe --provider=Mysql --server=[your server address] --database=[your database name] --user=[mysql user name] --password=[mysql password] --code=[path to vb file]

add the generated vb file into your project.
create an instance of generated class with "connection string" parameter. 

if you have trouble with using dblinq please also specify the step you have troubled.

Best regards
Sadık Eser



2011/1/10 Sid Price <sidp...@avianambassadors.com>

--
You received this message because you are subscribed to the Google Groups "DbLinq" group.
To post to this group, send email to dbl...@googlegroups.com.
To unsubscribe from this group, send email to dblinq+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dblinq?hl=en.


Sid Price

unread,
Jan 10, 2011, 12:47:18 PM1/10/11
to dbl...@googlegroups.com

Thank you for your reply. Here is my attempt to run DbMetal. You will see it fails I would appreciate any help/pointers.

 

C:\Data_Root\Temp\DbLinq-0.20.1>dbmetal.exe --provider=Mysql --server=192.168.0.7 --database=in_out --user=sid --password=xxxxxx --code=files\dblinq_mysql.vb

DbLinq Database mapping generator 2008 version 0.20

for Microsoft (R) .NET Framework version 3.5

Distributed under the MIT licence (http://linq.to/db/license)

 

DbMetal: Could not load databaseConnectionType type 'MySql.Data.MySqlClient.MySq

lConnection, MySql.Data'.  Try using the --with-dbconnection=TYPE option.

 

Sid.

 

Avian Ambassadors - Flights of Education

www.AvianAmbassadors.com

The Bird Training Blog

Behavior and Training Seminars

Sadık Eser

unread,
Jan 10, 2011, 1:13:27 PM1/10/11
to dbl...@googlegroups.com
reinstall mysql .net connector and
ensure that, Mysql.Data.dll exists in c:\windows\assembly folder or the same folder with dbmetal.exe

2011/1/10 Sid Price <sidp...@avianambassadors.com>

Sid Price

unread,
Jan 10, 2011, 1:36:17 PM1/10/11
to dbl...@googlegroups.com
Thank you. I did a repair of the connector, Mysql.data.dll is in
c:\windows\assembly, but DbMagic still produces the same result. Also, I am
able to open a connection to my database in a test program in VS2008:

Dim strConn As String = "server=192.168.0.7;User
Id=sid;pwd=xxxxx;database=mysql;Persist Security Info=True"

Dim oConn As New MySql.Data.MySqlClient.MySqlConnection(strConn)

oConn.Open()

oConn.Close()

This works fine so that tells me the connector is installed correctly, is
that right?

Sid.

Avian Ambassadors - Flights of Education

www.AvianAmbassadors.com

<http://avianambassadors.com/BirdTraining/> The Bird Training Blog

<http://www.behaviorandtraining.com/> Behavior and Training Seminars

From: dbl...@googlegroups.com [mailto:dbl...@googlegroups.com] On Behalf Of
Sadik Eser
Sent: Monday, January 10, 2011 11:13 AM
To: dbl...@googlegroups.com
Subject: Re: [dblinq] Novice needs help

reinstall mysql .net connector and

ensure that, Mysql.Data.dll exists in c:\windows\assembly folder or the same
folder with dbmetal.exe

2011/1/10 Sid Price <sidp...@avianambassadors.com>

Thank you for your reply. Here is my attempt to run DbMetal. You will see it
fails I would appreciate any help/pointers.

C:\Data_Root\Temp\DbLinq-0.20.1>dbmetal.exe --provider=Mysql
--server=192.168.0.7 --database=in_out --user=sid --password=xxxxxx
--code=files\dblinq_mysql.vb

DbLinq Database mapping generator 2008 version 0.20

for Microsoft (R) .NET Framework version 3.5

Distributed under the MIT licence (http://linq.to/db/license)

DbMetal: Could not load databaseConnectionType type
'MySql.Data.MySqlClient.MySq

lConnection, MySql.Data'. Try using the --with-dbconnection=TYPE option.

Sid.

Avian Ambassadors - Flights of Education

www.AvianAmbassadors.com

The Bird Training Blog <http://avianambassadors.com/BirdTraining/>

Behavior and Training Seminars <http://www.behaviorandtraining.com/>

Best regards

Sadık Eser

2011/1/10 Sid Price <sidp...@avianambassadors.com>

Hello,

Many thanks,
Sid.

<mailto:dblinq%2Bunsu...@googlegroups.com> .


For more options, visit this group at
http://groups.google.com/group/dblinq?hl=en.

--

You received this message because you are subscribed to the Google Groups
"DbLinq" group.
To post to this group, send email to dbl...@googlegroups.com.
To unsubscribe from this group, send email to
dblinq+un...@googlegroups.com

<mailto:dblinq%2Bunsu...@googlegroups.com> .


For more options, visit this group at
http://groups.google.com/group/dblinq?hl=en.

--

You received this message because you are subscribed to the Google Groups
"DbLinq" group.
To post to this group, send email to dbl...@googlegroups.com.
To unsubscribe from this group, send email to
dblinq+un...@googlegroups.com

<mailto:dblinq%2Bunsu...@googlegroups.com> .

winmail.dat

Jonathan Pryor

unread,
Jan 10, 2011, 1:39:04 PM1/10/11
to dbl...@googlegroups.com
As per the exception message, it can't find the MySqlConnection type, because you haven't fully installed it.

Specifically, you need to let dbmetal know about it; see:

http://code.google.com/p/dblinq2007/wiki/Installation#To_run_DbMetal

Specifically, you need to either copy the MySql.Data.dll assembly into the same directory as DbMetal.exe, or edit the DbMetal.exe.config file to reference the correct fully-qualified assembly name.

You will also need to follow the instructions in the "To use DbLinq" section.

- Jon

Sid Price

unread,
Jan 10, 2011, 2:12:11 PM1/10/11
to dbl...@googlegroups.com
Thank you, however when I try to copy Mysql.data from the
c:\windows\assembly folder I cannot. I try to right-drag and drop and
nothing happens, the cursor does not change and the file is not copied.

Sid.

Avian Ambassadors - Flights of Education
www.AvianAmbassadors.com
The Bird Training Blog
Behavior and Training Seminars

winmail.dat

Sid Price

unread,
Jan 10, 2011, 2:22:10 PM1/10/11
to dbl...@googlegroups.com
OK, I finally figured out how to gain access to the DLL using a command
window and I have copied it to the same folder as DbMagic.exe.

Now, with the same command line as before I get a different error:

DbMetal: Object reference not set to an instance of an object.

Sid.

Avian Ambassadors - Flights of Education
www.AvianAmbassadors.com
The Bird Training Blog
Behavior and Training Seminars

winmail.dat

Jonathan Pryor

unread,
Jan 10, 2011, 2:42:37 PM1/10/11
to dbl...@googlegroups.com
On Jan 10, 2011, at 2:22 PM, Sid Price wrote:
> Now, with the same command line as before I get a different error:
>
> DbMetal: Object reference not set to an instance of an object.

A full stack trace would be useful. :-)

- Jon

Sid Price

unread,
Jan 10, 2011, 3:04:30 PM1/10/11
to dbl...@googlegroups.com
01/08/2011 06:41 PM <DIR> Microsoft.SqlServer.SQLTask
12/11/2010 04:33 PM <DIR>
Microsoft.TeamFoundation.WorkItemTracking
.Client.Cache
12/11/2010 04:33 PM <DIR>
Microsoft.TeamFoundation.WorkItemTracking
.Client.DataStore
12/11/2010 04:33 PM <DIR>
Microsoft.TeamFoundation.WorkItemTracking
.Client.RuleEngine
07/13/2009 09:52 PM <DIR> Microsoft.Transactions.Bridge.Dtc
12/10/2010 12:08 PM <DIR> Microsoft.VisualC.VSCodeParser
12/10/2010 12:08 PM <DIR>
Microsoft.VisualStudio.Modeling.Diagrams.
GraphObject
01/08/2011 06:14 PM <DIR>
Microsoft.VisualStudio.Modeling.Sdk.Diagr
ams.GraphObject
07/13/2009 09:52 PM <DIR> Microsoft.Windows.Diagnosis.SDEngine
12/27/2010 12:59 PM <DIR>
Microsoft.Xna.GameStudio.PlatformTools
07/13/2009 09:52 PM <DIR> MSBuild
01/08/2011 06:14 PM <DIR> mscorcfg
07/13/2009 07:37 PM <DIR> mscorlib
07/13/2009 07:37 PM <DIR> napcrypt
07/13/2009 07:37 PM <DIR> naphlpr
07/13/2009 09:52 PM <DIR> Policy.1.0.Microsoft.Ink
07/13/2009 07:37 PM <DIR>
Policy.1.0.Microsoft.Interop.Security.AzR
oles
07/13/2009 07:37 PM <DIR>
Policy.1.2.Microsoft.Interop.Security.AzR
oles
07/13/2009 09:52 PM <DIR> Policy.1.7.Microsoft.Ink
07/13/2009 09:52 PM <DIR> Policy.6.0.Microsoft.Ink
07/13/2009 09:52 PM <DIR> PresentationCore
12/11/2010 09:30 AM <DIR> soapsudscode
07/13/2009 07:37 PM <DIR> System.Data
07/13/2009 07:37 PM <DIR> System.Data.OracleClient
07/13/2009 07:37 PM <DIR> System.EnterpriseServices
07/13/2009 09:52 PM <DIR> System.Printing
07/13/2009 07:37 PM <DIR> System.Transactions
07/13/2009 07:37 PM <DIR> System.Web
12/14/2010 05:30 PM <DIR> vjscor
12/14/2010 05:30 PM <DIR> VJSharpCodeProvider
12/14/2010 05:30 PM <DIR> vjsjbc
12/14/2010 05:30 PM <DIR> vjslib
12/14/2010 05:30 PM <DIR> vjslibcw
12/14/2010 05:30 PM <DIR> VJSSupUILib
12/14/2010 05:30 PM <DIR> vjsvwaux
12/14/2010 05:30 PM <DIR> vjswfc
12/14/2010 05:30 PM <DIR> VjsWfcBrowserStubLib
12/14/2010 05:30 PM <DIR> vjswfccw
12/14/2010 05:30 PM <DIR> vjswfchtml
12/11/2010 09:27 AM <DIR> WebDev.WebHost
12/11/2010 05:00 PM <DIR> WebDev.WebHost20
0 File(s) 0 bytes
80 Dir(s) 14,358,151,168 bytes free

C:\DATA_R~1\Temp\DBLINQ~1.1>dir \windows\assembly\gac_32\my*
Volume in drive C has no label.
Volume Serial Number is B0AA-F075

Directory of C:\windows\assembly\gac_32

File Not Found

C:\DATA_R~1\Temp\DBLINQ~1.1>dir \windows\assembly\gac_32\m*.*
Volume in drive C has no label.
Volume Serial Number is B0AA-F075

Directory of C:\windows\assembly\gac_32

07/14/2009 12:51 AM <DIR> mcstoredb
07/14/2009 12:51 AM <DIR> mcupdate
07/14/2009 12:51 AM <DIR> Mcx2Dvcs
07/13/2009 09:52 PM <DIR>
Microsoft-Windows-HomeGroupDiagnostic.Net
ListMgr.Interop
12/14/2010 05:30 PM <DIR> Microsoft.Build.VisualJSharp
12/11/2010 12:00 PM <DIR> Microsoft.Expression.Encoder
12/11/2010 12:00 PM <DIR> Microsoft.Expression.Encoder.Api2
12/11/2010 12:00 PM <DIR>
Microsoft.Expression.Encoder.resources
12/11/2010 12:00 PM <DIR> Microsoft.Expression.Encoder.Types
12/11/2010 12:00 PM <DIR>
Microsoft.Expression.Encoder.Utilities
12/11/2010 11:53 AM <DIR>
Microsoft.Expression.Web.Interop.Protocol
sInternal
07/14/2009 12:51 AM <DIR> Microsoft.GroupPolicy.AdmTmplEditor
07/14/2009 12:51 AM <DIR>
Microsoft.GroupPolicy.AdmTmplEditor.Resou
rces
07/14/2009 12:51 AM <DIR> Microsoft.GroupPolicy.Interop
07/13/2009 09:52 PM <DIR> Microsoft.Ink
07/13/2009 07:37 PM <DIR> Microsoft.Interop.Security.AzRoles
07/14/2009 12:51 AM <DIR> Microsoft.MediaCenter.Interop
07/14/2009 12:51 AM <DIR> Microsoft.MediaCenter.iTV.Media
07/14/2009 12:51 AM <DIR> Microsoft.MediaCenter.Mheg
07/14/2009 12:51 AM <DIR> Microsoft.MediaCenter.Playback
07/14/2009 12:51 AM <DIR>
Microsoft.MediaCenter.TV.Tuners.Interop
07/14/2009 12:51 AM <DIR>
Microsoft.Security.ApplicationId.PolicyMa
nagement.PolicyEngineApi.Interop
01/08/2011 06:42 PM <DIR>
Microsoft.SqlServer.ActiveXScriptTaskUtil

01/08/2011 06:41 PM <DIR> Microsoft.SqlServer.BatchParser
01/08/2011 06:42 PM <DIR>
Microsoft.SqlServer.BulkInsertTaskConnect
ions
01/08/2011 06:41 PM <DIR> Microsoft.SqlServer.DTSRuntimeWrap
01/08/2011 06:05 PM <DIR> Microsoft.SqlServer.GridControl
01/08/2011 06:09 PM <DIR> Microsoft.SqlServer.MgdSqlDumper
01/08/2011 06:41 PM <DIR> Microsoft.SqlServer.Replication
01/08/2011 06:41 PM <DIR> Microsoft.SqlServer.SQLTask
12/11/2010 04:33 PM <DIR>
Microsoft.TeamFoundation.WorkItemTracking
.Client.Cache
12/11/2010 04:33 PM <DIR>
Microsoft.TeamFoundation.WorkItemTracking
.Client.DataStore
12/11/2010 04:33 PM <DIR>
Microsoft.TeamFoundation.WorkItemTracking
.Client.RuleEngine
07/13/2009 09:52 PM <DIR> Microsoft.Transactions.Bridge.Dtc
12/10/2010 12:08 PM <DIR> Microsoft.VisualC.VSCodeParser
12/10/2010 12:08 PM <DIR>
Microsoft.VisualStudio.Modeling.Diagrams.
GraphObject
01/08/2011 06:14 PM <DIR>
Microsoft.VisualStudio.Modeling.Sdk.Diagr
ams.GraphObject
07/13/2009 09:52 PM <DIR> Microsoft.Windows.Diagnosis.SDEngine
12/27/2010 12:59 PM <DIR>
Microsoft.Xna.GameStudio.PlatformTools
07/13/2009 09:52 PM <DIR> MSBuild
01/08/2011 06:14 PM <DIR> mscorcfg
07/13/2009 07:37 PM <DIR> mscorlib
0 File(s) 0 bytes
42 Dir(s) 14,358,151,168 bytes free

C:\DATA_R~1\Temp\DBLINQ~1.1>dir \windows\assembly\gac
Volume in drive C has no label.
Volume Serial Number is B0AA-F075

Directory of C:\windows\assembly\gac

01/08/2011 06:44 PM <DIR> .
01/08/2011 06:44 PM <DIR> ..
12/10/2010 12:08 PM <DIR> ADODB
12/10/2010 12:16 PM <DIR>
CrystalDecisions.Enterprise.Desktop.Repor
t
12/10/2010 12:16 PM <DIR> CrystalDecisions.Enterprise.Framework
12/10/2010 12:16 PM <DIR> CrystalDecisions.Enterprise.InfoStore
12/10/2010 12:16 PM <DIR>
CrystalDecisions.Enterprise.PluginManager

12/10/2010 12:16 PM <DIR>
CrystalDecisions.Enterprise.Viewing.Repor
tSource
01/08/2011 06:44 PM <DIR> EnvDTE
01/08/2011 06:44 PM <DIR> EnvDTE80
01/08/2011 06:14 PM <DIR> EnvDTE90
01/08/2011 06:14 PM <DIR> EnvDTE90a
12/10/2010 12:08 PM <DIR> Extensibility
07/13/2009 09:42 PM <DIR> Microsoft.Ink
01/08/2011 06:14 PM <DIR>
Microsoft.Internal.VisualStudio.Shell.Int
erop.9.0
12/10/2010 12:08 PM <DIR> Microsoft.mshtml
01/08/2011 06:10 PM <DIR> Microsoft.Office.Interop.Owc11
12/10/2010 12:08 PM <DIR> Microsoft.StdFormat
01/08/2011 06:10 PM <DIR> Microsoft.Vbe.Interop
12/10/2010 12:08 PM <DIR> Microsoft.VisualStudio.CommandBars
01/08/2011 06:44 PM <DIR>
Microsoft.VisualStudio.Debugger.Interop
12/10/2010 11:54 AM <DIR>
Microsoft.VisualStudio.Debugger.InteropA
12/10/2010 12:08 PM <DIR>
Microsoft.VisualStudio.Designer.Interface
s
12/10/2010 11:54 AM <DIR> Microsoft.VisualStudio.OLE.Interop
12/11/2010 09:27 AM <DIR> Microsoft.VisualStudio.Shell.Interop
01/08/2011 06:44 PM <DIR>
Microsoft.VisualStudio.Shell.Interop.8.0
01/08/2011 06:14 PM <DIR>
Microsoft.VisualStudio.Shell.Interop.9.0
12/10/2010 11:54 AM <DIR>
Microsoft.VisualStudio.TextManager.Intero
p
01/08/2011 06:44 PM <DIR>
Microsoft.VisualStudio.TextManager.Intero
p.8.0
01/08/2011 06:14 PM <DIR>
Microsoft.VisualStudio.TextManager.Intero
p.9.0
12/11/2010 05:00 PM <DIR> Microsoft.VisualStudio.VCCodeModel
12/11/2010 05:00 PM <DIR> Microsoft.VisualStudio.VCProject
12/11/2010 05:00 PM <DIR>
Microsoft.VisualStudio.VCProjectEngine
12/10/2010 11:54 AM <DIR> Microsoft.VisualStudio.VSHelp
01/08/2011 06:44 PM <DIR> Microsoft.VisualStudio.VSHelp80
01/08/2011 06:10 PM <DIR> mscomctl
12/10/2010 12:08 PM <DIR> MSDATASRC
01/08/2011 06:10 PM <DIR> Policy.11.0.Microsoft.Vbe.Interop
12/11/2010 11:39 AM <DIR> stdole
12/10/2010 12:08 PM <DIR> VSLangProj
12/10/2010 12:08 PM <DIR> VSLangProj2
01/08/2011 06:44 PM <DIR> VSLangProj80
01/08/2011 06:14 PM <DIR> VslangProj90
12/10/2010 12:08 PM <DIR> VsWebSite.Interop
12/11/2010 05:00 PM <DIR> VsWebSite.Interop100
01/08/2011 06:14 PM <DIR> VsWebSite.Interop90
0 File(s) 0 bytes
46 Dir(s) 14,358,151,168 bytes free

C:\DATA_R~1\Temp\DBLINQ~1.1>copy \mysql.data.dll .
1 file(s) copied.

C:\DATA_R~1\Temp\DBLINQ~1.1>dbmetal.exe --provider=Mysql
--server=192.168.0.7 --
database=in_out --user=sid --password=eziome --code=files\dblinq_mysql.vb


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

>>> Reading schema from MySQL database
<<< writing C# classes in file 'files\dblinq_mysql.vb'


DbMetal: Object reference not set to an instance of an object.

C:\DATA_R~1\Temp\DBLINQ~1.1>dbmagic
'dbmagic' is not recognized as an internal or external command,
operable program or batch file.

C:\DATA_R~1\Temp\DBLINQ~1.1>dbmetal


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

DbMetal [OPTIONS] [<DBML INPUT FILE>]

Generates code and mapping for DbLinq. SqlMetal can:
- Generate source code and mapping attributes or a mapping file from a
databas
e.
- Generate an intermediate dbml file for customization from the database.
- Generate code and mapping attributes or mapping file from a dbml file.

-c, --conn=CONNECTION STRING
Database CONNECTION STRING. Cannot be used with
/server, /user or /password options.
-u, --user=NAME Login user NAME.
-p, --password=PASSWORD Login PASSWORD.
-s, --server=NAME Database server NAME.
-d, --database=NAME Database catalog NAME on server.
--provider=PROVIDER Specify PROVIDER. May be Ingres, MySql, Oracle,
OracleODP, PostgreSql or Sqlite.
--with-schema-loader=TYPE
ISchemaLoader implementation TYPE.
--with-dbconnection=TYPE
IDbConnection implementation TYPE.
--with-sql-dialect=TYPE
IVendor implementation TYPE.
--code=FILE Output as source code to FILE. Cannot be used
with /dbml option.
--dbml=FILE Output as dbml to FILE. Cannot be used with
/map
option.
--language=NAME Language NAME for source code: C#, C#2 or VB
(default: derived from extension on code file
name).
--aliases=FILE Use mapping FILE.
--schema Generate schema in code files (default:
enabled).
--namespace=NAME Namespace NAME of generated code (default: no
namespace).
--entitybase=TYPE Base TYPE of entity classes in the generated
code (default: entities have no base class).
--member-attribute=ATTRIBUTE
ATTRIBUTE for entity members in the generated
code, can be specified multiple times.
--generate-type=TYPE Generate only the TYPE selected, can be
specified multiple times and does not prevent
references from being generated (default:
generate a DataContex subclass and all the
entities in the schema).
--generate-equals-hash Generates overrides for Equals() and
GetHashCode() methods.
--sprocs Extract stored procedures.
--pluralize Automatically pluralize or singularize class
and
member names using specified culture rules.
--culture=CULTURE Specify CULTURE for word recognition and
pluralization (default: "en").
--case=STYLE Transform names with the indicated STYLE
(default: net; may be: leave, pascal, camel,
net).
--generate-timestamps Generate timestampes in the generated code
(default: enabled).
--readline Wait for a key to be pressed after processing.
--debug Enables additional information to help with
debugging, such as full stack traces in error
messages.
-h, -?, --help Show this help


C:\DATA_R~1\Temp\DBLINQ~1.1>dbmetal.exe --provider=Mysql
--server=192.168.0.7 --
database=in_out --user=sid --password=eziome --code=files\dblinq_mysql.vb
--debu
g


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

>>> Reading schema from MySQL database
<<< writing C# classes in file 'files\dblinq_mysql.vb'
DbMetal: System.NullReferenceException: Object reference not set to an
instance
of an object.
at DbMetal.Generator.CodeDomGenerator.GenerateTableClass(Table table,
Databas
e database) in
z:\Development\DbLinq-0.20.1\src\DbMetal\Generator\CodeDomGenerat
or.cs:line 763
at DbMetal.Generator.CodeDomGenerator.GenerateCodeDomModel(Database
database)
in
z:\Development\DbLinq-0.20.1\src\DbMetal\Generator\CodeDomGenerator.cs:line
175
at DbMetal.Generator.CodeDomGenerator.Write(TextWriter textWriter,
Database d
bSchema, GenerationContext context) in
z:\Development\DbLinq-0.20.1\src\DbMetal\
Generator\CodeDomGenerator.cs:line 85
at DbMetal.Generator.Implementation.Processor.GenerateCode(Parameters
paramet
ers, Database dbSchema, ISchemaLoader schemaLoader, String filename) in
z:\Devel
opment\DbLinq-0.20.1\src\DbMetal\Generator\Implementation\Processor.cs:line
234
at DbMetal.Generator.Implementation.Processor.WriteSchema(Database
dbSchema,
ISchemaLoader schemaLoader, Parameters parameters) in
z:\Development\DbLinq-0.20
.1\src\DbMetal\Generator\Implementation\Processor.cs:line 178
at DbMetal.Generator.Implementation.Processor.ProcessSchema(Parameters
parame
ters) in
z:\Development\DbLinq-0.20.1\src\DbMetal\Generator\Implementation\Proce
ssor.cs:line 116

C:\DATA_R~1\Temp\DBLINQ~1.1>

Sid


Avian Ambassadors - Flights of Education
www.AvianAmbassadors.com
The Bird Training Blog
Behavior and Training Seminars


-----Original Message-----
From: dbl...@googlegroups.com [mailto:dbl...@googlegroups.com] On Behalf Of
Jonathan Pryor
Sent: Monday, January 10, 2011 12:43 PM
To: dbl...@googlegroups.com
Subject: Re: [dblinq] Novice needs help

- Jon

--

winmail.dat

Sid Price

unread,
Jan 10, 2011, 3:53:07 PM1/10/11
to dbl...@googlegroups.com
Sorry for the overload of information; Here is the debug dump:

C:\DATA_R~1\Temp\DBLINQ~1.1>dbmetal.exe --provider=Mysql
--server=192.168.0.7 --
database=in_out --user=sid --password=eziome --code=files\dblinq_mysql.vb

--debug


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

>>> Reading schema from MySQL database
<<< writing C# classes in file 'files\dblinq_mysql.vb'
DbMetal: System.NullReferenceException: Object reference not set to an
instance
of an object.
at DbMetal.Generator.CodeDomGenerator.GenerateTableClass(Table table,
Database database) in

:\Development\DbLinq-0.20.1\src\DbMetal\Generator\CodeDomGenerator.cs:line
763
at DbMetal.Generator.CodeDomGenerator.GenerateCodeDomModel(Database
database) in

z:\Development\DbLinq-.20.1\src\DbMetal\Generator\CodeDomGenerator.cs:line
175
at DbMetal.Generator.CodeDomGenerator.Write(TextWriter textWriter,
Database dbSchema, GenerationContext context) in


z:\Development\DbLinq-0.20.1\src\DbMetal\Generator\CodeDomGenerator.cs:line
85
at DbMetal.Generator.Implementation.Processor.GenerateCode(Parameters

parameters, Database dbSchema, ISchemaLoader schemaLoader, String filename)
in


z:\Development\DbLinq-0.20.1\src\DbMetal\Generator\Implementation\Processor.

cs:line 234
at DbMetal.Generator.Implementation.Processor.WriteSchema(Database
dbSchema,ISchemaLoader schemaLoader, Parameters parameters) in


z:\Development\DbLinq-0.20
.1\src\DbMetal\Generator\Implementation\Processor.cs:line 178
at DbMetal.Generator.Implementation.Processor.ProcessSchema(Parameters

parameters) in


z:\Development\DbLinq-0.20.1\src\DbMetal\Generator\Implementation\Processor.
cs:line 116

Sid.

winmail.dat

Jonathan Pryor

unread,
Jan 10, 2011, 4:09:19 PM1/10/11
to dbl...@googlegroups.com
On the relevant line of code, it's accessing the variables `fieldType` and `field`. `field` is constructed via `new`, and thus can't be null, so I'd bet that `fieldType` is null:

var fieldType = TypeLoader.Load(column.Type);

which doesn't help much, as we don't know what type it's trying to load.

Thus, side step the issue: this is happening during C# generation, so instead, generate .dbml:

dbmetal.exe /provider:MySQL /server:192.168.0.7 /database:in_out /user:sid /password:eziome /dml:foo.dbml

(BTW, you should probably change your password and scrub your emails in the future.)

Then, inspect the foo.dbml file, looking at the //Column/@Type attribute values, and see if they make sense.

My guess is that there's either a case sensitivity problem or there's something screwing with the DB column types that DbMetal is reading, and it's storing an empty string in some //Column/@Type attribute value.

- Jon

> <winmail.dat>

Sid Price

unread,
Jan 10, 2011, 4:25:25 PM1/10/11
to dbl...@googlegroups.com
Now a different error:

C:\DATA_R~1\Temp\DBLINQ~1.1>dbmetal.exe /provider:MySQL /server:192.168.0.7
/database:in_out /user:sid /password:xxxxxx /dml:foo.dbml /debug


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

>>> Reading schema from DBML file '/dml:foo.dbml'
DbMetal: System.NotSupportedException: The given path's format is not
supported.

at System.Security.Util.StringExpressionSet.CanonicalizePath(String path,
Boolean needFullPath)
at
System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[]
str, Boolean needFullPath)
at
System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAcc
ess access, AccessControlActions control, String[] pathListOrig, Boolean
checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at
System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccessacc
ess, AccessControlActions control, String[] pathList, Boolean
checkForDuplicates, Boolean needFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess
access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize,
FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean
bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access,FileShare share)
at DbMetal.Generator.Implementation.Processor.ReadSchema(Parameters
parameters, String filename) in
z:\Development\DbLinq-.20.1\src\DbMetal\Generator\Implementation\Processor.c
s:line 273
at DbMetal.Generator.Implementation.Processor.ReadSchema(Parameters
parameter
s, ISchemaLoader& schemaLoader) in


z:\Development\DbLinq-0.20.1\src\DbMetal\Generator\Implementation\Processor.

cs:line 241
at DbMetal.Generator.Implementation.Processor.ProcessSchema(Parameters
parameters) in
z:\Development\DbLinq-.20.1\src\DbMetal\Generator\Implementation\Processor.c
s:line 110

winmail.dat

Jonathan Pryor

unread,
Jan 10, 2011, 10:28:08 PM1/10/11
to dbl...@googlegroups.com
You mis-spelled the /dbml parameter ("dml" != "dbml"), so DbLinq is trying to open the file /dml:foo.dbml, and Windows doesn't like that filename.

Correct the option name. :-)

- Jon

Sid Price

unread,
Jan 11, 2011, 10:19:41 AM1/11/11
to dbl...@googlegroups.com
Thank you, the command ran correctly after that correction. Note that I
copied and pasted the command from your email so didn't notice the error.
:o(

Again, thanks, hopefully I can now make some progress with my research.

winmail.dat
Reply all
Reply to author
Forward
Message has been deleted
0 new messages