Mysql URL and Java

Posted on 2011-04-19
Medium Priority
Last Modified: 2012-06-21
This question is related to http://www.experts-exchange.com/Programming/Languages/Java/Q_26952041.html#a35398303.

One of the people that posted said that I needed to change the URL for the database. However, I don't understand how to do this. Can you tell me how it works?
Question by:JCW2
LVL 47

Expert Comment

ID: 35426134
That is a little bit srrange issue. Your previous question the one to which you refer above was formulated - how do I connect to another database? So in one iof the posts folks commented that in order to connect to another databse you need to change the URL. so you need tio chang URL if you indeed want to connect to anoither database. If you experience some problem (error,etc) please sopecify what it is.
LVL 86

Expert Comment

ID: 35426425
Please clarify your question

Author Comment

ID: 35426798
I need to understand how to change the "URL" string such that I connect to some other database.

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

LVL 47

Accepted Solution

for_yan earned 1000 total points
ID: 35426838
That is url you used to connect to your databses in that question quoted above:

String url = "jdbc:mysql://localhost:3306/university";

Well, if you have another database, you may have it on different host (so you change "localhost" to host name)
you may have different database name, (so you chnage "university" to anothe mname), you may sometimes
have different port, (so you change the port then)

LVL 92

Assisted Solution

objects earned 1000 total points
ID: 35428894
It was explained in your other question

String url = "jdbc:mysql://localhost:3306/university";

The "localhost" part is the server.  It is currently pointing to the local computer, ie. your computer.  The "university" part is the database name.  "3306" is the port number.  That is the default port for mysql.  Change accordingly.  

where is the database you want to connect to?

Author Closing Comment

ID: 35450922
Thank you for your help.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month17 days, 1 hour left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question