473,395 Members | 2,443 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Dynamically Choose Database

Greetings

I have several simple applications that work well, except for one thing.
The database seems to be hard coded. Normally what I do is go in to
Settings.settings, then change the value of my connect string to point
to the database I want, then redeploy. I have to change this string
every time I want a different database. Is there a better way to do
this? Maybe programatically somehow? Or something else? Any tips
greatly appreciated..

thanks
troy
Jun 10 '07 #1
11 1869
Troy Bull wrote:
Greetings

I have several simple applications that work well, except for one thing.
The database seems to be hard coded. Normally what I do is go in to
Settings.settings, then change the value of my connect string to point
to the database I want, then redeploy. I have to change this string
every time I want a different database. Is there a better way to do
this? Maybe programatically somehow? Or something else? Any tips
greatly appreciated..

thanks
troy

One thing I forgot to say, My number 1 preferred solution would be to
have my program just use an ODBC datasource say "mysource", so that
whatever database "mysource" points to is the database that my app would
go against. That way I can setup "mysource" on different client
machines different ways with different default databases and my app
would work without being redeployed for each different client.
Jun 10 '07 #2
"Troy Bull" <tr*******@gmail.comwrote in message
news:uk**************@TK2MSFTNGP04.phx.gbl...
My number 1 preferred solution would be to have my program just use an
ODBC datasource
ODBC is *extremely* old technology by now.

A native .NET data provider will run rings round ODBC in terms of
performance...

Do you need to support legacy RDBMS for which there is no .NET provider...?
--
http://www.markrae.net

Jun 10 '07 #3
Mark,

any hard data on performance gains/losses?

I am inclined to believe for standard 10/100Mb networks any difference is
negligible for client. Are any measurements available?

Thx
Alex

"Mark Rae" <ma**@markNOSPAMrae.netwrote in message
news:eb**************@TK2MSFTNGP03.phx.gbl...
"Troy Bull" <tr*******@gmail.comwrote in message
news:uk**************@TK2MSFTNGP04.phx.gbl...
>My number 1 preferred solution would be to have my program just use an
ODBC datasource

ODBC is *extremely* old technology by now.

A native .NET data provider will run rings round ODBC in terms of
performance...

Do you need to support legacy RDBMS for which there is no .NET
provider...?
--
http://www.markrae.net

Jun 10 '07 #4
Mark Rae wrote:
"Troy Bull" <tr*******@gmail.comwrote in message
news:uk**************@TK2MSFTNGP04.phx.gbl...
>My number 1 preferred solution would be to have my program just use an
ODBC datasource

ODBC is *extremely* old technology by now.

A native .NET data provider will run rings round ODBC in terms of
performance...
Thanks for the tip. The database I use is MSSQL 2005 so no need for odbc.
Do you need to support legacy RDBMS for which there is no .NET provider...?

Jun 10 '07 #5
Troy Bull wrote:
I have several simple applications that work well, except for one thing.
The database seems to be hard coded. Normally what I do is go in to
Settings.settings, then change the value of my connect string to point
to the database I want, then redeploy. I have to change this string
every time I want a different database. Is there a better way to do
this? Maybe programatically somehow? Or something else? Any tips
greatly appreciated..
Changing a config file if you change database should not be a
problem.

In fact I can not imagine any way where you would not need
to change something.

As long as your code does not need to be changed then you are
OK.

Arne
Jun 10 '07 #6
AlexS wrote:
"Mark Rae" <ma**@markNOSPAMrae.netwrote in message
news:eb**************@TK2MSFTNGP03.phx.gbl...
>"Troy Bull" <tr*******@gmail.comwrote in message
news:uk**************@TK2MSFTNGP04.phx.gbl...
>>My number 1 preferred solution would be to have my program just use an
ODBC datasource
ODBC is *extremely* old technology by now.

A native .NET data provider will run rings round ODBC in terms of
performance...
any hard data on performance gains/losses?
It would be easy to test.

But besides the performance there are a couple
of other disadvantages with ODBC:
- missing functionality like where parameters are
purely positional in ODBC
- the challenges in trying to guess what an ODBC
error message really means

Arne
Jun 10 '07 #7
"Troy Bull" <tr*******@gmail.comwrote in message
news:ua**************@TK2MSFTNGP02.phx.gbl...
Mark Rae wrote:
Thanks for the tip. The database I use is MSSQL 2005 so no need for odbc.
Hurrah!
--
http://www.markrae.net

Jun 10 '07 #8
"AlexS" <sa***********@SPAMrogers.comPLEASEwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
any hard data on performance gains/losses?

I am inclined to believe for standard 10/100Mb networks any difference is
negligible for client. Are any measurements available?
Loads - do a Google search.

Native .NET providers get the performance gain because they don't use the
additional layers that OleDb and ODBC have to use:
http://msdn2.microsoft.com/en-us/library/ms998569.aspx
--
http://www.markrae.net

Jun 10 '07 #9
MSDN Link has no data on this kind of performance issues you mentioned.
Recommends to use Odbc objects against ODBC sources and that's it.

Do you have in mind some specific googled source of information, which has
hard data on difference in performance?

