Обсуждение: Hibernate + PostgreSQL (?) error

Поиск
Список
Период
Сортировка

Hibernate + PostgreSQL (?) error

От
David Alvarez
Дата:
Hello,

I am currently attempting to work my way through the set of tutorials, posted by Koushik, on the subject of using Hibernate with PostgreSQL, and while I am not sure it is Postgres's fault (and therefore whether I am asking the right people), it certainly looks like it is.  So, to describe the problem:
I am using Eclipse Indigo to implement my Java 7 code (JDK v 1.7), which calls the hibernate (v 4.1.12, the latest) framework, which in turn (although currently it is only hopefully in the future) calls PostgreSQL (v 9.2), which will call the data and allow me to proceed with the tutorial.  However, when I try to run it Eclipse is reporting the current error (after apparently loading the hibernate framework correctly)

"ERROR: HHH000231: Schema export unsuccessful
org.postgresql.util.PSQLException: FATAL: database "localhost:5432/hibernatedb" does not exist"

Now, 'Schema export' sounds like a Hibernate thing (so please forgive me if I am posting this in the wrong place, although it is the 'novice' area, right?), and so does 'org.postgresql.util.PSQLException' (which looks like a Java library, to me), and I do know that the port #5432 is configured and running on my local machine, that db 'hibernatedb' does indeed exist, since I created and connected to it right before I tried to get this to run, and that I do have (or at least as far as I can tell) the correct driver installed in the right place in Eclipse (postgresql-9.2-1002.jdc4.jar as a 'referenced library')., so I am at a loss.  What did I do?  And most importantly, how do I fix it?  Do I need to copy/post any of the associated config.xml files, or any screen shots of Eclipse?  Where do I do this? (I 'm afraid that I am completely new to PSQL and Hibernate, and to this site).  Any assistance you could give would be greatly appreciated.  And thanks in advance.

Dave A.

Re: Hibernate + PostgreSQL (?) error

От
Gavin Flower
Дата:
On 08/05/13 02:34, David Alvarez wrote:
Hello,

I am currently attempting to work my way through the set of tutorials, posted by Koushik, on the subject of using Hibernate with PostgreSQL, and while I am not sure it is Postgres's fault (and therefore whether I am asking the right people), it certainly looks like it is.  So, to describe the problem:
I am using Eclipse Indigo to implement my Java 7 code (JDK v 1.7), which calls the hibernate (v 4.1.12, the latest) framework, which in turn (although currently it is only hopefully in the future) calls PostgreSQL (v 9.2), which will call the data and allow me to proceed with the tutorial.  However, when I try to run it Eclipse is reporting the current error (after apparently loading the hibernate framework correctly)

"ERROR: HHH000231: Schema export unsuccessful
org.postgresql.util.PSQLException: FATAL: database "localhost:5432/hibernatedb" does not exist"

Now, 'Schema export' sounds like a Hibernate thing (so please forgive me if I am posting this in the wrong place, although it is the 'novice' area, right?), and so does 'org.postgresql.util.PSQLException' (which looks like a Java library, to me), and I do know that the port #5432 is configured and running on my local machine, that db 'hibernatedb' does indeed exist, since I created and connected to it right before I tried to get this to run, and that I do have (or at least as far as I can tell) the correct driver installed in the right place in Eclipse (postgresql-9.2-1002.jdc4.jar as a 'referenced library')., so I am at a loss.  What did I do?  And most importantly, how do I fix it?  Do I need to copy/post any of the associated config.xml files, or any screen shots of Eclipse?  Where do I do this? (I 'm afraid that I am completely new to PSQL and Hibernate, and to this site).  Any assistance you could give would be greatly appreciated.  And thanks in advance.

Dave A.
Hmm...

Congratulations on your persistence! Having fought successfully for several hours last night to successfully get a very simple tutorial example working on an unrelated piece of software, I have some idea of the frustrations involved!

Well you appear to have checked the obvious that I had thought might be the problem!

I might well be using Hibernate soon with Postgres, so I'll be following the resolution of you problem, and I also use Eclipse


Cheers,
Gavin

Re: Hibernate + PostgreSQL (?) error

От
Craig Barnes
Дата:
Hi David,

Without the steps that you have taken so far it's pretty hard to tell
where the problem might be.

