File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Access to mysql database in server Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Access to mysql database in server" Watch "Access to mysql database in server" New topic
Author

Access to mysql database in server

dushantha Rathnayake
Ranch Hand

Joined: Feb 27, 2010
Posts: 100
Hi,

I have tow applications.they are server side and client side. in server side i have mysql data base.now the problem is, I want to access into that database using client program.but I don't know how to do it. I tried with following connection statement.



Using this code application can't find the data base. so how can I do this? please help me.

Thank you.
Stephan Mueller
Ranch Hand

Joined: May 05, 2010
Posts: 50
("jdbc:mysql://localhost/network_admin","root","")


If you are saying that your DBMS resides on a remote server, while you are executing the JDBC code on another client,
then you should understand that is the URL for this specific local client the code runs on.
You have to replace localhost with the host adress of the server.

If you are saying somethin else, I suggest that you rephrase your question, try to give more details like
an exact error message.

1. Make it run - 2. Make it run correctly - 3. Make it pretty OR fast/small - 4. ??? - 5. Profit
dushantha Rathnayake
Ranch Hand

Joined: Feb 27, 2010
Posts: 100
Hi,

Actually this is my first remote product. I think you are correct. can you give me an example for this replacement? actually the exception is "Can not find the network_admin database" .

Thank you.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

So this sounds like you may have a MySQL database running locally without the named database.

You need to replace localhost with the host name or IP address of the remote machine. What that is only you can tell us. You should maybe ask whoever set it up for you?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
dushantha Rathnayake
Ranch Hand

Joined: Feb 27, 2010
Posts: 100
Hi,



Actually my friend this is the only way that I know to connect the mysql database into java application. But I don't know this method is possible to remote applications. Think this, I have a mysql database.I can install it into server machine. and then I want to access into that particular database using client machine. So how can I do this? Please help me.

Thank you!
Stephan Mueller
Ranch Hand

Joined: May 05, 2010
Posts: 50


and try to avoid using root with no password as the database user.
dushantha Rathnayake
Ranch Hand

Joined: Feb 27, 2010
Posts: 100
Hi,

Thank you. Because now my product is work properly. In this case I got some problems then I disabled the windows firewall and then its properly work. Thank you very very much.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Access to mysql database in server
 
Similar Threads
applet db access mediated by jsp db access
Connection Factory pls explain
JSP: Unable to connect to mysql in local drive [Solved]
Help please with GWT Sql Connection ...
can i connect to a db2 server which is not in my local net work using net driver?