Accessing MySQL Database on XAMPP From a Remote Machine - java

I am trying to access a my MySQL database thorugh a program I have written that is currently being stored and run on XAMPP on my local machine. I'd like to connect to it from a different machine that is on the same network so they can access the database read/write etc. I am however having no luck in connecting. I've packaged the Java program into an exe that I am running on the remote machine. I've tried a number of solutions already;
I've created a user in PHPMyAdmin that can connect from any host, and has all priveleges granted on the database in question.
I've edited my program for the remote machine so that "jdbc:mysql://localhost/sdcjobs"; is now "jdbc:mysql://(theipaddressofmymachine)/sdcjobs";
I've edited my ini file (C:\xampp\mysql\bin\my.ini) so that bind address is uncommented as now bind-address=0.0.0.0
One of the main question marks for me is what software needs to be installed on the remote machine. On my machine (the one thats running the server) I have XAMPP installed that is running an Apache server and a MySQL database. On the remote machine I've installed nothing aside from my Java program, does the remote machine also need MySQL installing on it?

Have you tried to connect to your remote database with tools like mysql workbench or heidisql? If this does not work too, it could be a configuration issue in your my.ini
Please don't forget to restart your mysql service after changing your config.
Take a look at the mysql docu: http://dev.mysql.com/doc/refman/5.6/en/problems-connecting.html

Related

How to connect SQL Server with Metabase in local instance

I am using windows 11 and I have installed SQL Server for learning purposes. While logging into the SQL Server I am using Windows Authentication which means I don't have any password for the username.
Now, I want to learn Metabase. So I have installed Metabase with a local instance by downloading the Metabase Jar from the Official Website of Metabase. I have successfully installed the Metabase in the local instance and it is working fine.
Here comes the issue while connecting the SQL Server with Metabase I am facing issues and the connection is not established. It's saying Failed Try after 10.0 sec only.
Can anyone who successfully connected SQL Server with Metabase tell me what details need to be provided in the below images?

Can't connect to an AWS MySQL RDS using JDBC when site is deployed to elastic beanstalk

So I created a MySQL DB on amazon running on the same account as my tomcat server, it built and is running correctly but can't connect to the database.
I can access the remote database running the site using tomcat on my computer, and I can access the db through MySQL workbench, but when I deploy and run it I get a 500 whenever the site tries to access the database.
I opened up my security on this database to accept any connection and port(lol), and I checked if the mysql java connector.jar in the WEB-INF/libs file is the latest version. I even tried setting the JDBC connection string to localhost to see if it would pick it up, but no luck.
I think I'm missing something, can anyone think of any reason my website's JDBC can access the remote database server from my machine but not from the amazon tomcat server?
Also, this is a student project I'm building.
Hope this description makes sense, maybe someone can think of something I haven't tried:)

How to connect to a mysql database that is on a virtual machine

I have a problem while trying to connect to my database.
I have on my windows pc a java app and in a Linux virtual Machine (Ubuntu) a mysql Database. Is there anything i need to configure in order to connect my java app to my mysql database?
Thanks
First make sure that you are able to connect to the database server from your windows machine(cmd). If you not able to, give the necessary permission for the user in your mysql server.
http://stackoverflow.com/questions/13752424/how-to-connect-from-windows-command-prompt-to-mysql-command-line
What was happening was that when you install postgres in linux, you have to set a password, i mean it hasnt came with a pass

Can a Java application running on a Window's Server connect to SQL Server via Windows Authentication

Let me give some background before I ask my question. I’m at a shop that primarily runs Windows. We have several batch applications running on Windows Servers (mostly 2003). Most of these batch applications are written in C# and C++; however we have a handful of applications that are written in Java.
The batch Java applications are connecting to a SQL Server 2005 database using JDBC. Please note we are not using an application server.
Currently we store database connection information (database, username, & password) in the Windows Registry.
Unfortunately these really unfriendly auditors (bad attempt at humor) are not happy with us over the decision to store database connection information in the Windows registry.
We are now updating our batch applications to connect to SQL Server using Windows Authentatication.
Using Windows Authentatication for C# and C++ applications is not a problem; however I’m stuck on the direction to take for the Java applications.
Can anyone advise if it is possible to use Windows Authentatication to connect to a SQL Server 2005 database from a Java batch application running on a Windows server? Again we are not using an application server.
If this is possible what are your recommended approaches?
I have a strategy to simply encrypt the password which will make the auditors happy, however I would prefer to have all of my batch applications connect to SQL Server via Windows Authentatication.
You can connect to SQL Server from Java programs using windows authentication as follows:
Create a windows account for the application that would be used to run your programs. This account's credentials will be used to connect to the server.
Get Microsoft JDBC Driver for SQL Server from here.
Configure the JDBC URL as follows:
jdbc:sqlserver://<hostname>;databaseName=<DBName>;integratedSecurity=true
Configure the launcher that run the Java programs from command line to include the following JVM parameter:
-Djava.library.path="<jdbc driver dll location>"
where the location is the directory where the JDBC driver downloaded earlier is installed or extracted. It was C:\Program Files\sqljdbc_4.0.2206.100_enu\sqljdbc_4.0\enu\auth\x64 in my case. As Luke Woodward mentioned in the comments, the dll should be picked based on the JVM used for running these programs.
With the above configuration, the connection established to SQL Server would use the Windows Authentication Credentials of the domain user running the java program/process.
The first step is to setup ODBC, you can go to Control panel -> Administrative tools -> ODBC. Add a new DSN to connect MS SQL Server using windows authentication account following wizard setup.
The second step is the same as using SQL Server authentication account. But the only change is that the connection string is changed to: jdbc:odbc:dsn-name. There is no need to use username/password anymore, because it is already connected to the server.

App Java and hosting mysql

I have a Java application and I have to connect to a MySQL DB host in aruba.it. If I make a connection, aruba.it refuses that. How to solve this?
To start, I assume that you're trying to run this Java application locally, or at least at a different machine than where the MySQL DB runs and that you got a SQLException: Connection Refused.
To fix the particular problem, all routers and firewalls in the complete network pipe between the client (where the Java application runs) and the server (where the MySQL DB runs) needs to be configured to allow/forward the port number which the DB uses. This is by default 3306. If this port is blocked, you cannot reach the DB from outside.
Another solution is just to upload the Java application in flavor of a webapplication and run it by HTTP. You'd normally use JSP/Servlet for this.
Apart from network, routers, firewall issues the reason can be that by default remote access to MySQL database server is disabled for security reasons. Mostly DB is hosted on the same server or on the trusted server. If you run java application from your desktop, you need to configure MySQL so it will accept this connections. See this manual for details how to do it.

Categories