Results 1 to 2 of 2

Thread: How do I determine the URL to the database?

  1. #1
    Join Date
    Aug 2012
    Posts
    10

    How do I determine the URL to the database?

    I have installed and created local MySQL test databases and tables on my Windows 7 PC. In order to connect to the database in Java, I need the parameters of the DriverManager getConnection API which includes the username and password and the URL to the database.

    How do I determine the URL to the database?

  2. #2
    Join Date
    May 2015
    Posts
    19
    JDBC format is:

    Code:
    jdbc:mysql://hostname:port/database_name
    You can use localhost as hostname and 3306 as port number. Replace the Database_name with the name of your database.
    For the username and password you can simply add them as a query parameter. The final result would be:

    HTML Code:
    jdbc:mysql://localhost:3306/database_name?user_name&password=somepassword

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •