Win a copy of Getting started with Java programming language this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

connecting to Datatbase from different Pcs  RSS feed

 
Ahmed Shalotut
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please, I need to know if it is possible to connect MySQL database from another PC in the same LAN or maybe throw the internet
do I need to pay for this?
can I do it throw Xampp?  and how?
please, I need urgent help in that.

so again I need to connect one database using MySql from different Pcs from java code (JDBC).
what do I need to do?
 
Henry Wong
author
Sheriff
Posts: 22673
112
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Why shouldn't it work? The JDBC interface is designed for network access. The MySql driver supports access via machine name (or IP) and port.  And if memory serves, the JDBC driver should be using TCP, so it should route over the internet too.

Henry
 
Ahmed Shalotut
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:
Why shouldn't it work? The JDBC interface is designed for network access. The MySql driver supports access via machine name (or IP) and port.  And if memory serves, the JDBC driver should be using TCP, so it should route over the internet too.

Henry


I tried to connect from my other Pc using my IP and the port number but it didn't work and always threw exception
 
Henry Wong
author
Sheriff
Posts: 22673
112
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahmed Shalotut wrote:
I tried to connect from my other Pc using my IP and the port number but it didn't work and always threw exception


... and I assume that you don't feel comfortable with Databases and Networking to debug it? Well, that is what the ranch is for... just ... TellTheDetails.

Henry
 
Ahmed Shalotut
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:
Ahmed Shalotut wrote:
I tried to connect from my other Pc using my IP and the port number but it didn't work and always threw exception


... and I assume that you don't feel comfortable with Databases and Networking to debug it? Well, that is what the ranch is for... just ... TellTheDetails.

Henry

look what I meant is that I am trying to remote connect my database using my IP address from another Pc but I don't know what is wrong.
what should I do to make it work
but I don't have problems with coding or debugging.
maybe I didn't get what you said as well.
 
Ahmed Shalotut
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:
Ahmed Shalotut wrote:
I tried to connect from my other Pc using my IP and the port number but it didn't work and always threw exception


... and I assume that you don't feel comfortable with Databases and Networking to debug it? Well, that is what the ranch is for... just ... TellTheDetails.

Henry

java.sql.SQLException: null,  message from server: "Host 'Name' is not allowed to connect to this MariaDB server"

there is the exception
 
Henry Wong
author
Sheriff
Posts: 22673
112
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahmed Shalotut wrote:
what should I do to make it work
but I don't have problems with coding or debugging.
maybe I didn't get what you said as well.


Apologies. We do get a lot of users asking for help with debugging. If you don't need help with that, then, no worries.

As for the exception, it is most likely a privileges issue... but I will leave you to debug that.

Henry
 
Ahmed Shalotut
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:
Ahmed Shalotut wrote:
what should I do to make it work
but I don't have problems with coding or debugging.
maybe I didn't get what you said as well.


Apologies. We do get a lot of users asking for help with debugging. If you don't need help with that, then, no worries.

As for the exception, it is most likely a privileges issue... but I will leave you to debug that.

Henry


You are super 😁 just done with it thanks
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!