I would like to find out what is current industry marker - what is max
slowdown to expect when using ODBC instead of .Net provider? My guess it
should be around 0-1% in average, but this is only a guess

However, I googled also this
http://ourworld.compuserve.com/homep...h/ODBCPERF.HTM
which basically confirms that ODBC might be fastest solution when used
properly.

"Mark Rae" <ma**@markNOSPAMrae.netwrote in message
news:uB**************@TK2MSFTNGP03.phx.gbl...
"AlexS" <sa***********@SPAMrogers.comPLEASEwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>any hard data on performance gains/losses?

I am inclined to believe for standard 10/100Mb networks any difference is
negligible for client. Are any measurements available?

Loads - do a Google search.

Native .NET providers get the performance gain because they don't use the
additional layers that OleDb and ODBC have to use:
http://msdn2.microsoft.com/en-us/library/ms998569.aspx
--
http://www.markrae.net

Jun 10 '07 #10
Arne Vajhøj wrote:
AlexS wrote:
>"Mark Rae" <ma**@markNOSPAMrae.netwrote in message
news:eb**************@TK2MSFTNGP03.phx.gbl...
>>"Troy Bull" <tr*******@gmail.comwrote in message
news:uk**************@TK2MSFTNGP04.phx.gbl...
My number 1 preferred solution would be to have my program just use
an ODBC datasource
ODBC is *extremely* old technology by now.

A native .NET data provider will run rings round ODBC in terms of
performance...
any hard data on performance gains/losses?

It would be easy to test.
So I did.

:-)

A completely randomly picked test gives:

SQL Client (2.0): INSERT 20000 rows: 9,109375 seconds
SQL Client (2.0): 50 SELECT 20000 rows: 1,75 seconds
OLE DB (2000): INSERT 20000 rows: 20 seconds
OLE DB (2000): 50 SELECT 20000 rows: 62,140625 seconds
ODBC (2000): INSERT 20000 rows: 16,65625 seconds
ODBC (2000): 50 SELECT 20000 rows: 47,8125 seconds
OLE DB (2005): INSERT 20000 rows: 17,28125 seconds
OLE DB (2005): 50 SELECT 20000 rows: 61,484375 seconds
ODBC (2005): INSERT 20000 rows: 13,96875 seconds
ODBC (2005): 50 SELECT 20000 rows: 47,734375 seconds

I can post the code if anyone wants to see it.

Arne
Jun 10 '07 #11
"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:46***********************@news.sunsite.dk...
SQL Client (2.0): INSERT 20000 rows: 9,109375 seconds
ODBC (2000): INSERT 20000 rows: 16,65625 seconds
ODBC (2005): INSERT 20000 rows: 13,96875 seconds
OLE DB (2000): INSERT 20000 rows: 20 seconds
OLE DB (2005): INSERT 20000 rows: 17,28125 seconds
That seems about right i.e. native .NET data provider is between 1.5 and 2
times faster than OleDb / ODBC for database writes...
SQL Client (2.0): 50 SELECT 20000 rows: 1,75 seconds
ODBC (2000): 50 SELECT 20000 rows: 47,8125 seconds
ODBC (2005): 50 SELECT 20000 rows: 47,734375 seconds
OLE DB (2000): 50 SELECT 20000 rows: 62,140625 seconds
OLE DB (2005): 50 SELECT 20000 rows: 61,484375 seconds
Nuff said... :-)
--
http://www.markrae.net

Jun 10 '07 #12

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

Similar topics

3
by: julian | last post by:
hi I was wondering if anyone can help me out on this.... I have dynamcally populated a drop down menu with data from an access database using ASP. The values seem fine, however when i pass...
1
by: Amir Eshterayeh | last post by:
Dear Friends I need to change the css file of my aspx files dynamically so users can choose their css file names and when page loads, it read css file name from database. I try to use...
8
by: simon | last post by:
On code behind file: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not Page.IsPostBack Then Dim ctrl As New LinkButton ctrl.ID =...
5
by: Amelyan | last post by:
How can I get state of dynamically created controls (RadioButton, CheckBox, TextBox.Text) on post back when I click submit button? The only way I know is by traversing Response.Form enumberator;...
8
by: utterberg | last post by:
Hi I'm adding two dropdownlist in my webform by clicking a button. I fill the first dropdown with some values from my DB and the other one when I choose from the first dropdown. But since theese...
2
by: filbennett | last post by:
Hi Everyone, I'm generally unfamiliar with Access form design, but have programmed Cold Fusion applications for a couple of years. I'd like to build a data entry form in Access that allows the...
0
by: =?Utf-8?B?Q29uY2VwdG9y?= | last post by:
Hi all, I created a new "Component Class" in a project (Add new... & choose "Component Class"). When you get into Design Mode you see the message: "To add components to your class, drag them...
0
by: lianaent | last post by:
Hi All, I'm brand new to asp.net 2.0, and have a simple task of just creating a quick and dirty data entry form with SQL Server 2005 on the back end. I added a gridview to my form, and I can...
8
by: rlm51 | last post by:
I have a database with several tables designating different product categories. Within each table is many rows representing different products. I want to be able to choose product category table...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
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...

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.