Skip to content

Latest commit

 

History

History

java

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Connecting to PlanetScale from Java

This example demonstrates how to connect a Java application to a PlanetScale database using the MySQL JDBC connector.

Follow the instructions below to find and insert your PlanetScale credentials.

Getting the credentials

  1. In the PlanetScale dashboard, select the database you want to connect to.
  2. Click "Branches" and select the branch you want to connect to.
  3. Click "Connect".
  4. Select "Java" from the "Connect from" dropdown.
  5. If the password is blurred, click "New password".
  6. Copy the credentials. You won't be able to see the password again.

Connecting your database

  1. Copy the contents of java/src/main/java/com/planetscale/example/mysql.java into your connection file.
  2. Replace the placeholders for HOSTNAME, DATABASE, USERNAME, and PASSWORD with the copied values from the previous section.

More resources

Next steps