Skip to content

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.

@eirikbakke eirikbakke added this to the NB26 milestone Jan 24, 2025
@eirikbakke
Copy link
Contributor Author

I added another commit which recognizes Snowflake JDBC URLs, just since we're already making enhancements to this piece of code.

@eirikbakke eirikbakke force-pushed the pr-dbconnfile branch 2 times, most recently from 0e58cc0 to c4705c3 Compare February 24, 2025 21:38
@eirikbakke eirikbakke changed the title Improve Add Database Connection dialog for SQLite and DuckDB Improve Add Database Connection dialog for SQLite, DuckDB, BigQuery, and Snowflake Feb 24, 2025
@eirikbakke
Copy link
Contributor Author

I squashed the previous review edits, and also added a separate commit which recognizes Google BigQuery JDBC URLs.

@eirikbakke eirikbakke force-pushed the pr-dbconnfile branch 4 times, most recently from 3894882 to b8a0fc0 Compare February 25, 2025 15:13
@neilcsmith-net neilcsmith-net modified the milestones: NB26, NB27 Apr 16, 2025
@ebarboni ebarboni modified the milestones: NB27, NB28 Jul 23, 2025
@mbien mbien removed the FormDesigner GUI builder, also known as Matisse label Oct 9, 2025
@mbien
Copy link
Member

mbien commented Oct 9, 2025

@eirikbakke could you rebase this PR? We might be able to squeeze this in.

@mbien mbien added the enterprise [ci] enable enterprise job label Oct 9, 2025
@eirikbakke
Copy link
Contributor Author

@eirikbakke could you rebase this PR? We might be able to squeeze this in.

Sure, done! Do you prefer a single squashed commit, or keep the three commits separate as they currently are?

Thanks!

Copy link
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a small problem with h2 (the file part of the URL is not a full path) and nitpick regarding the JdbcUrl constructor.

Copy link
Member

@mbien mbien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you prefer a single squashed commit, or keep the three commits separate as they currently are?

I would probably squash it in this case, but do what you prefer.

@eirikbakke
Copy link
Contributor Author

Thanks for review suggestions; I pushed a commit which incorporates them (will squash all commits into one before merging).

I also fixed two flaky tests in the same module. ("Fixed" by essentially calling Thread.sleep... a bit ugly, but there was already a convention for doing so in the same test file.)

@ebarboni ebarboni modified the milestones: NB28, NB29 Oct 15, 2025
Copy link
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Looks sane to me.

@mbien
Copy link
Member

mbien commented Nov 1, 2025

this looks ready other than needing squash and rebase.

…SQLite and DuckDB URL templates.

Also validate the selected file in the SQLite and DuckDB cases.

Also have the New Connection wizard recognize the Snowflake and Google BigQuery JDBC drivers and JDBC URLs.

Add a logging statement for one case involving JDBC connection errors that extend from Error rather than Exception (such as NoClassDefFoundError originating from a JDBC driver).
@eirikbakke eirikbakke merged commit 77b8adc into apache:master Nov 1, 2025
59 of 60 checks passed
@eirikbakke
Copy link
Contributor Author

Thanks for reviewing! Merged!

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) enterprise [ci] enable enterprise job UI User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants