• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1297
  • Last Modified:

IIS-8 and MySQL Server Settings

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.


XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXX PHP COnfig File XXXXXXXXXXXXXXXXXX
<?php
/*
 * 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] */
$i++;
$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;
?>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXX WEB Config File XXXXXXXXXXXXX
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <connectionStrings>
        <add name="MySQL1" connectionString="server=MyHost-IP;database=CRM_;user=Crm;password=Crm_1964;" />
    </connectionStrings>
</configuration>

0
Tom Cullen
Asked:
Tom Cullen
3 Solutions
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
I'm confused on what you're looking for... Do you want a classic asp example on how to connect to a mysql solution?
0
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
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.... connectionstrings.com http://www.connectionstrings.com/

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};Server=www.someserver.com;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 http://support.microsoft.com/lifecycle/search/default.aspx?sort=PN&alpha=Windows+server&Filter=FilterNO.    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.
0
 
Tom CullenFounder / DeveloperAuthor Commented:
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

AND

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.

Tom
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Tom CullenFounder / DeveloperAuthor Commented:
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.

Regards,

Tom Cullen
0
 
Ray PaseurCommented:
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.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11769-And-by-the-way-I-am-new-to-PHP.html
0
 
Tom CullenFounder / DeveloperAuthor Commented:
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
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now