JDBC connection issue ubuntu and PHP Storm - mysql

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?

Related

How do I connect my Android Application to a MySQL database stored in a server?

Background on the MySQL database: it was created from a Wordpress website. As far as I know, it can only be accessed through PuTTy with the ff credentials given to me by my client who I’m making the app for:
hostname
port
my username to get into server
my password to
get into server
mysql username
mysql password
It says from multiple sites that this is the PHP syntax to connect Android to MySQL
// Connecting to mysql database
$con = mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD) or die(mysql_error());
It does not work and when checked for the connection error, it shows the error “Connection timed out.” when I put credentials needed (hostname, mysql
username and password). I’m assuming it’s because I need to get into the server first (with credentials #3 and #4).
Is there a workaround to this?
EDIT:
This is only based on the assumption that I am supposed to create a PHP file (that I will place inside a Jave file in Android Studio) to connect to their database. Are there other ways to connect to a private server?
Welcome Ateshi!
It sounds like you want an android app to directly access the mysql database that holds the content of a wordpress website.
The MySQL database server is most likely not publicly available on the internet for good reasons (security), as per this answer
You have posted some PHP code. PHP usually runs on the server alongside mysql, it not usually run on android.
Here is how you usually set up something like this:
Your android app makes a web request to http://yourexampleserver.com/example.php
Inside that example.php which is on the server, you have the PHP code that then does:
connects to mysql (with local credentials)
perhaps writes to the database
perhaps queries the database
formats the results into a useful format like JSON
The results are returned to java on your android which then usually shows them in the UI etc
This whole process is usually described as building a "webservice" for the app to use.
If however, you want the database contents to be stored offline and locally on android, then you probably need to connect to the server manually, export the database and download it, and then include it in your android project.

Outsystems: configuring a connection to access a MySQL database

I'm using Outsystems Service Studio to develop a web application. I need to configure a connection to access a local server database. I get "Connection String test failed: Unable to connect to any of the specified MySQL hosts." I just figured out I can't connect using "localhost", because the Outsystems server is not local, but I'm not able to find a solution. what is wrong? Other details:
MySQL Server is up and running
I selected MySQL in DBMS
Inserted my schema name
Inserted the username (with all privileges granted)
Inserted the user password
Tried both basic and advanced configuration. I inserted j"dbc:mysql://127.0.0.1:3306/mydb?user=outsystems2" as connection string parameters and I get "Connection String test failed: Keyword not supported.Parameter name: mysql://127.0.0.1:3306/mydb?user". I know this connection string can't work , but I'm not able to find a functioning one. I've read many guides about this configuration, but no solution was found. Thank you all for your time and help, feel free to ask for more details
Luciano,
Is your OutSystems environment on-premises or in the cloud? Either way, you need to make sure that this server is able to reach - it as connectivity - to your MySQL database server. Using localhost or 127.0.0.1 is pretty much the same thing as this is an address for the machine where the request is running, which is, in this case, the OutSystems server. Do you have the MySQL database on your local machine? This is not a good approach as you will need to have an address that won't change otherwise the connection won't be stable and you'd have to reconfigure it all the time.
Regards

How to access my newly setup MySQL database (getting "Domain is currently unable to handle this request.")

I just set up a new MySQL database with the MySQL workbench & created a user for it with all necessary privileges. I am using this database for use with my php code. But I can't seem to connect to it on my live server (pages are hosted on windows server 2012). Everything works fine in my local environment with xampp and the new MySQL database is exactly the same as the xampp one. I think I am maybe using the wrong host name or something. As host name I copied the name that is displayed after "Host:" when you click on Server Status in MySQL workbench. The database name, user & password should all be correct. But when my code tries to access the db I get a "The domain page isn’t working. Domain is currently unable to handle this request."
You either have no network connection to the server at all or it is blocked due to firewall or routing misconfiguration.
If you do have network access in general, you might forgot to
FLUSH PRIVILEGES;
or you have not enabled networking over TCP, the default is to listen only to localhost (on unix systems via unix sockets, on microsoft I guess it's simply TCP).
Read about the following configuration parameter which will solve your networking issue:
bind-address
If you have a very old MySQL server version, the parameter is enable-networking but it shouldn't be the case anymore.

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.

connect to mysql database using visual studio 2010 remotely

I am trying to connect to MySql db using VS2010. I added my ip address in cpanel allow hosts. I also grabbed the IP address for the server where the database is hosted which is just my website.
So I go to server explorer, right click database connections and clicked on add a connection
I select .NET Framework Data Provider for MySQL for Data Source
for Sever Name I typed the IP address for my website where the Database is
Typed in the user name and password who has all the privileges, and entered the Database Name too.
When I hit test connection I always getting "Unable to connect to any of the specified hosts"
any advice is appreciated
Thanks
So, in order to connect to a MySql database from VS2010 see the link bellow:
http://www.itcsolutions.eu/2010/09/09/how-to-connect-to-mysql-database-from-visual-studio-vs2010-problems-with-net-connectors/
Have you tried adding % as your access host under Manage Remote MySQL Access of your Cpanel?
Try this
http://zambalestechrealm.wordpress.com/2012/03/08/vb-net-remote-access-to-mysql-database-of-my-website-2/
It says
Goto Your site Cpanel, and look for MySQL remote access, in my case i put % in the list of user to access remotely to my database. ‘%’ percent means to allow all connection to connect to my MySQL database.