Non-GPL ADO.NET provider for MySQL? - c#

Is there any NON-GPL ADO.NET provider for MySQL ?
There is the official one from here
http://dev.mysql.com/downloads/connector/net
but unfortunately, it's under the GPL, not the LGPL.
I am developing an abstract class for database access.
I don't care whether the abstraction layer is going to be GPL,
but if it uses MySQL (I mean the MySQL ADO.NET provider, not the MySQL database itselfs) it will be GPL, and thus, any application that uses that layer, which is something I don't want...
Oh, and I know about nHibernate/Subsonic/otherORMs, but it doesn't fit my needs.
ADO.NET provider short of using ODBC of course.
Edit/Clarification:
Note that by "abstract class for database access", I don't mean write my own universal ADO.NET provider.
I mean writing a wrapper class around a set of already existing ADO.NET providers.

I got the perfect answer:
One can use System.Data.Odbc to get around it.
You can always say, it's generic ODBC, has nothing in particular to do with MySQL, easily replacable.
And whatever you put in the connection string is the problem of your customers.
If the SQL that you send over the ODBC connection works in MySQL/MariaDB only, that's regrettable - but no legal problem ;)
Edit - 2016 Update:
You can use the MIT-licensed MySqlConnector for .NET Core (which also works for .NET)
https://github.com/mysql-net/MySqlConnector

There is DevArt's ADO.NET provider for MySQL
http://www.devart.com/dotconnect/mysql/

Stop swallowing the Microsoft FUD.
This is covered by v2 of the GPL therefore, unless you intend to modify the supplied code and redistribute it (as opposed to bundling it with your own application) your only constrained in that you need to state that the bundle includes GPL v2.0 licensed code and reference the copyright owner (which you are nearly always required to do with most commercially licensed software anyway).

but if it uses MySQL it will be GPL
Ah - no. You can program it ina way it does not even KNOW it connects to MySql.
Isolate all abstractions into a separate assembly.
Implement your propietary interfaces in this (allowed).
Distribute the abstraction of mySql as gpl.
Finished.

Related

only WPF,WCF and ADO.net based .Net project while having DB as Sybase is it possible?

We are having 5 years old mini ERP applications LAN based (Intranet only) with us, written in ASP.net 2.0
Now Since requirement changes a lot and Workflow also changed a lot, we decided to rewrite it again from scratch using WPF,WCF and our own custom Data Access Layer.
As it is LAN based our organisations is having Windows only Systems , so We can install the client module on each system.We are planning to develop both (Browser Based HTTP) and WPF based (Desktop) client Modules.
So , basically what i want to know from you people is that
Is it possible to create a solution with WPF project template(for UI),WCF Project template(for Middleware) and custom Data Access Library(AS DataAccessLayer)?
Later on if needed we will give browser based HTML+jQuery UI also so can we reuse the code mentioned in 1# ?
Our client wants Sybase as DB so is it possible to make DAL through Sybase DB?
Dont treat it discussion type Question and Dont close it
I simply wants to know the solution as 3 answers to these 3 questions due to these strange requirement with us :)
The answer is that it is definitely possible to do all of this.
Creating a front-end in WPF, a middle tier in WCF and a custom Data Access layer will work out well for you. Here is some guidance on how to connect WPF and WCF: http://wcfguidanceforwpf.codeplex.com/
You can definitely replace the WPF front-end with a HTML+jQuery UI. Here is some code on how to make use of a WCF service through jQuery: link
C# can access Sybase just fine. See This
Adam,
Yes it possible to all three question.
The are frameworks such as Prism / Caliburn / MMVM Light which can help with you UI.
If you base you business logic behind a WEB Api (SOAP / REST), you should be able to use similar business logic for both.
The database providers for Sybase, but may want to consider using an ORM (Object Relation Mapper) (Nhibernate / Entity Framework)
Cheers
Iain
The first two questions are well covered by the other answers. For the Sybase portion of the question here is what you should know:
Whether you plan to use a straight ADO.NET data layer or an ORM, the required DLLs and configuration set up are applicable to both. If you plan to use NHibernate 3.0 with Sybase then you should review the information here because it must use the NHibernate 2.1.2 provided dialect. NHibernate 2.1.2 does work just fine out of the box with Sybase ASE version 12. For that version, configure NHibernate with this dialect & driver:
NHibernate.Dialect.SybaseAdoNet12Dialect
NHibernate.Driver.SybaseAdoNet12ClientDriver
The SqlAnywhere drivers are different I believe but for ASE the DLLs you'll need to reference are listed below. You can only get them from Sybase through their support program to comply with their licensing.
Lastly, the Sybase ADO.NET driver seems to be a thin layer over their unmanaged DLL and its usage and stability shows it. It is certainly finickier to configure than the other ADO.NET drivers I've worked with. For example, since Sybase isn't typically configured to support a Unicode character set you need to set/map the .NET string parameters to use AnsiString or AnsiStringFixedLength (or AseDbType.VarChar) as appropriate. What's even more bizarre is if you forget to do this, the driver will silently fail and just write a null value to the table column.
sbgse2.dll
Sybase.AdoNet2.AseClient.dll
sybcsi_certicom_fips26.dll
sybcsi_core26.dll
sybcsi_profiler26.dll
sybdrvado20.dll

