Create embedded mysql database
How to create an embedded 开发者_如何学运维mysql db with C#?
Define "embedded"
If you're trying to use MySQL without installing MySQL, you're out of luck. SQLite and SQL Server Compact Edition (see Matthew's link) are about your only options for using a database without installing a server.
"The embedded server library is based on the client/server version of MySQL, which is written in C/C++. Consequently, the embedded server also is written in C/C++. There is no embedded server available in other languages"
http://dev.mysql.com/doc/refman/5.0/en/libmysqld.html
You should check out SQL CE 4.0.
http://www.microsoft.com/sqlserver/en/us/editions/compact.aspx
I created an application that embedded SQLite and alternately SQL Server CE. Of the two I found that SQLite was much easier to implement and required no standalone installation to work properly.
I found SQL Server CE to be extremely limited in basic functions for working with data and did not allow me to implement what was missing as User Defined Function in C#. On the other hand SQLite provided a richer set of functions out of the box. It also allowed me to implement any UDFs I wanted in C#. The result was that it was far easier to implement my application.
The one drawback I had using SQLite was in the mapping of data types imported from SQL Server. SQLite they always returned long values as output when the input was only integer and in some cases the return values from the ADO provider were long values when the actual values were float or doubles. It did not always play well when numeric types were first null or integer and later valid doubles and rounded when it should not have. I was forced to implement explicit double expressions when querying the data to prevent rounding.
While both allowed me to store data and to execute SQL I found SQL Server CE to be too limited from a functional perspective and ultimately I did not use it in the final result.
精彩评论