Subject | Connection String question - vb.net - embedded |
---|---|
Author | rickgeorge88 |
Post date | 2010-01-21T18:17:24Z |
Hello,
I have tried various ways of connecting (Google) to an embedded firebird database and I just can't seem to get the connection string correct. Such as:
Using conn As New FbConnection("Server=localhost;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- failed with a 'BadImageFormatException'.
What is the correct way to format a connection string? I have tried 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.
Thanks
I have tried various ways of connecting (Google) to an embedded firebird database and I just can't seem to get the connection string correct. Such as:
Using conn As New FbConnection("Server=localhost;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- failed with a 'BadImageFormatException'.
What is the correct way to format a connection string? I have tried 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.
Thanks