Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Using ASP with MySQL

Posted by Steven_Price (Steven_Price), 25 February 2004
Hi, I want to connect my ASP webpage to a MySQL database but I am not sure how. I am using the connection string

set rs = Server.CreateObject("ADODB.recordset")
set conn=Server.CreateObject("ADODB.Connection")


conn.Open "Provider=MySQLProv;" & _
          "Data Source=mySQLDB;" & _
          "User Id=myUsername;" & _
          "Password=myPassword"



Do I just specify the data source of the MySQL database as c:\mysql\data\dbaccessibility\tblsitefeature.MYI?

Also does anyone know how I could upload this database to a server for web access?

I know I should probably use PERL or PHP but I need ti use to use Access.


Thanks
Steven


Posted by admin (Graham Ellis), 25 February 2004
Goodness ... I'm not a VB / ASP expert I'm afraid (have quite enough with all the other languages) but I know that will NOT be required to specify a table name with .MYI on the end of it.

The connection string / system looks like it contains the right sort of information; you'll then need to select the database to use, and isue SQL command via ADODB.

MySQL runs as a service (or a daemon if you prefer that term) and it takes care of what and where the files are kept - you simply conect to the service and watch the magic!

Posted by Steven_Price (Steven_Price), 26 February 2004
Ok thanks for this information Graham.

My situation is this, I have a MySQL database on my local machine.  I need to test it and transfer it to a development, mirror then live database server (which connects to a live webserver).

Ideally for collaborative working it would be best to edit the database on the dev server but I am not sure how to do this yet.

For now I would settle for just being able to test locally, upload and test from the dev server, and then upload to the live db server. I am guessing that I need the following software:

1. Local machine

MySql ODBC Drivers  (already installed), MySQL software (already installed), ASP Server.

2. Dev Server

MySql ODBC Drivers, MySQL software,  ASP Server  (already installed)

3. Live Database Server

MySQL software

4. Live Web Server

MySql ODBC Drivers, ASP software (already installed)

Am I on the right track, or am I missing anything major?

Thanks
Steve













Posted by admin (Graham Ellis), 1 March 2004
No glaring omissions that I can see - I think you're on the right tracks there. But - read my lips - I'm NOT a Microsoft expert so don't trust my answer 100%  

Posted by lostboy (lostboy), 31 March 2004
Hi Steven,

The connection type that you are defining here:
conn.Open "Provider=MySQLProv;" & _
     "Data Source=mySQLDB;" & _
     "User Id=myUsername;" & _
     "Password=myPassword"  

is confusing, the norms are DSN = something for a system set DSN on the server, not sure if you are doing this or at work we use a text string to hold the variables and then use the text string in th connection

ConnString = "DRIVER={MySQL ODBC 3.51 Driver};" &_
                             "SERVER=127.0.0.1;" &_
     "Port=3306;" &_
     "DATABASE=dbName;" &_
     "UID=root;" &_
     "PWD=roger;"

and
     
conn.open ConnString to actually open the connection.

As for test and development, then moving to a host machine, I would suggest that you use something like PhpMyAdmin to do a dump (structure or structure and data, as you please) to a sql file. Your host should have some version of a control panel for the db. You should be able to either copy and paste or run the file directly against the db engine to create the host copy of the db.

Another option is to FTP the various mysql files directly to the host, though the connection speeds that you have with the host and /or comfort levels with ftp may suggest another route.

hth



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho