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

use an existing database - connection error #13

Closed
JackN-code opened this issue May 28, 2020 · 7 comments
Closed

use an existing database - connection error #13

JackN-code opened this issue May 28, 2020 · 7 comments
Labels
needs more info Further information is requested

Comments

@JackN-code
Copy link

I got the following error when connecting the remote Postgres database

[ERROR anvil.app-server.run] #error {
:cause clojure.lang.PersistentArrayMap cannot be cast to java.lang.String
:via
[{:type java.lang.ClassCastException
:message clojure.lang.PersistentArrayMap cannot be cast to java.lang.String
:at [clojure.java.jdbc$get_connection invokeStatic jdbc.clj 381]}]
:trace
[[clojure.java.jdbc$get_connection invokeStatic jdbc.clj 381]
[clojure.java.jdbc$get_connection invoke jdbc.clj 274]
[clojure.java.jdbc$db_query_with_resultset_STAR_ invokeStatic jdbc.clj 1100]
[clojure.java.jdbc$db_query_with_resultset_STAR_ invoke jdbc.clj 1082]
[clojure.java.jdbc$query invokeStatic jdbc.clj 1171]
[clojure.java.jdbc$query invoke jdbc.clj 1133]
[clojure.java.jdbc$query invokeStatic jdbc.clj 1149]
[clojure.java.jdbc$query invoke jdbc.clj 1133]
[migrator.migrations$is_db_empty_QMARK_ invokeStatic migrations.clj 65]
[migrator.migrations$is_db_empty_QMARK_ invoke migrations.clj 63]
[migrator.core$migrate_BANG_$fn__862$fn__864 invoke core.clj 27]
[migrator.core$migrate_BANG_$fn__862 invoke core.clj 26]
[migrator.core$migrate_BANG_ invokeStatic core.clj 25]
[migrator.core$migrate_BANG_ invoke core.clj 20]
[anvil.app_server.run$_main$fn__1706 invoke run.clj 423]
[anvil.app_server.run$_main invokeStatic run.clj 422]
[anvil.app_server.run$_main doInvoke run.clj 224]
[clojure.lang.RestFn applyTo RestFn.java 137]
[anvil.app_server.run main nil -1]]}

@JackN-code JackN-code changed the title Remote DB connection error use an existing database - connection error May 28, 2020
@JackN-code
Copy link
Author

I am able to connect the existing database using psql, but get the following error:
Any hint is greatly appreciated.

The advised configuration:
database: "postgres://not_real:not_real@not_real:54/not_real"

Raises:
Connection to DB failed. Waiting 1s, then retrying migration…

If I changed it to, it get the above-mentioned error
database:
jdbc: postgres://not_real:not_real@not_real:54/not_real

@JackN-code
Copy link
Author

It seems that jbdc driver is not installed the server
java.sql.SQLException: No suitable driver found for postgres

@meredydd
Copy link
Collaborator

Hi @JackN-code, can you provide the full command line and/or config file you're using to connect here? (Leave the passwords out, obviously)

@meredydd meredydd added the needs more info Further information is requested label Jun 12, 2020
@JackN-code
Copy link
Author

Hi meredydd, thanks so much for replying.

Here is my config file:
app: "my_app"
origin: "my_ip"
database: "postgres://atheavhb:my_password@john.db.elephantsql.com:5432/atheavhb"

The url of database is copy exactly from the provider. I also tried:
database: "postgres://john.db.elephantsql.com:5432/atheavhb?username=atheavhb&password=my_password"

database: "jdbc:postgres://atheavhb:my_password@john.db.elephantsql.com:5432/atheavhb"
database: "jdbc:postgres://john.db.elephantsql.com:5432/atheavhb?username=atheavhb&password=my_password"

all of them causes the error:
java.sql.SQLException: No suitable driver found for [the url]

@JackN-code
Copy link
Author

I made a terrible mistake, it should be jdbc:postgresql instead of jdbc:postgres
My bad

It works like a charm

@JackN-code
Copy link
Author

It seems that the real issue is here:
#21

@j2l
Copy link

j2l commented May 4, 2022

Thank you @JackN-code and @toonsevrin, this helped me a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants