Hibernate + PostgreSQL : relation does not exist - SQL Error: 0, SQLState: 42P01

前端 未结 3 1565
情歌与酒
情歌与酒 2021-01-04 12:22

I am having some problems trying to work with PostgreSQL and Hibernate, more specifically, the issue mentioned in the title. I\'ve been searching the net for a few hours now

3条回答
  •  -上瘾入骨i
    2021-01-04 13:13

    Your JDBC URL is "jdbc:postgresql:postgres/tommy" which is unusual. The documentation suggests "jdbc://hostname/databasename". Modern installations come with a "postgres" database that almost definitely isn't what you want to connect to; I don't know how strict the JDBC driver's URL parsing is.

    What are you expecting your database name and hostname to be? e.g. what are your parameters to psql to connect to the database that way?

    Tip: in postgresql.conf, some settings you may consider:

    log_connections = on
    log_disconnections = on
    log_line_prefix = '%t %c %q%u@%h:%d '
    

    If the error is what I think (you're connecting to the wrong database), this would log things like the database name along with the error in your postgresql.log file.

提交回复
热议问题