+ 2
Obtain jdbc url to connect database with java program
Hello, I was trying to connect my database with a java program but I need a JDBC url. I’m not using localhost. Can you help me find the url? I’m url phpmyadmin. Where can I find that url in this web page? Thanks.
4 Réponses
+ 3
The url is driver/db dependent... see here https://www.baeldung.com/java-jdbc-url-format
+ 2
Sure, I can help you find the JDBC URL to connect your Java program to the database. The JDBC URL depends on the database management system (DBMS) you are using. Since you mentioned using phpMyAdmin, I assume you are using MySQL as your DBMS.
To find the JDBC URL for your MySQL database, follow these steps:
1. Open phpMyAdmin in your web browser.
2. Select the database you want to connect to from the left sidebar.
3. Click on the "Home" tab in the top menu.
4. In the "Database server" section, you should see the "Server" and "Host information" fields.
5. The JDBC URL to connect to your database is typically in this format:
```
jdbc:mysql://hostname:port/database_name
```
Replace `hostname`, `port`, and `database_name` with the appropriate values for your MySQL server.
For example, if your server's hostname is "example.com", the port is "3306", and your database name is "mydb", the JDBC URL would be:
```
jdbc:mysql://example.com:3306/mydb
```
+ 2
Now, you can use this JDBC URL in your Java program to establish a connection to your MySQL database using JDBC.
Hope this helps
+ 1
ຸ thank you!
Comment: give credit to OpenAI while sending ChatGPT answers