Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Add Database Connection dialog for SQLite and DuckDB #8189

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

eirikbakke
Copy link
Contributor

@eirikbakke eirikbakke commented Jan 24, 2025

The "Add Database Connection" dialog supports various kinds of database-specific connection fields (host, port, database name etc.) These are automatically substituted into the JDBC driver specific JDBC URL.

This PR adds support for a "File" field, which will be shown if the user is using the JDBC drivers for SQLite or DuckDB. There is a "Browse" button that can be used to pick the file from a file browser. Furthermore, the username and password fields are hidden for these drivers, which are known not to require this kind of authentication.

image

For SQLite and DuckDB, there's a warning if the selected file is not of the right kind. (Useful because SQLite files do not have any kind of standardized file extension.)

image

For comparison, this is what the Add Database Connection dialog looked like before, for SQLite:

image

(There are some proprietary JDBC drivers for SQLite that do allow a password to be used for encryption, but in this rare case the user could use a connection property to pass this information instead.)

@eirikbakke eirikbakke added UI User Interface FormDesigner GUI builder, also known as Matisse ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Jan 24, 2025
@eirikbakke
Copy link
Contributor Author

eirikbakke commented Jan 24, 2025

The NewConnectionPanel uses the NetBeans Matisse Form Builder, by the way. The way it works is that the form contains every possible field available, and then individual fields are shown or hidden depending on what fields are used in the JDBC URL template string.

Here is the full dialog as it appears in the form builder:

image

To insert the "File" field I ended up hand-editing the ".form" file, reloading it in the form builder, making some adjustments, and then saving it again together with freshly generated initComponents() code. So the final "form" file committed here is generated by Matisse, not hand-edited by me.

…SQLite and DuckDB URL templates.

Also validate the selected file in the SQLite and DuckDB cases.
@eirikbakke eirikbakke added this to the NB26 milestone Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) FormDesigner GUI builder, also known as Matisse UI User Interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants