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

Empty Schema and Missing version Table results in Exception for list-tenants #2353

Closed
prb112 opened this issue May 12, 2021 · 2 comments
Closed
Assignees
Labels
bug Something isn't working persistence

Comments

@prb112
Copy link
Contributor

prb112 commented May 12, 2021

Describe the bug
Empty Schema and Tenants Table results in Exception for list-tenants

Environment
Which version of IBM FHIR Server?
main and 4.8.0-SNAPSHOT

To Reproduce

  1. Create a Db2 instance
mkdir -p db
docker run -itd --name mydb2_1631 --rm --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=change-password -e DBNAME=fhirdb -v $(pwd)/db:/database ibmcom/db2:11.5.4.0
  1. Configure the Db2 instance.
docker exec -it mydb2_1631 /bin/bash
su - db2inst1
/opt/ibm/db2/V11.5/bin/db2 CREATE DB FHIRDB using codeset UTF-8 territory us PAGESIZE 32768

Optionally, you may need to drop the db /opt/ibm/db2/V11.5/bin/db2 drop db fhirdb.

  1. Build Main mvn clean install -f fhir-parent -DskipTests

  2. Create Schemas

java -jar ~/.m2/repository/com/ibm/fhir/fhir-persistence-schema/4.8.0-SNAPSHOT/fhir-persistence-schema-4.8.0-SNAPSHOT-cli.jar \
    --prop db.host=localhost --prop db.port=50000 --prop db.database=fhirdb --prop user=db2inst1 --prop password=change-password \
    --db-type db2 --schema-name test1 --create-schemas
  1. list Tenants
java -jar ~/.m2/repository/com/ibm/fhir/fhir-persistence-schema/4.8.0-SNAPSHOT/fhir-persistence-schema-4.8.0-SNAPSHOT-cli.jar     --prop db.host=localhost --prop db.port=50000 --prop db.database=fhirdb --prop user=db2inst1 --prop password=change-password     --db-type db2 --schema-name test1 --list-tenants
2021-05-12 11:54:14.833 00000001    INFO .common.JdbcConnectionProvider Opening connection to database: jdbc:db2://localhost:50000/fhirdb
2021-05-12 11:54:16.064 00000001 WARNING ls.pool.PoolConnectionProvider Get connection took 1.230 seconds
2021-05-12 11:54:16.124 00000001 WARNING ls.pool.PoolConnectionProvider Rolling back transaction
2021-05-12 11:54:16.130 00000001  SEVERE   com.ibm.fhir.schema.app.Main schema tool failed

com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=FHIR_ADMIN.TENANTS, DRIVER=4.28.11
com.ibm.fhir.database.utils.api.UndefinedNameException: com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=FHIR_ADMIN.TENANTS, DRIVER=4.28.11
        at com.ibm.fhir.database.utils.db2.Db2Translator.translate(Db2Translator.java:111)
        at com.ibm.fhir.schema.control.GetTenantList.run(GetTenantList.java:64)
        at com.ibm.fhir.schema.control.GetTenantList.run(GetTenantList.java:23)
        at com.ibm.fhir.database.utils.common.CommonDatabaseAdapter.runStatement(CommonDatabaseAdapter.java:475)
        at com.ibm.fhir.schema.app.Main.listTenants(Main.java:901)
        at com.ibm.fhir.schema.app.Main.process(Main.java:1789)
        at com.ibm.fhir.schema.app.Main.main(Main.java:1860)
Caused by: com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=FHIR_ADMIN.TENANTS, DRIVER=4.28.11
        at com.ibm.db2.jcc.am.b7.a(b7.java:810)
        at com.ibm.db2.jcc.am.b7.a(b7.java:66)
        at com.ibm.db2.jcc.am.b7.a(b7.java:140)
        at com.ibm.db2.jcc.am.k6.c(k6.java:2825)
        at com.ibm.db2.jcc.am.k6.d(k6.java:2809)
        at com.ibm.db2.jcc.am.k6.a(k6.java:2235)
        at com.ibm.db2.jcc.t4.ab.i(ab.java:204)
        at com.ibm.db2.jcc.t4.ab.b(ab.java:94)
        at com.ibm.db2.jcc.t4.p.a(p.java:32)
        at com.ibm.db2.jcc.t4.av.i(av.java:150)
        at com.ibm.db2.jcc.am.k6.al(k6.java:2204)
        at com.ibm.db2.jcc.am.k6.a(k6.java:3331)
        at com.ibm.db2.jcc.am.k6.a(k6.java:738)
        at com.ibm.db2.jcc.am.k6.executeQuery(k6.java:717)
        at com.ibm.fhir.schema.control.GetTenantList.run(GetTenantList.java:54)
        ... 5 more
2021-05-12 11:54:16.133 00000001  SEVERE   com.ibm.fhir.schema.app.Main SCHEMA CHANGE: RUNTIME ERROR

Expected behavior
n/a

Additional context
n/a

@prb112 prb112 added bug Something isn't working persistence labels May 12, 2021
@prb112 prb112 changed the title Empty Schema and Results Table results in Exception for list-tenants Empty Schema and Missing version Table results in Exception for list-tenants May 12, 2021
@tbieste tbieste self-assigned this May 12, 2021
@tbieste tbieste added this to the Sprint 2021-06 milestone May 12, 2021
prb112 added a commit that referenced this issue May 13, 2021
…tenants #2353

Signed-off-by: Paul Bastide <pbastide@us.ibm.com>
@prb112
Copy link
Contributor Author

prb112 commented May 13, 2021

PR #2358
FIxes the Exception above (on top of the issue fixed by troy)

@prb112
Copy link
Contributor Author

prb112 commented May 13, 2021

09:19:09-paulbastide@pauls-mbp:~/git/wffh/2021/fhir$ java -jar ~/.m2/repository/com/ibm/fhir/fhir-persistence-schema/4.8.0-SNAPSHOT/fhir-persistence-schema-4.8.0-SNAPSHOT-cli.jar     --prop db.host=localhost --prop db.port=50000 --prop db.database=fhirdb --prop user=db2inst1 --prop password=change-password     --db-type db2 --schema-name test1 --list-tenants
2021-05-13 09:19:16.953 00000001    INFO .common.JdbcConnectionProvider Opening connection to database: jdbc:db2://localhost:50000/fhirdb
2021-05-13 09:19:18.799 00000001 WARNING ls.pool.PoolConnectionProvider Get connection took 1.839 seconds
The FHIR_ADMIN schema appears not be deployed with the TENANTS table
2021-05-13 09:19:18.923 00000001    INFO   com.ibm.fhir.schema.app.Main Processing took:   1.998 s
2021-05-13 09:19:18.924 00000001    INFO   com.ibm.fhir.schema.app.Main SCHEMA CHANGE: OK

@prb112 prb112 self-assigned this May 13, 2021
@prb112 prb112 closed this as completed May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working persistence
Projects
None yet
Development

No branches or pull requests

2 participants