-
Notifications
You must be signed in to change notification settings - Fork 26
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
Connection to PostgreSQL fails due to relative file paths #285
Comments
Des it work when you save the config and just the "test" is the issue? The database name is not used for the connection check at all ... and as you can see in the settings there is no file path provided at all
So, is there a requirement based on your Postgres configuration? |
What does the Log on server says? The same error as when testing? How does the postgresql configuration looks like? How the PostGres config from CCU Historial looks like oarameter wise? |
PS: did you tried to enter the "database name" without the leading "/" ? |
It generates the same error message on the database server. |
In CCU-Historian following options are configured for Postgre: database.pgEnable: true More information |
Ok where is the db name configuration? Is the postgresql server having anything in it's log when iobroker accesses to maybe see details of the error? |
Also wenn ich dfas bei CCU-Historian pberfliege würde ich fragen was genau im Call auf die DB Shcnittstelle als Datenbank gesetzt werden muss. Da sist aber keien iobroker sondern eine CCU Historian Frage! In dem Screenshot ist der Pfad relativ angegeben. im text steht das ggf auch /opt/ccuhistorian/... noch davor gesetzt werden muss. Am Ende ist bitte zu bedenken das das von ccu historian scheinbar nur eine simulation einer Postgres Schnittstelle ist ... |
Das Datenbank Verzeichnis steht in der CCU-Historian Config: Ich vermute also, dass iobroker fälschlicherweise "database postgres" statt dem Wert im Textfeld überträgt und die Verbindung daher fehlschlägt. Die Fehlermeldung auf dem CCU-Historian ist dann m. E. auch logisch, da der Pfad "postgres" kein absoluter Pfad ist. |
Beim CInnectiontest ist dies korrekt das das so ist weil der dbname nicht gesendet wird. Den Bug kann ich fixen. ALso bitte dann mal nach speochern der Konfiguration die Instanz auf Debug log stellen ... Weil interessant ist was gesendet wird wenn der adapter mit der gespeicherten Konfig startet ... dann sollte da kein postgres gesendet werden.Und das sollte man im debug log sehen |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days. Please check if the issue is still relevant in the most current version of the adapter and tell us. Also check that all relevant details, logs and reproduction steps are included and update them if needed. Thank you for your contributions. |
Describe the bug
It is not possible to connect to a PostgreSQL database (CCU-historian), because the adapter seems to use relative file paths, even if absolute are configured. With e. g. Grafana a connection to the PostgreSQL database works as expected.
To Reproduce
Steps to reproduce the behavior:
Select "PostgreSQL" in iobroker.sql instance, fill out the fields and configure an absolute file path ("/database/history") and click on "Test connection".
It appears an error popup "Error: Connection terminated unexpectedly".
In the database appears that messages:
2022-12-28T07:26:49.657498340Z org.h2.message.DbException: A file path that is implicitly relative to the current working directory is not allowed in the database URL "jdbc:h2:postgres". Use an absolute path, ~/name, ./name, or the baseDir setting instead. [90011-212] 2022-12-28T07:26:49.657525002Z at org.h2.message.DbException.get(DbException.java:223) 2022-12-28T07:26:49.657531277Z at org.h2.message.DbException.get(DbException.java:199) 2022-12-28T07:26:49.657535934Z at org.h2.engine.ConnectionInfo.getName(ConnectionInfo.java:464) 2022-12-28T07:26:49.657540428Z at org.h2.engine.Engine.openSession(Engine.java:49) 2022-12-28T07:26:49.657544873Z at org.h2.engine.Engine.openSession(Engine.java:222) 2022-12-28T07:26:49.657549338Z at org.h2.engine.Engine.createSession(Engine.java:201) 2022-12-28T07:26:49.657555147Z at org.h2.server.pg.PgServerThread.process(PgServerThread.java:292) 2022-12-28T07:26:49.657560031Z at org.h2.server.pg.PgServerThread.run(PgServerThread.java:140) 2022-12-28T07:26:49.657593915Z at java.base/java.lang.Thread.run(Unknown Source) 2022-12-28T07:26:49.657691017Z Caused by: org.h2.jdbc.JdbcSQLNonTransientConnectionException: A file path that is implicitly relative to the current working directory is not allowed in the database URL "jdbc:h2:postgres". Use an absolute path, ~/name, ./name, or the baseDir setting instead. [90011-212] 2022-12-28T07:26:49.657705959Z at org.h2.message.DbException.getJdbcSQLException(DbException.java:678) 2022-12-28T07:26:49.657714193Z at org.h2.message.DbException.getJdbcSQLException(DbException.java:477) 2022-12-28T07:26:49.657721525Z ... 9 more
Logs in iobroker.sql:
sql.0 | 2022-12-28 22:34:07.157 | error | Error: Connection terminated unexpectedly
sql.0 | 2022-12-28 22:34:07.116 | info | Postgres connection options: {"server":"10.0.100.130","host":"10.0.100.130","user":"sa","password":"****","max_idle":2,"max_active":101,"max_wait":10000,"when_exhausted":"block","port":5435,"database":"postgres"}
sql.0 | 2022-12-28 22:34:07.091 | info | starting. Version 2.2.0 in /opt/iobroker/node_modules/iobroker.sql, node: v16.19.0, js-controller: 4.0.23
Expected behavior
A successfully connect to PostgreSQL database.
Screenshots & Logfiles
Two screenshot attached.
Versions:
De- and reinstall of the instance did not solve it.
The text was updated successfully, but these errors were encountered: