how to connect Coldfusion to a MySQL database - mysql

total newbie and totally lost...
I'm trying to setup coldfusion(8) with a mysql(5.5) database on a local (apache 2.2) webserver running Windows XP.
Coldfusion and Apache are running, but I don't know how to fiddle this in with MySQL.
I'm doing the following:
- Import file1.sql and file2.sql into MySql workbench (5.2) by reverse engineering
- Save this new model as base.mwb into my Apache htdocs folder
- Open the Coldfusion Administrator Data Sources
- Add new Source "myName", Database "base", localhost, 3306, root, password
When I try to add I always get Unknown database 'base' error.
I also tried to make a connection in MySQL or set up a new server instance in MySQL workbench, but these also fail because of no database "base".
I guess I'm missing something (probably a database :-)... Thanks for some pointers or a dummy tutorial. I'm longing for something to show up in http://localhost...

I would have to guess that you are coming from a background using Access DBs. MySQL and ColdFusion do not work together by have a DB file in the CF application. CF connects to a running MySQL server somewhere on your network (even on the same machine) using a JDBC connection. It does not look at a DB file and use that. So you will need to install MySQL Server and then import the DB into that. Then use CF's datasources to connect with that.

Related

Cannot connect to MySQL docker instance via DataGrip application

I have managed to successfully connect to a docker instance running MySQL via the mysql command line utility. However, I am struggling to do so via DataGrip application from JetBrains.
My mysql cli command is as follows:
mysql -h127.0.0.1 --port=8181 -uroot
The connection string that is generated in DataGrip is:
jdbc:mysql://127.0.0.1:8181
The error I am getting from DataGrip interface is:
[08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Is there anything that need to change in DataGrip that I am missing. I have read that the connection has to also be done via TCP. Not sure how to check that DataGrip is doing that.
Update: I eventually found the problem was the docker container I was using. It seems DataGrip is not able to connect to version 8.0.1 (mysql:8.0.1) mysql docker container. I tested using version 5.7 of the container and could successfully connect.
I was having an issue connecting MySQL 8.0.3 using DataGrip. You need to download the JDBC driver from Oracle website. Select Developer Releases (Since this is an unstable version). The 8.0.8 version worked for me. Download and save in a project folder or something similar on your computer. You will gonna need it later.
Go to DataGrip: File > DataSources. Click on the + and select Driver:
Screenshot of the Step above
On the section Driver Files > Additional files click on the + and select the jar file you just downloaded
After that on the Class dropdown select com.mysql.jdbc.Driver
Mark Dialect as MySQL
On the section URL templates, put the Name as default and Template as jdbc:mysql://{host::localhost}?[:{port::3306}][/{database}?][\?<&,user={user},password={password},{:identifier}={:identifier}>]
Click on apply
Done!
Screenshot of MySQL 8.0.3 running on Datagrip
Add a new datasource using the new driver.
If you find the following error:
[01S00] The server time zone value 'PDT' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support
You can do a temporary fix going to the Advanced tab and setting the serverTimezone variable for UTC as an example.
There are no *.jar-files anymore. Only *.deb-packages for my OS on the Oracle site https://dev.mysql.com/downloads/connector/j/5.1.html
So I selected driver Amazon Aurora MySQL for my MySQL 8.0.3 in docker.
It works!

Power BI not connecting to MySQL

I am trying to connect Power Bi (Desktop version) with my online amazon mysql database. It demands for following information once you try to establish connection
Server: server ip
Database: database name
Username: mysql username
Password: mysql password
First time I received a bit lengthy error, which was because of unavailability of mysql-connector-net-6.6.5.msi. So I followed this link to solve the issue
Microsoft Power BI connect to mysql
After installing mysql-connector I am facing another error.
Whats wrong? One of my mates has successfully connected using the same credentials that I am using.
Okay, I just figured this out for myself. I'm able to connect directly to a MySQL database on port 3306. As I understand, it would be more secure to go through an SSH tunnel, but this doesn't work yet with Power BI.
So here are instructions for connecting directly:
First, let's make sure that everything besides the PowerBI connection is working.
1) Download and install the correct version of the MySQL/Net Connector. Right now, version 6.6.5 is the one that works. But from other forums, and from within PowerBI itself, I linked to other versions that did not work. (You will know it isn't working, because you probably won't be able to even open Get Data/MySQL Database/Connect.)
2) See if you can connect remotely to your database through some well established utility like MySQL workbench. If you can't,
- look at ports on the remote server. Here's a cool utility to check ports&IPs: http://www.yougetsignal.com/tools/open-ports/
- Check the permissions of the DB user. Realize that they may be affiliated with an IP address: 'username'#'ipaddress'. So that user can only connect for a particular IP.
- Check the bind address setting. In newer versions of mariadb, it should probably be commented out. I'm not sure about older version and pure mysql.
- other troubleshooting.
So after that's working, here are the settings which worked for me in MySQL:
go to Get Data/MySQL database/connect
Server: ipaddress:3306 (include ":port#")
Database: dbname
PowerBI interface. Select "Database" instead of "Windows"
Make sure you select Database instead of Windows.
Good luck.
Just a small tip. If you haven't already, restart the machine you just installed the connector on. I had to restart before it started working.
My solution for this was to add the port number to the server name/ip
eg. 192.168.0.1:4664

