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
Recognize jdbc:edb urls as a distinct EnterpriseDB dialect #2244
Conversation
What do you think about creating a new EDB extension? @nvoxland created a template that should make that easier: https://github.com/liquibase/liquibase-extension-example. |
Hi @r2liquibase |
We should make sure we don't re-invent the wheel wrt to the EDB work done in DaticalDB. |
- Removed old/unused Postgresql DbTypes enum - Updated code to use standard "instanceof EnterpriseDBDatabase" style vs. getDbType() logic
I talked with @wwillard7800 about these changes and they are good. It's just some simple support at this point and not re-inventing anything. As we look at future features we can bring in other existing code as needed. |
- Removed old/unused Postgresql DbTypes enum - Updated code to use standard "instanceof EnterpriseDBDatabase" style vs. getDbType() logic
- Removed old/unused Postgresql DbTypes enum - Updated code to use standard "instanceof EnterpriseDBDatabase" style vs. getDbType() logic
➤ Erzsebet Carmean commented: karen.a.taggart, hi! Thank you very much for the research. Thank you even more, a thousand times more, for the detail you provide in the last comment. We have what we need to scope the test effort for this ticket. Jack Odzhubeiskyi, I’m going to assign this one to you for conditioning. My suggestion is to take the table Karen provided and move it into the description so that the entire community can see what we’re going to validate. I am not sure where to get the edb driver; if you cannot find it, please let me know. Additionally, I don’t know of any example packages to use with edb. Nathan Voxland, can you provide those, please? CC Kristyl Gomes |
➤ karen.a.taggart commented: Thanks all – Jack Odzhubeiskyi the edb driver can be found https://www.enterprisedb.com/software-downloads-postgres ( https://www.enterprisedb.com/software-downloads-postgres|smart-link ) (I can’t pretend to be that brilliant, thankfully Tsvi Zandany provided in his original issue description) |
Confirming - you have the right link to download the edb JDBC driver in your comment, @kataggart (including in the issue description). |
➤ Jack Odzhubeiskyi commented: Liquibase version [Core: //add-edb-basic-support/987/8d61b3/2021-12-20 10:39+0000, Pro: add-edb-basic-support/248/3bf2b3/2021-12-13T22:23:28Z] #9871 Verify Liquibase behavior when EDB Driver is not in lib diectory and jdbc:edb url is specified. PASS
2 Verify Liquibase behavior when EDB Driver is not in lib diectory and jdbc:postgres url is specified. PASS
3 Verify Liquibase behavior when EDB Driver is in lib diectory and jdbc:postgres url is specified. PASS
4 Verify Liquibase behavior when EDB Driver is in lib diectory and jdbc:edb url is specified. PASS
|
Description
Adds EnterpriseDBDatabase dialect class so that liquibase will correctly recognize "jdbc:edb:..." urls as being like postgresql but potentially different.
There was some stub code around that used a postgersql.getDbType() call to differentiate between COMMUNITY and EDB enum values which I switched to the more standard "instanceof EnterpriseDBDatabase" checks.
With this change, liquibase should correctly recognize the url value
jdbc:edb://host:5444/dbname
and default to using the edb jdbc driver.|----|----|----|----|----|
|liquibase lib directory|properties/cli|properties/cli|dialect|changetype|
|EDB driver installed|Driver|url|updateSQL|createPackage|
|no|none|jbdc:edb|FAIL|FAIL|
|no|postgres|jbdc:edb|FAIL|FAIL|
|no|edb|jbdc:edb|edb|pass|
|no|none|jbdc:postgres|postgres|FAIL|
|no|postgres|jbdc:postgres|postgres|FAIL|
|no|edb|jbdc:postgres|postgres|FAIL|
|yes|none|jbdc:edb|edb|pass|
|yes|postgres|jbdc:edb|FAIL|FAIL|
|yes|edb|jbdc:edb|edb|pass|
|yes|none|jbdc:postgres|postgres|FAIL|
|yes|postgres|jbdc:postgres|postgres|FAIL|
|yes|edb|jbdc:postgres|postgres|FAIL|
Testing
Start an enterprisedb container like:
and then connect to it on localhost:5444 with standard postgresql tools to create a test user/database:
With the fix, you can run liquibase operations against
--url jdbc:edb://localhost:5444/lbcat --username lbuser --password LiquibasePass1
and it will default to thecom.edb.Driver
driver. You can see this by not having the edb driver in your lib dir and getting aCannot find database driver: com.edb.Driver
error.By adding the driver from https://www.enterprisedb.com/software-downloads-postgres to your lib dir, the "cannot find database driver" error goes away and liquibase runs like normal.
Level of EDB Support
This change ONLY makes it so a jdbc:edb url works as users expect. We are not adding official support for edb yet or testing anything beyond that we can connect and do a very simple update operation. Any additional EDB testing or features will be done in future work. This just sets us up for that work and makes basic use easy for end users.
Dev Handoff Notes (Internal Use)
Links
Testing
Dev Verification
Started enterprisedb container and ran operations against it using standard postgresql URL. Saw that jdbc:edb failed with the missing driver as expected.
Test Requirements (Liquibase Internal QA)
Examples of liquibase.properties and changelog files are attached.
Configure liquibase.properties file to connect to your database instance.
Manual Tests.
1 Verify Liquibase behavior when EDB Driver is not in lib diectory and jdbc:edb url is specified.
liquibase update-slq -changelog-file lb2185-changelog.xml --labels table,function
Unexpected error running Liquibase: java.lang.RuntimeException: Cannot find database driver: com.edb.Driver
liquibase update-slq -changelog-file lb2185-changelog.xml --labels table,function
Unexpected error running Liquibase: Connection could not be created to jdbc:edb://localhost:### with driver org.postgresql.Driver.
Possibly the wrong driver for the given database URL
liquibase update -changelog-file lb2185-changelog.xml --labels table,function
update
is successfultest_table
is present in databaseTestFunction
is present in databaseliquibase update-slq -changelog-file lb2185-changelog.xml --labels package
udate-sql
is successful-- Changeset lb2185-changelog.xml::3::Liquibase
CREATE OR REPLACE PACKAGE empinfo
IS
emp_name VARCHAR2(10);
PROCEDURE get_name (
p_empno NUMBER
);
FUNCTION display_counter
RETURN INTEGER;
END/