What database APIs in C++ and C# are equivalent to JDBC in Java?

I have not done database programming in C++ and C# before, but did some in Java. Now I am asked to figure out the options to do it in C# or C++ (not sure which one yet). We may use the MySQL RDBMS.
I searched online and found .NET SQL Data Provider, OleDB and ODBC.
What other APIs exist?
What's your recommendation?
Do I need to buy separately?
Are they API can be used directly?
There is also a data provider in .NET for Oracle if you want to consider that.
The following data providers are actually included in .NET
OLDB
OLEDB
Oracle
SQL
You can start using these by including their namespaces and working with the relevant classes. You can also work easily with XML in .NET using the in-built classes. If this is your first time working with data in .NET I would strongly recommend reading up on ADO.NET and LINQ.
You can download MySQL connectors for .NET from the MySQL website: http://dev.mysql.com/downloads/connector/net/6.1.html.
Connectors to other DBMSes can be found on the database providers website. Some come pre-installed with Visual Studio.
An earlier question about C++ ORMs.
As for C#/.NET, there are native providers, the OLEDB provider, and ODBC provider. There are native providers for MySQL, PostgreSQL, MS SQL Server, Oracle, etc. The programming model is the same if you use the IDbConnection, IDbCommand, etc. interfaces.
If you don't want to write all the code yourself - iBatis.NET, Subsonic, NHibernate, etc. are good libraries to look at.

Beginner's database questions

I am, a beginner to databases, and am very inexperienced at programming generally. For a C# console app (I'm writing with VS Express), which after testing will have a UI added, I need to use a database to store its data.
Can someone tell me, or point me to, bare beginner's explanations, and pros and cons, of these database access methods so I can decide which I should use?:
SQLClient
ORM
OleDB
ODBC
ADO.NET
nHibernate
MS Enterprise Library
Quite the mix there ... first some explanations ...
1) SQL Client
An SQL client is an application that connects to a SQL Database for the purpose of querying / managing / working with the data in an SQL Database. (any program accessing a database, phpAdmin, SQLite Administrator, etc...).
2) ORM is object-relational mapping. Its a way to convert different types of data when data types are incompatible. Think about a car class that incorporates four instances of a tire class. This type of structure doesn't translate well directly to the types available in database design and may be a reason to use ORM. (To relate the objects (car, tires, etc..) into the plain database types (integer, float, blob, etc..)
3) OLE (pronounced Olay) DB Is the Microsoft method (API) for connecting to Database using COM. OLE DB is part of the MDAC Stack (grouping of MS technologies working together in a framework for data access).
4) ODBC is Open Database Connectivity and its an alternate API for for Database Management Systems (DBMS). Where OLE DB is a COM (Component Object Model) way to integrate with databases, ODBC aim's to be language independent.
5) ADO.NET is a set of base classes (API) for use in the .NET languages to connect to and communicate with Databases.
I would suggest starting with ADO.net for your C# background, OLE is typically for older (VB classic) applications, There is a good beginner tutorial here http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson01.aspx
Don't let all the terminology scare you off, once you jump in and start tinkering you will understand all of the answeres provided better...
Best of Luck in your coding!! :-)
SQLClient, OleDB, ODBC are the DBMS Drivers/ADO.NET implementations of different DMBSs (err, hope that makes sense). For example, SQLClient is the ADO.NET implementation for connecting to a SQL Server database. The choice between these drivers is just which database you want to use. For a beginner, I would suggest SQL Server as you probably already have some version of that installed.
ORM is Object-Relational-Mapping. This is a code-based implementation of an auto-mapping between your code-based models, and your database that stores it. If you don't want to manually touch the database for the time being as you are learning, this is a good option - it is something useful for pros and beginners alike, as it allows you to not worry about the underlying database implementation, or writing CRUD (create, read, update, delete) functionality yourself. Take a look at ActiveRecord for .net (http://www.castleproject.org/activerecord/index.html)
If you are looking for an easy introduction to databases in C# you want to use LINQ and a data context.
Simply add a "Data Context" to your project. Double click the file to open the designer for the LINQ data context. Open the "Server Explorer" in visual studio (under View) and connect to your SQL Server. Using that you can drag and drop your tables onto the LINQ designer in visual studio.
Jump on google and have a look at using linq with a context to do work on your DB.
I'll jump in here with LINQ to say that it encourages you to write better database code, that doesn't pull the whole dataset out in one go and operate on it, you defer queries and you can benefit greatly from the functional infrastructure they've built upon it.
But this has a big learning curve, best way to do it is to try different kinds of code and see the ones that make sense to you.

