How to connect Classic ASP code to FreeSQLDatabase.com database? - mysql

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.

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.

Related

Classic ASP - connect to PHPMyAdmin MySQL database - is it possible?

I created a database with PHPMyAdmin. I have the IP address of the PHPMyAdmin web server. I also have the name of the database, as well as the login credentials (username and password) to log in and access the database.
Here is the thing though - my ASP code is another web server, not the PHPMyAdmin web server.
Would it still be possible for me to access the database in the PHPMyAdmin web server from another web server? (Both have different IP addresses).
If so, how would I do that?
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="PHPMyAdmin"
conn.Open ""
In the classic ASP code above, I am not sure if I am calling the provider correctly. I am also not sure what to put inside the conn.Open quotes.
If what I am trying to do is feasible, how should I change the code above?
For security reasons (and other reasons I'd rather not go into), I cannot store my ASP code in my PHPMyAdmin web server.
PHPMyadmin isn't a database connector, it's an application written in php which enables you to administer a MySql database.
You can connect to MySql with Classic ASP. First you need to install the MyODBC connector on your webserver then you can use a connection string like this
set conn=Server.CreateObject("ADODB.Connection")
conn.open "Driver={MySQL ODBC 5.2 UNICODE Driver};Server=[address/ip of database server];Database=yourDB;User=yourUsername;Password=yourPW;Option=3;"
The connection string will depend on which version of the driver you have installed, see this site
As the database and website are on different servers, you'll need to make sure that the MySQL port on your database server - usually 3306 - accepts external connections
If you're on shared hosting then you need to ask tech support if the MyODBC driver is installed, and which version
`

Password change broke SQL ODBC connection

I have a legacy HR application using a SQL database. The vendor provides NO support. A sql account password changed and apparently it was the account used for the ODBC connection. No one knew the old password. Now the HR app can't connect to Database. Any suggestions on how to reconfigure the ODBC connection with the new password?
Thanks a million for any help!
Error Message
Can you get on the server and look at ODBC connections? Check for the HRsql connection, locate the user, and reset his connection inside of the database.

ms Access MySQL file ODBC connection ODBC--call failed

Im having trouble using the MySQL ODBC connector.
I have a MS access frontend that im trying to connect to a MySQL DB. It connects fine when running the frontend and DB on my dev machine.
I have moved the front end and DB onto the clients server. The clients assess the fornt end via a shared folder on the individual user PCs. I have set up a file DSN ODBC connection as below. When i open the front end on one of the clients PCs i get the ODBC--call failed.
How do i get the linked tables to look at the server MySQL DB considering ms access is not installed on the server. I have tried to set uo the file DSN via the users pc i.e. open linked table manager and open the File DSN get the ODBC--call failed on connect.
File DSN set up
[ODBC]
DRIVER=MySQL ODBC 5.3 Unicode Driver
UID=root
PASSWORD=root
DFLT_BIGINT_BIND_STR=1
PORT=3306
DATABASE=productionlist_be
SERVER=localhost
thanks in advance Kelly
Welcome to stack-overflow Kelly.
You are missing few points.
The MySQL database Server must be accessible by all your clients.
Either a local machine hosting MySQL server or from internet its up
to you
Must have a static IP or domain name.
Access Front-Ends should not be shared but sent to all of your clients/employees
(This way you are achieving true "multi user access" and thats the main idea behind front and back ends)
All of your client PC must have MySQL ODBC driver installed
All of your clients must have required version of Access or Access Runtime installed
Only after setting up all this, you can think about distributing your application to your clients.
Modify your File DSN replace the localhost with the MySQL Database server ip
like
SERVER=SERVER_NAME_OR_IP
Also it is best to refresh the odbc links via VBA code
you will find much help here:
How do you programmatically update a linked table in Access that will refresh data types too?
OR
Relinking database tables: Access, VBA
hope this helps to get started :)

MySQL Connector/ODBC MS Access won't connect

I have a MS Access front end that connects to a MySQL database. When the computer running Access is on the same network it works fine but trying to do it remotely is not working.
I can connect with MySQL workbench so I know the port forwarding is setup correctly.
I can test the connection from the connector panel and it says its successful.
When I click OK the connector box disappears, Access freezes for a while, then the box reappears.
For troubleshooting purposes I also tried to connect over a VPN which produced the same results. Using the ip given by the vpn. I've also tried the ip of the host network.
Connection String:
[ODBC]
DRIVER=MySQL ODBC 5.2 ANSI Driver
UID=kristim
DFLT_BIGINT_BIND_STR=1
PORT=3306
DATABASE=awanacontrol
SERVER=****.****.com
It seems to have been a simple issue of starting from the beginning. I was trying to change the address of the already linked tables. In order to get it to work I needed to be sure to delete all linked tables and link them again with a new ODBC string with the DNS name.

VBA ADOBC secure connection

I'm working on an Excel client for our company. It requires several connections to a MySql database (which is a PC running Apache Server(XAMPP) located in our office). I'm able to connect remotely and push/pull data fine so development is going good in that respect.
But, my only concern is how secure the connection is over public networks (i.e. hotels, restaurants, airports)?
If odbc connection string data is easily sniffed I'll need to find another way. I Hope you can point me in the right direction if that is the case.
Driver: MySQL ODBC 3.51 Driver (installed by MySQL Connector)
Provider: MSDASQL
I would like to add remote authentication on startup because it may be required from time-to-time to disable access for a particular user.
Added:
Would this secure a connection on public network If I added security certificate on remote server and the Excel client used ssl connection string like so?
Driver={MySQL ODBC 3.51 Driver};Server=myServerAddress;Database=myDataBase;
User=myUsername;Password=myPassword;sslca=c:\cacert.pem;
sslcert=c:\client-cert.pem;sslkey=c:\client-key.pem;sslverify=1;Option=3;
Thanks for your help.