IIS-8 and MySQL Server Settings

Posted on 2014-08-28
Last Modified: 2014-09-02
FYI - I have become somewhat of a Novice Web Developer being out of the game for several years. However, I NEED to get back into it for professional reasons now.

Question: How can I provide client access to my website through Classic ASP, on a .NET Framework, to a MySQL Database using ODBC connection string ?

I am working through a Web/Database PHP UI and have tried several times to manipulate the Web.Config file, collectively with a Database Connection String -using Driver 3.51 and 5.1 and neither are connecting me in order to Read/Write information to my Database. Some heads up, better yet, a solution would be greatly appreciated, thank you. Below, is the latest PHP Scripting file I created and the Web.Config file.

 * Generated configuration file
 * Generated by: phpMyAdmin 4.2.5 setup script
 * Date: Wed, 27 Aug 2014 23:11:32 -0600

/* Servers configuration */
$i = 0;

/* Server: MySQL1 [1] */
$cfg['Servers'][$i]['verbose'] = 'MySQL1';
$cfg['Servers'][$i]['host'] = 'MyHost-IP';
$cfg['Servers'][$i]['port'] = 3306;
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['ssl'] = true;
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['auth_type'] = 'http';
$cfg['Servers'][$i]['user'] = 'Crm';
$cfg['Servers'][$i]['password'] = 'Crm_1964';
$cfg['Servers'][$i]['only_db'] = array('CRM\\_');

/* End of servers configuration */

$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
$cfg['BZipDump'] = false;
$cfg['RecodingEngine'] = 'none';
$cfg['DefaultLang'] = 'en';
$cfg['OBGzip'] = 0;
$cfg['ForceSSL'] = true;
$cfg['ExecTimeLimit'] = 90;
$cfg['ServerDefault'] = 1;
<?xml version="1.0" encoding="UTF-8"?>
        <add name="MySQL1" connectionString="server=MyHost-IP;database=CRM_;user=Crm;password=Crm_1964;" />

Question by:Tom Cullen
    LVL 32

    Assisted Solution

    by:Big Monty
    I'm confused on what you're looking for... Do you want a classic asp example on how to connect to a mysql solution?
    LVL 52

    Assisted Solution

    by:Scott Fell, EE MVE
    Well, you have to decide if you want to use .NET or classic asp.  If you go .NET you can use some classic asp inside some <% %> tags but really if you are going .NET  you should be using MVC.  

    For classic ASP, you don't need a web.config for your connection string.  You can find connection strings on....

    Below are a couple of connection strings I use.  The top is for sql 2008/20012 and the bottom is for a remote sql server 2005.
    conn = "Provider=SQLOLEDB; datasource=localhost; Database=database_name; Uid=user_name; Pwd=password"
    con = "Driver={SQL Server};;Database=database_name; UID=db_username;PWD=db_password

    Open in new window

    The connection string is in your code and typically in a separate file where you use an include file at the top of your page.  This way, if the connection changes, you change it in one spot.  

    IF you have the connection string above in a folder called "conn" and file called connection.asp, then you would include it on every page using
    <!--#include virtual="/con/connection.asp"-->

    Open in new window

    You can use include file instead of virtual.  If you do, and you can use code like below, that means you have parent paths turned on and that is a security issue. If you have iis 7 or above and have not turned on parent paths, nothing to worry about.
    <!--#include file="con/connection.asp"-->

    Open in new window

    If you are just picking this stuff up, you may want to think about a different language.  I love classic asp and it is very easy to use.  According to MS, Windows server 2012 (which supports classic asp) will have an end of life on 2023    While that is 7yrs away, if your going to need to start thinking of remaking any site in classic asp in the next 3 to 5 years.  I would suggest start looking at PHP as that is an easier step then going to ASP.NET.  Also, if you are trying to break in, you will be in more demand with PHP or another language like .NET, Ruby or Python.
    LVL 1

    Author Comment

    by:Tom Cullen
    I have tried the basic connection strings where I am using what I used to use:

    strConn = "Driver={MySQL ODBC 3.51 Driver};Server=MyISP-Server;Database=CRM_;User=Crm;Password=;Option=3;"
    Set dbConn = Server.CreateObject("ADODB.Connection")
    dbConn.Open strConn


    I have tried using the ODBC 5.1 Driver as well

    First off, let me clarify something here too; Big Money, I am only writing in Classic ASP because an old client I had wanted it in Classic ASP - I could not offer him ASP.Net because I do not have enough practical experience in it YET :) For others, I am trying to teach myself ASP.Net and PHP as well for future relationships. The error I get on my ISP server is the "Internal Server Error 500"

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    When I look at the server logs, it is telling me that there is a misconfiguration with the database server and possibly the Web Server which is IIS 8.

    I use to use include files all the time to establish the connection "as listed above" and when I was done I simply would close out the connection. I also used to use IIS 6 and MySQL 4.0. and had no problem connecting to my database and processing data.

    So now, I am wondering if there is a security issue or something else in my settings that I am missing. I do not mean to confuse anyone, but it has been probably 5 years since I have been doing this :) sorry. It use to be my passion. Now, I simply want to get back into it and its unfortunate that I am still using Classic ASP.

    Thank you for your patience and understanding.

    LVL 1

    Accepted Solution

    Sigh, my ignorance is a bliss. Scott and Big Money, thank you very much for your time, I went back to review everything, including the server settings. What did I find, I had "checked" the Windows Authentication in the server properties and now I have gained access to my data. D'oh.

    I am sorry for wasting your time, but for the future, I will be using this network allot more as I venture into ASP.Net and PHP and hope you folks provide more assistance down the road.

    Thank you again and I will transfer each of you equal points here.


    Tom Cullen
    LVL 107

    Expert Comment

    by:Ray Paseur
    Going forward, this article may be helpful for getting started with PHP.  A lot of it will be redundant for you, but it can steer you toward well-vetted learning resources, and more importantly, steer you away from the many terrible and obsolete examples of PHP code that litter the internet.
    LVL 1

    Author Closing Comment

    by:Tom Cullen
    Each party gave me lots to think about and it was my own ignorance that brought me here in the first place. BOTH offered helpful support and redirection, I am convinced that I will be perusing ASP.Net and PHP as added Script languages.

    Thank you again.

    Tom Cullen

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
    What is an ISAPI filter?   •      It's an assembly (.dll file) that can add or change the way IIS works.   •      They can be enabled globally for your web server or on a site-by-site basis.   When the IIS server receives a request, enabling the ISAPI fi…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now