D1 JDBC Driver
A JDBC driver for Cloudflare's D1 Database product!
JDBC is the technology that drives popular database tools such as Jetbrains' database functionality integrated into their editors and Datagrip, their standalone DB editor.
These tools all require a JDBC driver, an adapter that interfaces between the GUI and the Database.
The D1 JDBC Driver interfaces between these IDEs and Cloudflare's D1, and provides:
- π Powerful and automatic schema introspection capabilities
- βοΈ SQL statement execution, along with auto-formatted results
- π Support for all of the Datatype Affinities that SQLite supports (NUMERIC, TEXT, etc)
Known issues:
- Editing data directly via the table-like interface is not supported. Editing data via SQL is still supported.
- Foreign keys are not currently shown in the introspection window, although they are still there and working as normal.
For more info and to get help, join us on the Cloudflare Developers
Discord!
Installation instructions:
- Download the latest release of the D1 JDBC Driver from here.
- Move the .jar file to somewhere on your computer where you can store it permanently.
- Open Datagrip (or another Jetbrains tool) and add a new Database Driver. (Figure 1)
- Name it D1 JDBC Driver. Click on the plus sign beside Driver Files, select Custom JARs, then navigate to and choose the downloaded .jar file.
- Select
org.isaacmcfadyen.D1Driver
from the dropdown. (Figure 2)
- Go to the Options tab, scroll down to the bottom, and change the Dialect to SQLite. This is required for proper auto-complete functionality. (Figure 3)
- Go to the Data Sources panel, add a new Data Source, and select D1 JDBC Driver as the source. (Figure 4)
- Enter the URL, in the format
jdbc:d1://<UUID>
where <UUID>
is the ID of the D1 database you were given at creation. For the User field, enter your Cloudflare Account ID, and for the Password field enter an API Token with the D1 Edit scope. (Figure 5)
- Hit Test Connection. If all is good, you should see a green message saying that the connection succeeded! If it failed, try going back through these steps and making sure you didn't make a typo. If you need help, join us on the Cloudflare Developers
Discord. (Figure 6)
Figure 1:
Figure 2:
Figure 3:
Figure 4:
Figure 5:
Figure 6: