1

I created a free SQL database from https://www.freesqldatabase.com/

Upon creating the database, I was given a server/database host link, port number, database name, username, and password.

Using that information, how do I connect to the database with Classic ASP?

This is the code I've written so far -

set conn=Server.CreateObject("ADODB.Connection")
conn.Open "Driver={MySQL ODBC 5.2 UNICODE Driver};Server=sql3.freesqldatabase.com;Database=dbname;User=username;Password=password;Option=3;"

It doesn't seem to do the work, though. What changes should I make so that I am able to connect to this database successfully? The database is hosted through PHPMyAdmin but I don't think that matters.

derloopkat
  • 6,232
  • 16
  • 38
  • 45
coderboyo
  • 11
  • 1
  • Presumably you've downloaded and installed the MySQL ODBC driver on your server, and your connection string reflects the version of the driver you have installed – John Jun 16 '20 at 09:55

1 Answers1

1

You mention that the provider provided;

"server/database host link, port number, database name, username, and password"

However, I don't see a reference to a port number in the connection string.

Here is an example with a port number;

conn.Open "Driver={MySQL ODBC 5.2 UNICODE Driver};Server=sql3.freesqldatabase.com;Database=dbname;Port=1234;User=username;Password=password;Option=3;"

If you intend to connect remotely via TCP/IP the correct port number will be required or the provider will likely block the incoming traffic at their firewall.

user692942
  • 16,398
  • 7
  • 76
  • 175