Quick start with JDBC driver

  1. Download the JDBC driver for YDB.

  2. Copy the .jar file to the directory specified in the CLASSPATH environment variable or load the .jar file in your IDE.

  3. Connect to YDB. JDBC URL examples:

    • Local Docker container with anonymous authentication and without TLS:
      jdbc:ydb:grpc://localhost:2136/local
    • Remote self-hosted cluster:
      jdbc:ydb:grpcs://<host>:2135/Root/<testdb>?secureConnectionCertificate=file:~/<myca>.cer
    • A cloud database instance with a token:
      jdbc:ydb:grpcs://<host>:2135/<path/to/database>?token=file:~/my_token
    • A cloud database instance with a service account:
      jdbc:ydb:grpcs://<host>:2135/<path/to/database>?saFile=file:~/sa_key.json
  4. Execute queries, for example, YdbDriverExampleTest.java.