Alternative to SQL Server for a simple web app

I have a simple app written using SQL Server, Entity Framework, C# and WCF. When I wanted to share this app with my friends, I realised they didn't use SQL Server on their machine. I could go for SQL Server Express edition, as the usage of my app is personal and non-commercial.
I found MySQL as a popular alternative to SQL Server.
1) Would I be required to update my entities when moving to MySQL?
2) Should I anticipate code changes in my BL layer due to change in entities layer? (I am wondering whether entities was built for SQL Server)
Are there any databases similar to MS Access that is lightweight compared to MySQL?
Are there any databases that need not be installed but can be copied around like MS Access?
Appreciate your response!
Sounds like you want SQLite.
SQLite is a software library that
implements a self-contained,
serverless, zero-configuration,
transactional SQL database engine.
Very easy to deploy. Also, check out System.Data.SQLite.
According to the System.Data.SQLite page ...
Supports nearly all the entity
framework functionality that Sql
Server supports, and passes 99% of the
tests in MS's EFQuerySamples demo
application.
You should be good. :)
Im not sure how your BLL looks like and i have no experience with entity framework, but ive experienced multiple times that linq-to-sql works much better with sql-server as with any other database.
So unless you have a good reason not to use sql express, i'd advice to stick to sql express.
After all, you should always install something when deploying (unless you use xml as storage, which is quite well possible with linq-to-xml).
VistaDB Express Edition is also free for non-commercial usage and integrates good into .NET and VS. afaik it also works on a single local data file thus requires no specific installation on your friends' computers.
Otherwise I recommend using PostgreSQL over MySql since it is more standards compliant and has a nicer license.
I think what you're after is just a change in providers. What you need to use MySQL is the .Net Connector which supports most everything simple. It's not very mature yet so something very complex you may have issues on, but it should do most of what you want through Entity Framework.
With Entity Framework yes you can do updates, it's LINQ-to-SQL that doesn't update against any other databases (unless you use a third party provider like DotConnect)
SQLite is one alternative, but since multiple threads against it can cause major issues with it's operation, so if you need a major data store I'd go SQLExpress or MySQL.
Yes, you could use MySql with EF but I don't know if it would require changes.... I wouldn't be surprised if it does though. At the very least your physical DB would have to be ported / converted to MySql and that will take time.
I would assume that if you need to install a DB on your friends Pc's why not stick with SQL Express since you already developed in SQL Server on your box. Should be less issues with this than migrating to MySql.
I'd also vote for VistaDB 3 as it's so easy to deploy.

Third-Party Oracle Providers for .Net with object type support

I'm looking for a third-party Oracle Data Provider for .Net (ADO.NET) with a full support of Oracle object types (like geometries). I was foolish enough to use ODP.NET and now I'm paying the price - it's incredibly buggy and I just reached the end of the line (keep crashing IIS Pool - known issue, no resolution). I found dotConnect which is fine, just 4 times slower with object types than ODP.NET. Are any others providers which support Oracle objects?
As I'm looking into working with Oracle database from C#, here is what I can say as an update to this question.
These are the alternatives:
Microsoft's System.data.OracleClient is part of the .Net framework and requires Oracle Client installed or external dll's (but I think it's not supported anymore)
Oracle Data Provider for .Net (ODP.Net), is the offcial .Net provider from Oracle. I think it is part of Oracle Client install.
Third party Devart dotConnect for Oracle (follow me).
Third party Datadirect ADO.Net provider for Oracle (follow me).
I didn't dig deeper yet, but information is not so easy to find about Oracle connectors, so here is my contribution ;-)
Are you aware of the Oracle-published ADO.net provider ? this dll ships with the Oracle CLient, and is named Oracle.DataAccess.dll. The version I am using is ver 1.102.4.0, and is dtd 2/11/2008.
There is also this provider: http://www.datadirect.com/products/net/net_for_oracle/index.ssp . I don't know whether it supports spatial type mdsys.sdo_geometry.
In the last release Telerik OpenAccess introduced a flexible type mapping system which allows developers to easily work with custom DB types/UDTs. It ships with support for Geometric/Geographic data, and it is easy to create your own type converter to tell OpenAccess how to map any custom types you may have. The type converters work for all DBs OA supports, one of which is Oracle. :)

Categories

Resources