473,503 Members | 10,012 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create a connection object (sql/oledb/odbc) based on connection method/string.

Hi...

I am a newbie VB.NET developer and i am looking at working with
ADO.NET rather than ADO. In one of our native VB application with ADO,
we used to create 1 connection object and that would help us to
connect to MS-SQL and MySQL alternatively based on the database type
and connection string i provide. So, one connection object was good
enough to connect to any of these 2 type of databases.

The sample connection string we use to connect to the databases are as
follows:

MS-SQL: "Provider=sqloledb;Data Source=<server_name>; Initial
Catalog=<database_name>;User Id=xxx;Password=xxx"

MySQL: "DRIVER={MySQL ODBC 3.51
Driver};SERVER=<server_name>;DATABASE=<database_ba me>;UID=xxx;PWD=xxx;OPTION=16427;"

With ADO.NET, it makes us create different connection objects based on
database type and connection string we use. To connect to MS-SQL
database, we will have to create an oleDBConenction object and for
MySQL database, we will have to create an odbcConnection object.

The challenge we face here though is that we had all our database as
MS-SQL and we are moving them to MySQL one by one (some are already
migrated to MySQL). And we would like to make our connect feature such
that it dynamically creates a connection object (any of sql/oledb/
odbc) based on what the back end is and what connection string/method
we are using. Is there a possible way to make it dynamics?

Any help on this one will be very much appreciated. Thanks.

Apr 26 '07 #1
2 6640
Hetal <he*************@gmail.comwrote in news:1177610297.674317.326590
@t39g2000prd.googlegroups.com:
The challenge we face here though is that we had all our database as
MS-SQL and we are moving them to MySQL one by one (some are already
migrated to MySQL). And we would like to make our connect feature such
that it dynamically creates a connection object (any of sql/oledb/
odbc) based on what the back end is and what connection string/method
we are using. Is there a possible way to make it dynamics?
You'll need to build a data abstraction layer. The problem with generic
data layers is that different databases support different features so I
believe that's why Microsoft created custom implementations for each
database.

However, there are a couple tools out there to make your ADO.NET "generic":

CoreLab's UNIDirect ADO.NET driver provides access to several database
platforms

Microsoft has the Data Access Application Blocks to may help to connect to
multiple databases.

You can use a DAL framework like LLBLGen Pro/CodeSmith (which contains
layers for several database).

You could build your own custom DAL.

I personally use the LLBLGen Pro DAL framework and it's great :-) Supports
SQL Server, MySQL, DB2, Firebird, Oracle, and more.
Apr 26 '07 #2
Thank you Spam Catcher.

Apr 30 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2732
by: William F. O'Neill | last post by:
Am working on a SQL Server 2000 db with Powerbuilder 8 as the frontend. For months our endusers connected thru the SQL Server native driver for version 6. Now, have just ported the application to...
1
3502
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
8
2165
by: John Smith | last post by:
How do I connect to a FoxPro 7 database?
4
8102
by: Wayne Wengert | last post by:
I am trying to create a VB.NET Windows application to move some data from a local Access DB table to a table in a SQL Server. The approach I am trying is to open an OLEDB connection to the local...
8
9607
by: Greg Strong | last post by:
Hello All, The short questions are 1 Do you know how to make DSN connection close in Access to Oracle 10g Express Edition? &/or 2 Do you know how to make a DSN-less pass-through query...
20
3242
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how...
13
2828
by: Jennifer.Berube | last post by:
well I'm not sure how to go about making my SQL connection string... The code below is what I need to replace with my SQL connection...I just don't know if that code is for DSN or access... I...
0
1350
by: Blackberry | last post by:
Hi All I was trying to setup IIS, ASP and MSDE 2000 Rel A on a machine yesterday and my usual SQL server OLEDB dsn-less connection string would not work on this machine. I know it's down to...
5
5794
by: Edwin Smith | last post by:
Hello: I'm using VS2005 with an ODBC database. I am trying to add a Dialog to an existing Database application to allow the user to select the database. We have 2 different databases with the...
0
7194
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6976
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5566
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4993
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.