Thread: Some Problems - Shall I reinstall the DB?
The 8.x version of PostgreSQL has been installed on my PC for quite few years. It has been problem free until recently. Thefirst problem I have is that a connection can't be established after the PC just starts up although the DB is started.I have to restart it to solve this problem each time after my PC is up. The other problem, I just find this morning, is that table ID generation. A table ID is defined as the following: id SERIAL UNIQUE primary key, When I save a new entry to this table, I get an error as org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save() from Hibernate. No all table demonstrate this error. Shall I reinstall PostgreSQL for resolve those two problem? Thanks, - v
On 01/31/2011 12:49 PM, vwu98034@lycos.com wrote: > The 8.x version of PostgreSQL has been installed on my PC for quite few years. It has been problem free until recently.The first problem I have is that a connection can't be established after the PC just starts up although the DB isstarted. I have to restart it to solve this problem each time after my PC is up. > > The other problem, I just find this morning, is that table ID generation. Are you talking about the Hibernate connection below? Can you connect using psql? A table ID is defined as the following: > > id SERIAL UNIQUE primary key, > > When I save a new entry to this table, I get an error as > > org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save() This seems to be a Hibernate problem more than a Postgres one. Has there been a upgrade to Hibernate recently? > > from Hibernate. No all table demonstrate this error. > > Shall I reinstall PostgreSQL for resolve those two problem? > > Thanks, > > - v > -- Adrian Klaver adrian.klaver@gmail.com
On 01/31/2011 01:18 PM, vwu98034@lycos.com wrote: > The DB connection problem has nothing to do with Hibernate. As I have said that the problem can be solved by restartingthe DB. >This problem occurs with my application as well as DdVisualizer. So know we know it is a generic connection problem. Is there information in the Postgres logs that might be helpful? > > And as I have mentioned, the id error doesn't occur to other table. Again is there any information generated in the logs when you try to connect to that table? Another thing to check is whether the max id in the table is greater then the last value for the sequence associated with that table. Could be id(s) got inserted without using the sequence. > At this time reinstalling the DB would seem to be excessive. There is no guarantee that the problem won't just appear again with out knowing what is in the first place. -- Adrian Klaver adrian.klaver@gmail.com
In regarding of log message, I get the following error message on my application for the connection problem and there isNOT any error messages in the PG log file. It is the same with DbVisualizer - not error messages in the PG log file. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Caused by: org.postgresql.util.PSQLException: The connection attempt failed. at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:150) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66) at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125) at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30) at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:22) at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:30) at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24) at org.postgresql.Driver.makeConnection(Driver.java:393) at org.postgresql.Driver.connect(Driver.java:267) at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38) at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294) at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221) ... 52 more Caused by: java.io.EOFException at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:261) at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:269) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:108) ... 64 more ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When I try to access PG from PC command prompt with the psql command, I get the following error message: psql: server closed the connection unexpectedly This probably mean the server terminated abnormally before or while processing the request. This time a error message shows up in the PG log file: "FATAL: could not reattach to shared memory (key=5432001, addr=011D0000):Invalid argument" As I can tell, the PG log file doesn't tell the whole story. The version of PG is 8.0. ----- Original Message ----- From: "Adrian Klaver" <adrian.klaver@gmail.com> To: vwu98034@lycos.com Cc: "pgsql-general" <pgsql-general@postgresql.org> Sent: 2011年1月31日 星期一 下午01时30分09秒 GMT -08:00 US/Canada Pacific Subject: Re: [GENERAL] Some Problems - Shall I reinstall the DB? On 01/31/2011 01:18 PM, vwu98034@lycos.com wrote: > The DB connection problem has nothing to do with Hibernate. As I have said that the problem can be solved by restartingthe DB. >This problem occurs with my application as well as DdVisualizer. So know we know it is a generic connection problem. Is there information in the Postgres logs that might be helpful? > > And as I have mentioned, the id error doesn't occur to other table. Again is there any information generated in the logs when you try to connect to that table? Another thing to check is whether the max id in the table is greater then the last value for the sequence associated with that table. Could be id(s) got inserted without using the sequence. > At this time reinstalling the DB would seem to be excessive. There is no guarantee that the problem won't just appear again with out knowing what is in the first place. -- Adrian Klaver adrian.klaver@gmail.com
On Tuesday, February 01, 2011 12:03:20 pm vwu98034@lycos.com wrote: > When I try to access PG from PC command prompt with the psql command, I get > the following error message: > > psql: server closed the connection unexpectedly > This probably mean the server terminated abnormally before or while > processing the request. > > This time a error message shows up in the PG log file: "FATAL: could not > reattach to shared memory (key=5432001, addr=011D0000): Invalid argument" > > As I can tell, the PG log file doesn't tell the whole story. The version of > PG is 8.0. > > I am going to go out on a limb here and say you are running the server on Windows correct? Before we go any further the 8.0.x series is past end of life, especially for the Windows version. The problem you report above FATAL:... is a known Windows version problem. It was fixed in later versions, looks like from 8.2.18 on. I do not run Postgres on Windows, if that indeed is where your server is running, so I am at the limit of what I can help you with. -- Adrian Klaver adrian.klaver@gmail.com
vwu98034@lycos.com writes: > When I try to access PG from PC command prompt with the psql command, I get the following error message: > psql: server closed the connection unexpectedly > This probably mean the server terminated abnormally before or while processing the request. > This time a error message shows up in the PG log file: "FATAL: could not reattach to shared memory (key=5432001, addr=011D0000):Invalid argument" If you're running PG on Windows, this is a known problem that was fixed some time ago ... > As I can tell, the PG log file doesn't tell the whole story. The version of PG is 8.0. ... but not *that* long ago. 8.0.x on Windows was desupported more than three years ago, and as of last year is out of support on all platforms. Please update to a current version. http://www.postgresql.org/about/news.865 regards, tom lane