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

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
`

Related

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

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.

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 :)

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.

JDBC connection issue ubuntu and PHP Storm

Im trying to connect to the database using DB navigator in PHP Storm.
I can already connect to my database which is a VPS on digitalocean with php and PDO using localhost as the host and the username and password setup through PHPmyadmin. I don't understand why that works since my database is stored on Digital Oceans VPS but it works, i can write to and from the database no problem and access my database at www.mywebsite/phpadmin
normally when localhosts works it means i have LAMP installed on my local machine but i don't and when i worked previously with shared hosting for another site the host was the ip address.
Anyway i didn't worry about it since it works for my PHP connection but now im trying to use DB navigator with PHPstorm and it needs to setup the database connection. since im using the same username and password that works for php connection to the database i assume that is correct.
I have installed the driver library and selected the .com.mysql.jdbc.Driver as the driver.
for URL which i assume must be host i have tried the following:
pretend droplet ip = 123.456.789
pretend website is: www.mywebsite.com
jdbc:mysql://localhost:3306
jdbc:mysql://123.456.789:3306
jdbc:mysql://mywebsite.com:3306
jdbc:mysql://www.mywebsite.com:3306
None of these work and all say no packets received. I also tried with the data source option in php designer with the same results. Anyone know what the correct connection string is, maybe i have the string structured wrong, im new to ubuntu and these VPS systems, i have ssh access also if that matters?

EF4.1/MVC3 Database First: How to remove password from connection string

I'm building a website with EF4.1 and MVC3 (C#). Trying to find out what the proper way to remove the password from the connection string is. I've done some searching and can't seem to find anything that tells how to remove the password from the connection string.
I'm actually working on two different sites at the moment. One is hosted on GoDaddy and is using their SQL Server db. The other is hosted here at work and will be using SQL Server 2005.
Lastly, is it possible to do the database first code generation with a MySQL database? I'm personally more comfortable with MySQL and prefer it to SQL Server, but have had issues getting this to work.
If you should need any additional information please let me know.
You should probably encrypt your web.config connection strings before deploying it to the server.
AFAIK, if you connect to your server using SQL Server Authentication, the connection string needs the username and password. If your app and db servers had domain trust, you can use integrated mode / windows authentication / identity impersonate to have a password-less connection string. But most service providers don't let you do this -- they use SQL Server Authentication to keep customers out of their domain.
Either way, there is more sensitive information in the connection string than just the password. You should encrypt the whole <connectionStrings> node.