Connection failed in using mysqlconnector ODBC to connect from sql to access

I am trying to connect mysql database in phpmyadmin to the access file. I am using mysqlconnector ODBC for that. Tutorial I am following is this
The problem is that when I give the credentials to connect to database, it gives me error as shown in this snapshot
I have tried hard to search on internet but failed. What mistake I am doing. I am putting the ftp information of the server there. Is there any database credentials i need to put?
You can't use the FTP credentials to connect the MySQL database. You have to use the database credentials. Make sure you have done followings before connecting.
Make sure MySQL server is up and running on the HOST IP and PORT.
Your MySQL server can accept connections from your IP or use % for
all IPS
Make sure you have a valid USER account
EDIT
Or tell us where(local server, internet, IP) the MySQL database is installed. The port number the server is listening on. How you access MySQL server normally.

OperationalError Lost connection to MySQL server at 'reading initial communication packet' DigitalOcean

Im having trouble connecting to my sql server on digital ocean through my flask webapp. Im using flask-sqlalchemy to bind the mysql database to Flask.
Im able to access the mysql server through the phpmyadmin interface at myipaddress:5000/phpmyadmin
Since Im using Nginx (I bound it to port 80). Bound Apache to Port 5000. So my phpmyadmin interface is accessible at
myipaddress:5000/phpmyadmin
In my flask app, i specify the
SQLALCHEMY_DATABASE_URI ='mysql://root:password#myipaddress:5000/databasename'
when i try to create the tables on my database using the shell with db.create_all() - it just doesnt respond. The cursor blinks forever and then i get the operational error that i quote on the title afte a few minutes
Im able to get the same setup running on my local dev machine. So i know its not a flask configuration problem but just a mysql access issue. I have my webapp up on digitalocean (Not sure if mysql server is behind a firewall or something like that making it inaccessible
On the
/etc/mysql/my.cnf
for the bind-address under mysql_d section, i tried all possible combinations and restarted the mysql server with no success
i tried localhost, 127.0.0.1, 127.0.0.1:5000, myipaddress for the bind-address (Also tried commenting it out) without any results.
Also i tried to get the user, current_user on the table properties from the mysql command line, it's listed as root#localhost for both
From this post:Lost connection to MySQL server at 'reading initial communication packet', system error: 0; i get the idea that its related to firewall but not sure how to rectify this.
Anyidea how can i connect my flask app to the mysql server ? Any help would be much appreciated
I was specifying the mysql address as
mysql://root:password#myipaddress:5000/databasename
But since my flask app and the mysql server are running on the same server, the flask app was be able to access the mysql server when i replaced the myipaddress:5000 with localhost:5000
mysql://root:password#localhost:5000/databasename
The phpmyadmin is just a web interface for your database, if you're looking at connecting your Flask application to your MySql database, you need to point the SQLALCHEMY_DATABASE_URI to the actual MySQL database, rather then the web interface to that database.
Usually MySql runs on port 3306. I believe that SQLAlchemy is clever enough to know that's the default, so your connection string should just be: SQLALCHEMY_DATABASE_URI ='mysql://root:password#localhost/databasename' or if you are running on a different port/external IP address: SQLALCHEMY_DATABASE_URI ='mysql://root:password#myipaddress:4444/databasename'. Remember, if you're connecting to a MySQL database on an external server (not the same one as your Flask app is running on) you will have to change the configuration to allow that kind of access.

Connecting Coldfusion 9 with MySql 5 on Ubuntu 9.10

I've recently set up a Ubuntu 9.10 server with a LAMP configuration and then installed Coldfusion 9 Development version as well.
I've got phpMyAdmin working, so MySql and PHP are fine, and I can serve coldfusion pages, but if I cannot verify my Coldfusion datasource. I get the following error:
Could not create connection to
database server. Attempted reconnect 3
times. Giving up.
With the top of the stack trace showing
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:
Could not create connection to
database server. Attempted reconnect 3
times. Giving up.
These are my settings for the datasource in the Coldfusion administrator
JDBC URL jdbc:mysql://192.168.1.19:3306/dbname
Drive class com.mysql.jdbc.Driver
Driver name ConnectorJ 5.1.7
And I know the username and password are correct as they're the same ones I use for phpMyAdmin. Does anyone have any ideas why it's not working?
I'm using almost the same configuration on few boxes and have no such problems, so it looks like you are misconfiguring the datasource.
Are you trying to create the dsn with "MySQL (4/5)" driver? I'm not sure how to read your settings string properly. Is that IP is your localhost? If yes, why not try to use the localhost for server name.
It's a permissions problem. The IP needed to be 192.168.1.19 in the DSN setup in the administrator, but that didn't fix it alone.
I also created a 'temp' MySQL user based on a post found here: http://www.linuxquestions.org/questions/showthread.php?p=4039359#post4039359
And used that instead, it worked.
Try using 127.0.0.1 as the MySQL server address in your DSN configuration