vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, today I subscribed to this mailing list. I hope someone can help me with my problem. When I try to set the datestyle of the driver postgresql-8.0-311.jdbc3.jar with this code: connection = (Connection) DriverManager.getConnection(URL); Statement s=connection.createStatement(); s.executeUpdate("set datestyle ='european,sql'"); s.execute("show datestyle"); s.close(); I get this error message: org.postgresql.util.PSQLException: The server's DateStyle parameter was changed to SQL, DMY. The JDBC driver requires DateStyle to begin with ISO for correct operation. at org.postgresql.core.v3.QueryExecutorImpl.processRe sults(QueryExecutorImpl..java:1302) at org.postgresql.core.v3.QueryExecutorImpl.execute(Q ueryExecutorImpl.java:175) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut e(AbstractJdbc2Statement.java:389) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut eWithFlags(AbstractJdbc2Statement.java:314) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut eUpdate(AbstractJdbc2Statement.java:264) at DBConnection.DBConnection.<init>(DBConnection.java :57) at GUI.Loader.setConfiguration(Loader.java:96) at GUI.Loader.<init>(Loader.java:23) at GUI.MainServer.main(MainServer.java:17) org.postgresql.util.PSQLException: An I/O error occured while sending to the backend. at org.postgresql.core.v3.QueryExecutorImpl.execute(Q ueryExecutorImpl.java:201) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut e(AbstractJdbc2Statement.java:389) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut eWithFlags(AbstractJdbc2Statement.java:314) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut eQuery(AbstractJdbc2Statement.java:221) at DBConnection.DBConnection.getRecordCount(DBConnect ion.java:397) at GUI.Loader.setConfiguration(Loader.java:98) at GUI.Loader.<init>(Loader.java:23) at GUI.MainServer.main(MainServer.java:17) Caused by: java.io.IOException: Stream closed at sun.nio.cs.StreamEncoder.ensureOpen(StreamEncoder. java:38) at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java: 151) at java.io.OutputStreamWriter.flush(OutputStreamWrite r.java:213) at org.postgresql.core.PGStream.flush(PGStream.java:4 93) at org.postgresql.core.v3.QueryExecutorImpl.sendSync( QueryExecutorImpl.java:631) at org.postgresql.core.v3.QueryExecutorImpl.execute(Q ueryExecutorImpl.java:174) ... 7 more org.postgresql.util.PSQLException: The server's DateStyle parameter was changed to SQL, DMY. The JDBC driver requires DateStyle to begin with ISO for correct operation. at org.postgresql.core.v3.QueryExecutorImpl.processRe sults(QueryExecutorImpl..java:1302) at org.postgresql.core.v3.QueryExecutorImpl.execute(Q ueryExecutorImpl.java:175) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut e(AbstractJdbc2Statement.java:389) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut eWithFlags(AbstractJdbc2Statement.java:314) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut eUpdate(AbstractJdbc2Statement.java:264) at DBConnection.DBConnection.<init>(DBConnection.java :57) at GUI.Loader.setConfiguration(Loader.java:96) at GUI.Loader.<init>(Loader.java:23) at JDoc.Server.setParameters(Server.java:214) at JDoc.Server.<init>(Server.java:45) at GUI.MainServer.main(MainServer.java:24) org.postgresql.util.PSQLException: An I/O error occured while sending to the backend. at org.postgresql.core.v3.QueryExecutorImpl.execute(Q ueryExecutorImpl.java:201) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut e(AbstractJdbc2Statement.java:389) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut eWithFlags(AbstractJdbc2Statement.java:314) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut eQuery(AbstractJdbc2Statement.java:221) at DBConnection.DBConnection.getRecordCount(DBConnect ion.java:397) at GUI.Loader.setConfiguration(Loader.java:98) at GUI.Loader.<init>(Loader.java:23) at JDoc.Server.setParameters(Server.java:214) at JDoc.Server.<init>(Server.java:45) at GUI.MainServer.main(MainServer.java:24) Caused by: java.io.IOException: Stream closed at sun.nio.cs.StreamEncoder.ensureOpen(StreamEncoder. java:38) at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java: 151) at java.io.OutputStreamWriter.flush(OutputStreamWrite r.java:213) at org.postgresql.core.PGStream.flush(PGStream.java:4 93) at org.postgresql.core.v3.QueryExecutorImpl.sendSync( QueryExecutorImpl.java:631) at org.postgresql.core.v3.QueryExecutorImpl.execute(Q ueryExecutorImpl.java:174) ... 9 more org.postgresql.util.PSQLException: The server's DateStyle parameter was changed to SQL, DMY. The JDBC driver requires DateStyle to begin with ISO for correct operation. at org.postgresql.core.v3.QueryExecutorImpl.processRe sults(QueryExecutorImpl..java:1302) at org.postgresql.core.v3.QueryExecutorImpl.execute(Q ueryExecutorImpl.java:175) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut e(AbstractJdbc2Statement.java:389) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut eWithFlags(AbstractJdbc2Statement.java:314) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut eUpdate(AbstractJdbc2Statement.java:264) at DBConnection.DBConnection.<init>(DBConnection.java :57) at JDoc.Server.main(Server.java:64) at JDoc.Server.<init>(Server.java:46) at GUI.MainServer.main(MainServer.java:24) org.postgresql.util.PSQLException: An I/O error occured while sending to the backend. at org.postgresql.core.v3.QueryExecutorImpl.execute(Q ueryExecutorImpl.java:201) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut e(AbstractJdbc2Statement.java:389) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut eWithFlags(AbstractJdbc2Statement.java:314) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut eUpdate(AbstractJdbc2Statement.java:264) at DBConnection.DBConnection.executeQueryInsert(DBCon nection.java:291) at JDoc.Server.main(Server.java:65) at JDoc.Server.<init>(Server.java:46) at GUI.MainServer.main(MainServer.java:24) Caused by: java.io.IOException: Stream closed at sun.nio.cs.StreamEncoder.ensureOpen(StreamEncoder. java:38) at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java: 151) at java.io.OutputStreamWriter.flush(OutputStreamWrite r.java:213) at org.postgresql.core.PGStream.flush(PGStream.java:4 93) at org.postgresql.core.v3.QueryExecutorImpl.sendSync( QueryExecutorImpl.java:631) at org.postgresql.core.v3.QueryExecutorImpl.execute(Q ueryExecutorImpl.java:174) ... 7 more org.postgresql.util.PSQLException: An I/O error occured while sending to the backend. at org.postgresql.core.v3.QueryExecutorImpl.execute(Q ueryExecutorImpl.java:201) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut e(AbstractJdbc2Statement.java:389) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut eWithFlags(AbstractJdbc2Statement.java:314) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut eQuery(AbstractJdbc2Statement.java:221) at DBConnection.DBConnection.executeQueryCountLog(DBC onnection.java:126) at JDoc.Server.main(Server.java:66) at JDoc.Server.<init>(Server.java:46) at GUI.MainServer.main(MainServer.java:24) Caused by: java.io.IOException: Stream closed at sun.nio.cs.StreamEncoder.ensureOpen(StreamEncoder. java:38) at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java: 151) at java.io.OutputStreamWriter.flush(OutputStreamWrite r.java:213) at org.postgresql.core.PGStream.flush(PGStream.java:4 93) at org.postgresql.core.v3.QueryExecutorImpl.sendSync( QueryExecutorImpl.java:631) at org.postgresql.core.v3.QueryExecutorImpl.execute(Q ueryExecutorImpl.java:174) ... 7 more org.postgresql.util.PSQLException: An I/O error occured while sending to the backend. at org.postgresql.core.v3.QueryExecutorImpl.execute(Q ueryExecutorImpl.java:201) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut e(AbstractJdbc2Statement.java:389) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut eWithFlags(AbstractJdbc2Statement.java:314) at org.postgresql.jdbc2.AbstractJdbc2Statement.execut eUpdate(AbstractJdbc2Statement.java:264) at DBConnection.DBConnection.executeQueryInsert(DBCon nection.java:291) at JDoc.Server.main(Server.java:66) at JDoc.Server.<init>(Server.java:46) at GUI.MainServer.main(MainServer.java:24) Caused by: java.io.IOException: Stream closed at sun.nio.cs.StreamEncoder.ensureOpen(StreamEncoder. java:38) at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java: 151) at java.io.OutputStreamWriter.flush(OutputStreamWrite r.java:213) at org.postgresql.core.PGStream.flush(PGStream.java:4 93) at org.postgresql.core.v3.QueryExecutorImpl.sendSync( QueryExecutorImpl.java:631) at org.postgresql.core.v3.QueryExecutorImpl.execute(Q ueryExecutorImpl.java:174) ... 7 more How can I change the code to have the date format as it is in the db (that is DD/MM/YYYY HH:MM:SS) and not as YYYY/MM/DD? Thank you ! Albert |
| ||||
| On Thu, 30 Jun 2005, Alberto Molteni wrote: > today I subscribed to this mailing list. I hope someone can help me with > my problem. > > When I try to set the datestyle of the driver > > org.postgresql.util.PSQLException: The server's DateStyle parameter was > changed to SQL, DMY. The JDBC driver requires DateStyle to begin with > ISO for correct operation. > > How can I change the code to have the date format as it is in the db > (that is DD/MM/YYYY HH:MM:SS) and not as YYYY/MM/DD? > You should do any formatting you need by retrieving a java Date or Timestamp object and using a java.text.SimpleDateFormat to turn it into the text representation you desire. Kris Jurka ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly |