How to get started with DBMetal and PostgreSQL?

533 views
Skip to first unread message

macias

unread,
Feb 6, 2011, 6:49:59 AM2/6/11
to DbLinq
Hi,

My problem is I cannot even start DBMetal properly.

Technical info: Postgresql 9, DbLinq-0.20.1, Npgsql2.0.11.

At first I downloaded Npgsql for Net 4.0, registered it in GAC, edited
config for DBMetal and I get error:

DbMetal: Could not load databaseConnectionType type
'Npgsql.NpgsqlConnection, Npgsql, Version=2.0.11.0, Culture=neutral,
PublicKeyToken=5d8b90d52f46fda7'. Try using the --with-
dbconnection=TYPE option.

So then, just of curiosity I also copied entire Npgsql into DBLinq.
This time DBMetal reveal the reason why it couldn't load this library
-- because it was compiled for newer version of runtime than DBMetal
itself.

OK, I unregistered Npgsql, downloaded .net 3.5 version, registered it
again, run DBMetal again, and this I have such error:

LoaderFactory.Load(schemaType=PgsqlSchemaLoader,
dbConnType=NpgsqlConnection)
Failed on Activator.CreateInstance(NpgsqlConnection)
LoaderFactory.Load() failed: Exception has been thrown by the target
of an invocation.
DbMetal: Exception has been thrown by the target of an invocation.

What can/should I do next? Thank you in advance for help.

Jonathan Pryor

unread,
Feb 7, 2011, 1:12:08 PM2/7/11
to dbl...@googlegroups.com
On Feb 6, 2011, at 6:49 AM, macias wrote:
> My problem is I cannot even start DBMetal properly.

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

> Technical info: Postgresql 9, DbLinq-0.20.1, Npgsql2.0.11.
>

> So then, just of curiosity I also copied entire Npgsql into DBLinq.
> This time DBMetal reveal the reason why it couldn't load this library
> -- because it was compiled for newer version of runtime than DBMetal
> itself.

You should copy the .NET 3.5 assemblies into the DbMetal.exe directory, or edit DbMetal.exe.config so that the appropriate fully-qualified assembly name is listed (as per the "To run DbMetal" section, way #2).

- Jon

macias

unread,
Feb 7, 2011, 1:17:01 PM2/7/11
to DbLinq
I did exactly this -- "edit DbMetal.exe.config so that the appropriate
fully-qualified assembly name is listed". I wrote this in initial
post. My entry looks like this (if it is any difference):

<provider name="PostgreSQL"
dbLinqSchemaLoader="DbLinq.PostgreSql.PgsqlSchemaLoader,
DbLinq.PostgreSql" databaseConnection="Npgsql.NpgsqlConnection,
Npgsql, Version=2.0.11.0, Culture=neutral,
PublicKeyToken=5d8b90d52f46fda7" />

Maybe I am missing something but it looks like the wiki advised. Yet,
despite of this -- I get error as mentioned above.

Jonathan Pryor

unread,
Feb 7, 2011, 1:26:01 PM2/7/11
to dbl...@googlegroups.com
On Feb 7, 2011, at 1:17 PM, macias wrote:
> I did exactly this -- "edit DbMetal.exe.config so that the appropriate
> fully-qualified assembly name is listed". I wrote this in initial
> post.

I didn't interpret your initial post as stating that. Sorry.

Could you rerun the DbMetal.exe command with the --debug option appended to the command line? This will print out the full stack trace of the error.

Thanks,
- Jon

macias

unread,
Feb 7, 2011, 2:45:23 PM2/7/11
to DbLinq
Jon, many thanks for your help. It appears, that not only I have to
register SQL provider dll into GAC, but also all references dlls as
well -- in case of PostgreSQL it is Mono.Security. After registering
it to into GAC, I am at next stage -- logging into database ;-)

Once again, thank you for helping!
Reply all
Reply to author
Forward
0 new messages