This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes What should be the connection URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "What should be the connection URL" Watch "What should be the connection URL" New topic
Author

What should be the connection URL

Mahesh Lohi
Ranch Hand

Joined: Jun 22, 2009
Posts: 150
Hi all,

I use two systems. I have placed the DB in one of the system(server) and would like to insert and select data from the second system.

my connection is String url=("jdbc:mysql://localhost:3306/warehouse?"+"user=root&password=123456");

Now what should I change my url string to, so that I can access the warehouse database via the client system

Thank you in advance
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41073
    
  43
You'd replace "localhost" by the name (or IP address) of the DB server, "3306" by the port number on which the server is listening, "warehouse" by the name of the DB schema you want to access, "root" by the username, and "123456" by the user's password.


Ping & DNS - my free Android networking tools app
Mahesh Lohi
Ranch Hand

Joined: Jun 22, 2009
Posts: 150
Thank you for the quick response.. is DB schema different from my db name

Thank you in advance
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41073
    
  43
No, that's the same.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: What should be the connection URL
 
Similar Threads
K&B SCJP 1.5 Book - strange amazon availibility status
No suitable driver found
A question about closing a shell in SWT
Servlet accessing database...
Exception while connecting to an Oracle database