The only thing that springs into my mind at this point is the pg_hba.conf file.
Have you added anything here to enable network login rights from localhost?

HTH

Craig

On 7 May 2013 15:34, David Alvarez <dalsquared@yahoo.com> wrote:
> Hello,
>
> I am currently attempting to work my way through the set of tutorials,
> posted by Koushik, on the subject of using Hibernate with PostgreSQL, and
> while I am not sure it is Postgres's fault (and therefore whether I am
> asking the right people), it certainly looks like it is.  So, to describe
> the problem:
> I am using Eclipse Indigo to implement my Java 7 code (JDK v 1.7), which
> calls the hibernate (v 4.1.12, the latest) framework, which in turn
> (although currently it is only hopefully in the future) calls PostgreSQL (v
> 9.2), which will call the data and allow me to proceed with the tutorial.
> However, when I try to run it Eclipse is reporting the current error (after
> apparently loading the hibernate framework correctly)
>
> "ERROR: HHH000231: Schema export unsuccessful
> org.postgresql.util.PSQLException: FATAL: database
> "localhost:5432/hibernatedb" does not exist"
>
> Now, 'Schema export' sounds like a Hibernate thing (so please forgive me if
> I am posting this in the wrong place, although it is the 'novice' area,
> right?), and so does 'org.postgresql.util.PSQLException' (which looks like a
> Java library, to me), and I do know that the port #5432 is configured and
> running on my local machine, that db 'hibernatedb' does indeed exist, since
> I created and connected to it right before I tried to get this to run, and
> that I do have (or at least as far as I can tell) the correct driver
> installed in the right place in Eclipse (postgresql-9.2-1002.jdc4.jar as a
> 'referenced library')., so I am at a loss.  What did I do?  And most
> importantly, how do I fix it?  Do I need to copy/post any of the associated
> config.xml files, or any screen shots of Eclipse?  Where do I do this? (I 'm
> afraid that I am completely new to PSQL and Hibernate, and to this site).
> Any assistance you could give would be greatly appreciated.  And thanks in
> advance.
>
> Dave A.



--
Craig


Re: Hibernate + PostgreSQL (?) error

От
Simon Riggs
Дата:
On 7 May 2013 15:34, David Alvarez <dalsquared@yahoo.com> wrote:

> I am currently attempting to work my way through the set of tutorials,
> posted by Koushik, on the subject of using Hibernate with PostgreSQL, and
> while I am not sure it is Postgres's fault (and therefore whether I am
> asking the right people), it certainly looks like it is.  So, to describe
> the problem:
> I am using Eclipse Indigo to implement my Java 7 code (JDK v 1.7), which
> calls the hibernate (v 4.1.12, the latest) framework, which in turn
> (although currently it is only hopefully in the future) calls PostgreSQL (v
> 9.2), which will call the data and allow me to proceed with the tutorial.
> However, when I try to run it Eclipse is reporting the current error (after
> apparently loading the hibernate framework correctly)
>
> "ERROR: HHH000231: Schema export unsuccessful
> org.postgresql.util.PSQLException: FATAL: database
> "localhost:5432/hibernatedb" does not exist"
>
> Now, 'Schema export' sounds like a Hibernate thing (so please forgive me if
> I am posting this in the wrong place, although it is the 'novice' area,
> right?), and so does 'org.postgresql.util.PSQLException' (which looks like a
> Java library, to me), and I do know that the port #5432 is configured and
> running on my local machine, that db 'hibernatedb' does indeed exist, since
> I created and connected to it right before I tried to get this to run, and
> that I do have (or at least as far as I can tell) the correct driver
> installed in the right place in Eclipse (postgresql-9.2-1002.jdc4.jar as a
> 'referenced library')., so I am at a loss.  What did I do?  And most
> importantly, how do I fix it?  Do I need to copy/post any of the associated
> config.xml files, or any screen shots of Eclipse?  Where do I do this? (I 'm
> afraid that I am completely new to PSQL and Hibernate, and to this site).
> Any assistance you could give would be greatly appreciated.  And thanks in
> advance.

Try using hibernatedb or postgresql://localhost:5432/hibernatedb
rather than just localhost:5432/hibernatedb

localhost:5432/hibernatedb is not a valid URI for postgres connections.

--
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services