ASP
  Home arrow ASP arrow Using MySQL with ASP
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP

Using MySQL with ASP
By: David Web
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 8
    2008-10-14

    Table of Contents:
  • Using MySQL with ASP
  • Connecting with ASP
  • Script Explained
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using MySQL with ASP


    (Page 1 of 4 )

    In this article I will show you how to use MySQL with ASP. It is often said that open source and commercial software are not the best of friends. But in this case you will see that there are exceptions.

    The requirements

    First you need the following tools:

    • MySQL database server, available from http://www.mysql.com/ .

    • ODBC 3.51 (also available from link above) - This is the driver that will enable you to connect to MySQL from within ASP.

    • Any MySQL Client (for example, Mysqlfront available from http://www.anse.de/mysqlfront/).

    • An IIS server (I'm using IIS5) or a web server that is capable of rendering ASP pages.

    Now install all of them and restart your computer to make sure that everything is properly set up. After you have finished setting up the MySQL database server and the client, create a new database, add the following SQL and run it.

    # Database : `userinfo`

    #


    # --------------------------------------------------------


    #

    # Table structure for table `guests`

    #


    CREATE TABLE `guests` (

    `gid` int(4) NOT NULL auto_increment,

    `name` varchar(20) NOT NULL,

    `comment` text NOT NULL,

    `dateAdd` date NOT NULL,

    PRIMARY KEY (`gid`)

    ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;


    #

    # Dumping data for table `guests`

    #


    INSERT INTO `guests` VALUES (1, 'Dennis Brown', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.', '2008-07-31');

    INSERT INTO `guests` VALUES (2, 'Xuros', 'sed diam voluptua. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.', '2008-07-31');

    The SQL above simply creates a table called guests, from which you will be retrieving data shortly. Also, please write down the user name and password that you create during the installation process; you will need it in the next section.

    The next step is to set up a system DNS. Open up the control panel on your computer and then go to Administrative Tools->Data Sources (ODBC). A screen that looks like this should come up:



    Click on the System DSN tab and then add the button. You should now see a window that looks something like this:



    Scroll down, select MySQL ODBC driver and click "Finish." You should now come to a window that looks something like this:



    What you need to fill in is the user name and password. If you have installed MySQL 5, your username will almost certainly be "root." As for the password, you will be the only one who knows what it is. Once your password and user name is filled in, you will be able to view a list of databases from the drop-down box. Select the userinfo database from there. Click OK until all the dialog boxes are closed.

    More ASP Articles
    More By David Web


       · Friends I'm devouring my own 2 ever since What happens when someone with a...
       · Friends I'm devouring my own 2 ever since What happens when someone with a...
     

    ASP ARTICLES

    - Using MySQL with ASP
    - ADO for the Beginner
    - ADO.NET 101: Data Rendering with a DataGrid ...
    - Introducing SoftArtisans OfficeWriter 3.0 En...
    - Getting Remote Files With ASP
    - The Real Basics of Functions in ASP
    - Enhancing Readability with ASP
    - Mimicking PHP's String Formatting Functions
    - Windows Server Hacks 12, 77, and 98
    - How to Sort a Multi-Dimensional Array
    - Developing an Information Management Tool wi...
    - What are Active Server Pages?
    - Getting Remote Pages with ASP
    - FTP’ing Files with ASP
    - Apply Single-Sign-On to Your Application





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    Stay green...Green IT