Mysql URL and Java

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?
JCW2Asked:
Who is Participating?
 
for_yanCommented:
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)


0
 
for_yanCommented:
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.
0
 
CEHJCommented:
Please clarify your question
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
JCW2Author Commented:
I need to understand how to change the "URL" string such that I connect to some other database.
0
 
objectsCommented:
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?
0
 
JCW2Author Commented:
Thank you for your help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.