Quantcast

Connection String question - vb.net - embedded

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Connection String question - vb.net - embedded

Rick-14
Hello,
I'm new to Firebird, and having a frustrating time with the connection string... or simply connecting to the database.

I have tried various ways of connecting (searching via Google) to a firebird database -embedded- and I just can't seem to get the connection string correct. Such as:

Using conn As New FbConnection( "Server=localhos t;User=SYSDBA; Password= masterkey; Database= C:\data\MyData. fdb")
conn.Open()
End Using

-ANOTHER-STYLE-

Dim connectionString As String = "User=SYSDBA; " & "Password=masterkey ;" & "Database=MyData. fdb;" & "DataSource= localhost; " & "Port=3050;" & "Dialect=3;" & "Charset=NONE; " & "Role=;" & "Connection lifetime=15; " & "Pooling=true; " & "MinPoolSize= 0;" & "MaxPoolSize= 50;" & "Packet Size=8192;" & "ServerType= 1"

-ANOTHER-STYLE-

Dim connectionString As String = String.Format( "User=SYSDBA; Password= masterkey; Database= MyData.fdb; ServerType= 1")

Dim myConnection1 As New FbConnection( connectionString )
myConnection1. Open()

----------

I must have tried at least a dozen different ways and all of them have failed. The last two -above- fail with a 'BadImageFormatException' within a Try Catch block.

What is the correct way to format a connection string? I have tried posted variations of the stringbuilder, but it too fails,

Is there a 'local' shorter version for the connection string to an embedded database?

For instance SQLCE uses |DataDirectory| \MyDatabase.sdf... where you don't have to give the full path.
 
I believe I have all of the dll's in place... fbembed, icuuc30, icudt30, icuin30; now that I am writing this I remember something about fbclient... sigh... 
 
Win7 64bit, 3.5 SP1 framework, VS2008 vb.net, 2.5RC1 Firebird provider 32bit (IBExpert and EMS require the 32bit provider to work with - actually those are in the app debug folder too now that I think of it),
 
Can I include both the 32 and 64 bit dll's in the app folder?


Thanks

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Firebird-net-provider mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Firebird-net-provider] Connection String question - vb.net - embedded

Jiri Cincura
On Fri, Jan 22, 2010 at 04:53, Rick <[hidden email]> wrote:
> I must have tried at least a dozen different ways and all of them have
> failed. The last two -above- fail with a 'BadImageFormatException' within a
> Try Catch block.

This exception is thrown mainly when you have 64bit app and 32bit dll
(or vice versa). It has nothing to do with connection string.

> For instance SQLCE uses |DataDirectory| \MyDatabase.sdf... where you don't
> have to give the full path.

You can use it with .net provider too.

> I believe I have all of the dll's in place... fbembed, icuuc30, icudt30,
> icuin30; now that I am writing this I remember something about fbclient...
> sigh...

For embedded you need fbembed.dll, fbclient is "inside".

> Can I include both the 32 and 64 bit dll's in the app folder?

Sure you can. But how you will solve name collision for i.e. icu dlls?

--
Jiri {x2} Cincura (CTO x2develop.com)
http://blog.cincura.net/ | http://www.ID3renamer.com

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Firebird-net-provider mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Firebird-net-provider] Connection String question - vb.net -embedded

Rick-14
Hello Jiri,

>> I must have tried at least a dozen different ways and all of them have
>> failed. The last two -above- fail with a 'BadImageFormatException' within
>> a
>> Try Catch block.
>
> This exception is thrown mainly when you have 64bit app and 32bit dll
> (or vice versa). It has nothing to do with connection string.

That pointed me in the right direction.

I have found (rather a quick test I'm afraid - will do more testing here
later) that I have to strictly use the 32bit fbembed.dll in my
application... and that I also have to strictly target x86 cpu under the
advanced compile settings. Then the connection strings were fine.

If I have the compile settings set to -AnyCPU- (both x64 and x86) and try
and use the 64 bit fbembed.dll in the debug folder I get an error that it
can not find the fbembed.dll file.

More testing later...

R


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Firebird-net-provider mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
Loading...