asp tutorials, asp.net tutorials, sample code, and Microsoft news from 15Seconds
Data Access  |   Troubleshooting  |   Security  |   Performance  |   ADSI  |   Upload  |   Email  |   Control Building  |   Component Building  |   Forms  |   XML  |   Web Services  |   ASP.NET  |   .NET Features  |   .NET 2.0  |   App Development  |   App Architecture  |   IIS  |   Wireless
 
Pioneering Active Server
 Power Search








Active News
15 Seconds Weekly Newsletter
• Complete Coverage
• Site Updates
• Upcoming Features

More Free Newsletters
Reference
News
Articles
Archive
Writers
Code Samples
Components
Tools
FAQ
Feedback
Books
Links
DL Archives
Community
Messageboard
List Servers
Mailing List
WebHosts
Consultants
Tech Jobs
15 Seconds
Home
Site Map
Press
Legal
Privacy Policy
internet.commerce














internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

HardwareCentral
Compare products, prices, and stores at Hardware Central!

Database Connection Optimization
By 15 Seconds Discussion List
Rating: 2.9 out of 5
Rate this article


  • email this article to a colleague
  • suggest an article

    Somewhat Confused, Aren Asks:

    Why would I want to use a manual DSN? Why would I want to use ODBC? In which cases is one better than the other?

    Stephen Clarifies:

    DSNs are part of ODBC. ODBC is a set of APIs for database access. One method of using ODBC requires a Data Source Name. Another method is a DSN-less connection which uses a text connection string and does not require a DSN. There is no such thing as a "manual DSN." There are two types of DSNs--User and System. User DSNs are only available to the user context that created them (and, thus, not much use for ASP). System DSNs are available system-wide.

    The other method you have for database access is OLE DB (although, technically, if you are using ADO, even when you use ODBC you are invoking OLE DB to get there). OLE DB uses a connection string that looks a lot like a DSN-less connection under ODBC.

    So, with that in mind, what exactly do you want to know? When should you use a System DSN? When should you use a DSN-less connection? When should you use OLE DB?

    Michael C. Inquires Further:

    I recently put an ASP site on Brinkster (the free version) and had to convert my ODBC DSN (for MS Access) connection strings to DSN-less, since their free hosting service doesn't support ODBC. I am not dead certain, but I think the DSN-less version is slower. It is hard to be sure, since up to this point I was developing it on my own machine using PWS, and of course this is going to be very responsive.

    So my supplemental question to the thread is, is using a DSN inherently faster than going DSN-less? (sounds like skinny-dipping, somehow)

    Michael R. Replies:

    If access, use the ole-db jet provider, not the odbc connector for access, and it should performa bit better. OLD-DB DSN-Less is the fastest, but odbc offers connection pooling, which lowers connect times.

    Magnus Shares His Own Practices:

    Rule number one on optimization for speed: Don't optimize for speed until the development process is done.

    Rule number two (which is a consequense of rule #1): Don't optimize.

    The code looks better with ODBC connections, therefore I use it :)

    Also, when migrating your Access DB to an MS SQL-Server located on another machine, you'll se real performance-benefits from using ODBC, because of connection pooling.

    David Rebuts:

    Has anyone read this:

    http://msdn.microsoft.com/library/techart/pooling2.htm

    Magnus, could you explain how your code "looks better" with ODBC connections? If you have connection strings in more than one place (i.e. not using Application variables or global constant), I wouldn't want to do a global replace on that. Yes, I know you *can* do that, but that is not the best way around it.

    Anders Provides His Own Rules:

    Rule #1: Always optimize your code, because you'll never get back to it later. The famous "if it ain't broken, don't fix it" mentality strikes again.

    Rule #2: Keep learning how to optimize your code by reading long threads on this list (some started by me), on important issues such as string concatenation and the like. (See Multiple Response.Writes vs. String Concatenation.)

    Optimization is king!

    Magnus Defends His Statements:

    Optimizing code mostly has a degenerating effect on code. My example below doesn't really make sense though, as D. Penton pointed out. I'm usually not a fan of slow websites, but I'm even less a fan of non-standard code.

    A program writte without any function calls could perform a bit faster than a program written with generalised functions.

    The later however saves time and money, and is therefore preferred. Of course destroying sessions when appropriate, and always destroying objects should be done, but that's not a matter of optimization, that's a matter of writing robust code.

    My philosophy is to always write easy-to-write and easy-to-use/reuse code, not fast code.

    When the two can be combined, i'm happy, when not I buy better hardware :)

    Anders Adds Hardware to the Mix:

    You should look into the new Tyan Thunder - Dual AthlonMP (Palomino chips) at 1.2Ghz, kicking ass to a Dual Xeon 1.7Ghz system. The database performance is about 30% better, and that using a chip which is 500Mhz slower. I'm building such a system for my own workstation, putting the old dual PII 350Mhz server in the closet, doing .. server stuff, uhm ..

    Michael R. Adds His Rules to the Discussion:

    Rule 1: Always optimize to the best of your knowledge. It's easier to do it now, then to re-do it later.

    Rule 2: Always take the time to re-do certain methods if you find a better way.

    First, using a connection string in an application variable, or global include works well, only have to create it, modify it once. Second, OLE-DB is faster than ODBC. Third, if the OLE-DB provider supports it, ADO will automatically try connection pooling if the connection properties (string) match. ODBC seems to manage connections a little better in some environments, but overall performance is better going straight to OLE-DB, which is what ODBC uses anyway.

    Ken Jumps In:

    Are we still talking about Access/Jet here? Then you really need to do some research: http://www.aspalliance.com/PeterJohnson/JetAdvice.asp http://www.adopenstatic.com/faq/whyOLEDB.asp are good places to start. Use OLEDB with Access/Jet, not ODBC - I don't care what your code looks like.

    Resources:

    Here are some more resources on database connection technologies:

  • http://www.mavweb.net/asp-samples/database-connection-strings.asp
  • http://www.able-consulting.com/ADO_Conn.htm
  • http://www.asp101.com/tips/index.asp?id=50

    This conversation string was taken from the 15Seconds ASP Listserv on 6/5/01. If you have an ASP-related question or would like to share some of your knowledge with others, you may join the list by clicking here.

  • Rate This Article
    Not HelpfulMost Helpful
    1 2 3 4 5
    Supporting Products/Tools
    Proposion N2N
    Proposion N2N connects Microsoft .NET applications to Lotus Notes and Lotus Domino databases. This ADO.NET managed data provider allows you to perform blindingly fast queries and updates of Notes data from ASP.NET pages, .NET web services, Windows, or Mobile applications. An innovative SQL-like query language leverages the unique features of Notes and makes collaborative software accessible to relational database programmers.
    [Top]
    Other Articles
    Sep 15, 2005 - Building an Image Keyword System
    Unlike text-based file formats image files aren't made up of words, which makes searching for an image file by keyword difficult. Instead of being able to simply open the file to see what it contains, we're stuck looking at the text around it and other metadata to determine the image's meaning. In this article, Ziran Sun shows you how to build a simple database-based image keyword system that allows you to associate keywords with images and use these keywords to make finding images easier.
    [Read This Article]  [Top]
    Apr 7, 2005 - A Step-by-Step Guide To Using MySQL with ASP.NET - Part 2
    In the second part of of his article on using MySQL with ASP.NET, Ziran Sun covers how to add a new MySQL user to the database server, assign the user the appropriate permissions, connect to the database, and build a simple ASP.NET page to perform a query.
    [Read This Article]  [Top]
    Feb 10, 2005 - A Step-by-Step Guide To Using MySQL with ASP.NET - Part 1
    Back in the days of classic ASP, if you were building a database-driven web site, your choice was either to invest a lot of money to get a copy of Microsoft SQL Server (or some other enterprise-ready database) or invest a lot of time finding a way to deal with the performance and scalability limitations of Microsoft Access. Luckily these days there's another viable alternative: MySQL.
    [Read This Article]  [Top]
    Jan 27, 2005 - Moving a Database from SQL Server 7.0 to SQL Server 2000
    Moving or copying a SQL Server database from one machine to another requires a lot of preparation in order to ensure a smooth transfer. In this article, Dina Fleet Berry examines the different methods and highlights the different issues associated with each of them.
    [Read This Article]  [Top]
    Jan 6, 2005 - Debugging a SQL Stored Procedure from inside SQL Server 2000 Query Analyzer
    There are many times when using SQL Server 2000 Query Analyzer to debug SQL statements is a better choice than debugging in Visual Studio .NET. In this article, Dina Fleet Berry explains why and walks you through the debugging process step-by step.
    [Read This Article]  [Top]
    Nov 24, 2004 - Persisting .NET Objects to SQL Server Using SQLXML and Serialization
    As a follow up to his article on retrieving objects from SQL Server using SQLXML and serialization, Gianluca Nuzzo discusses saving objects back to SQL Server using a schema definition file and updategrams.
    [Read This Article]  [Top]
    Sep 14, 2004 - Transaction Processing in ADO.NET 2.0
    One area that stands out when comparing ADO.NET 1.x to ADO.NET 2.0 is transaction processing. Bill Ryan shows just how easy transaction processing has become with the TransactionScope object in ADO.NET 2.0.
    [Read This Article]  [Top]
    Sep 8, 2004 - Custom Object Data Binding with .NET
    Developers often use brute force coding to marshal data between the GUI and application objects. In this article, Luther Stanton explains how to use .NET's out-of-the box data-binding functionality to make this job much easier.
    [Read This Article]  [Top]
    Sep 2, 2004 - Queue MSMQ Messages from SQL Server
    Learn how to create a console application to queue a message in Microsoft Message Queuing (MSMQ) and then use an extended stored procedure to call the console application from a SQL Server trigger.
    [Read This Article]  [Top]
    Aug 30, 2004 - Tuning Up ADO.NET Connection Pooling in ASP.NET Applications
    Connection pooling increases the performance of Web applications by reusing active database connections instead of creating a new connection with every request. This article shows how to monitor the connection pool, diagnose a potential problem, and apply the appropriate fix.
    [Read This Article]  [Top]
    Mailing List
    Want to receive email when the next article is published? Just Click Here to sign up.

    Support the Active Server Industry



    JupiterOnlineMedia

    internet.comearthweb.comDevx.commediabistro.comGraphics.com

    Search:

    Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

    Jupitermedia Corporate Info


    Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

    Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

    Solutions
    Whitepapers and eBooks
    Microsoft Article: HyperV-The Killer Feature in WinServer ‘08
    Avaya Article: How to Feed Data into the Avaya Event Processor
    Microsoft Article: Install What You Need with Win Server ‘08
    HP eBook: Putting the Green into IT
    Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
    Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
    Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
    Avaya Article: Setting Up a SIP A/S Development Environment
    IBM Article: How Cool Is Your Data Center?
    Microsoft Article: Managing Virtual Machines with Microsoft System Center
    HP eBook: Storage Networking , Part 1
    Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
    MORE WHITEPAPERS, EBOOKS, AND ARTICLES
    Webcasts
    Intel Video: Are Multi-core Processors Here to Stay?
    On-Demand Webcast: Five Virtualization Trends to Watch
    HP Video: Page Cost Calculator
    Intel Video: APIs for Parallel Programming
    HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
    Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
    MORE WEBCASTS, PODCASTS, AND VIDEOS
    Downloads and eKits
    Sun Download: Solaris 8 Migration Assistant
    Sybase Download: SQL Anywhere Developer Edition
    Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
    Red Gate Download: SQL Compare Pro 6
    Iron Speed Designer Application Generator
    MORE DOWNLOADS, EKITS, AND FREE TRIALS
    Tutorials and Demos
    How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
    eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
    IBM Article: Collaborating in the High-Performance Workplace
    HP Demo: StorageWorks EVA4400
    Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
    Microsoft How-to Article: Get Going with Silverlight and Windows Live
    MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES