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 check for jdbc catalog IDs #231

Merged
merged 1 commit into from May 29, 2017

Conversation

Projects
None yet
2 participants
@nprigour
Copy link
Contributor

nprigour commented May 25, 2017

Minor improvement so that ID.isJDBC() method also checks the URL protocol field to determine if ID refers to a database

Signed-off-by: Nikolaos Pringouris nprigour@gmail.com

improve check for jdbc catalog IDs
Signed-off-by: Nikolaos Pringouris <nprigour@gmail.com>
@@ -468,7 +468,7 @@ public boolean isWFS() {
* @return true if ID refers to a database (ie is a jdbc url)
*/
public boolean isJDBC() {
return id.startsWith("jdbc"); //$NON-NLS-1$
return id.startsWith("jdbc") || (url != null && url.getProtocol().contains("jdbc")) ; //$NON-NLS-1$ //$NON-NLS-2$

This comment has been minimized.

@fgdrf

fgdrf May 28, 2017

Contributor

@nprigour Can you describe a scenario if the id wouldnt start with jdbc while protocol could be jdbc? I'm not sure but if the first is true the second statement isn't required. If the first is false the second should either, shouldn't it?

This comment has been minimized.

@nprigour

nprigour May 29, 2017

Author Contributor

ID provides various constructors which do not necessary guarantee that id value is always derived from the URL. Moreover the GeoResource implementation provided for different databases do not directly use the jdbc URL passed during creation of java JDBC connection. To give an example with such IDs produced fot Postgres and Mysql when using the default implementations provided by UDIG:

  • Postgres --> example id value jdbc.postgis://postgres@localhost:5432/db_name#testbed
  • Mysql --> example id value mysql.jdbc://user:psswd@localhost:3306/db_name#test_1 (see also attached screenshot)
    In the mysql case it is evident that id does not start with jdbc
    image

@fgdrf fgdrf merged commit e2d5a07 into locationtech:master May 29, 2017

1 check passed

ip-validation
Details
@fgdrf

This comment has been minimized.

Copy link
Contributor

fgdrf commented May 29, 2017

@naprigour Thanks for explanation and the fix!

@fgdrf fgdrf added this to the uDig-2.0.0 milestone May 29, 2017

@fgdrf fgdrf added the improvement label Sep 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.