当前位置:编程学习 > C#/ASP.NET >>

C#操作firebird数据库

 

Download firebird下:http://www.firebirdsql.org/en/downloads/

FAQ:

。Can I use a relative path to the database in the connection string?

Yes. It can be relative to the working directory.

。How many concurrent connections can you open using the embedded Firebird?

It's not limited. However, only one application can open a database at a time. The application can be a regular Firebird

server or your application using the fbembed.dll.

。What files are required to use the embedded Firebird?

The following files are required:

·fbembed.dll (the embedded Firebird itself)

·FirebirdSql.Data.Firebird.dll (the Firebird ADO.NET Provider assembly)

The following files are recommended:

·firebird.msg (friendly error messages)

The following files are optional:

·aliases.conf

·firebird.conf

·ib_util.dll

·intl/fbintl.dll

·udf/fb_udf.dll

·udf/ib_udf.dll

。Where should I put the embedded Firebird files in my application?

Put them in the working folder of your application. Typically it will be the directory where your .exe file lies.

Connect to a embedded database

Firebird ADO.NET provider supports a new class (FbConnectionStringBuilder) that makes the work with connection strings much easier:

You can create a connection string by specifying the properties item by item:

 

FbConnectionStringBuilder csb = new FbConnectionString(); 

csb.ClientLibrary = "fbembed.dll";//把该文件放入应用程序所在目录 

csb.UserID = "SYSDBA"; 

csb.Password = "masterkey"; 

csb.Database = "lix.fdb"; 

csb.ServerType = FbServerType.Embedded; //csb.ServerType = 1, embedded Firebird 

FbConnection c = new FbConnection(csb.ToString());

FbConnectionStringBuilder Properties Overview

补充:软件开发 , C# ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,

FbConnectionStringBuilder Property

Type

Description

ConnectionLifeTime

System.Int64

When a connection is returned to the pool, its creation time is compared with the current time, and the connection is destroyed if that time span (in seconds) exceeds the value specified by connection lifetime.

ConnectionString

System.String

Here you can get or set the entire connection string.

ConnectionTimeout

System.Int32

The time to wait while trying to establish a connection before terminating the attempt and generating an error.

Database

System.String

The database path to establish the connection. Can be relative to the server executable or fbembed.dll (embedded Firebird).

DataSource

System.String

The server name for establish the connection.

Dialect

System.Byte

Database dialect (1 or 3). Use 3 unless you want specifically use dialect 1 for backwards compatiblity.

FetchSize

System.Int32

Indicates the number of rows that will be fetched at the same time on Read calls into the internal row buffer.

Charset

System.String

Connection character set.

IsolationLevel

System.Data.IsolationLevel

The maximum number of connections allowed in the pool.

MaxPoolSize

System.Int32

The maximun pool size.

MinPoolSize

System.Int32

The minimum number of connections allowed in the pool.

PacketSize

System.Int16

The size (in bytes) of network packets used to communicate with an instance of Firebird Server.

Password