Re: FW: Error!
Am 25.04.23 um 01:16 schrieb Arquimedes Aguirre: No, it has not changed the error that I have been experiencing since the beginning. This is the error: psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: password authentication failed for user "punta" Press any key to continue . . ... Hi, is it possible that postgres is listening on ipv4(127.0.0.1) only and you trying connect to ipv6(::1)? try connect to 127.0.0.1 as "server" instead of "localhost".
Re: FW: Error!
Am 25.04.23 um 17:02 schrieb Adrian Klaver: On 4/25/23 07:31, postgresql439...@heinz-it.de wrote: Am 25.04.23 um 01:16 schrieb Arquimedes Aguirre: No, it has not changed the error that I have been experiencing since the beginning. This is the error: psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: password authentication failed for user "punta" Press any key to continue . . ... Hi, is it possible that postgres is listening on ipv4(127.0.0.1) only and you trying connect to ipv6(::1)? try connect to 127.0.0.1 as "server" instead of "localhost". Then you would get this error: psql: error: connection to server at "::1", port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections? OK, my mistake. but is there a possibility to put in the same (may be copy/paste) credentials with different clients and cause this error? spoiler: there are many and the password 123456 was invented for this case. conclusion: after a few tests i would bet on a password which causes an ugly hiccup and this could be not users fail. testing: - windows installer with default settings, password is quite simple 123456. - in pgadmin create a new role with "special" password(i take the german specialties üöä or even some symbols). no errors. - in pgadmin add new server with credentials of new role ... automatic try to connect. connected! looks like there is nothing wrong at all. BUT - start the "SQL Shell" or try psql directly. - default settings(localhost:5432:postgres:postgres) and the simple password 123456 - connected. may be a warning about encoding/codepage, but connected. try credentials for new role. result: see TO first/last message. try change codepage (the docs says 1252 is appropriate for german). same result. password file in ANSI, same result. conclusion: see above the hardest fail: i tried first of all something like "special" password for superuser during installation and get lost without any idea why. error: "failed to load SQL modules into the database cluster." next one follows, warning: "Problem running post-install step. Installation may not complete correctly Error reading file C:/Program Files/PostgreSQL/15/data/postgresql.conf" result: initialization failed, data directory doesn't exist. the final shot is the installation-summary log, no errors, no comments about that even something could be not as expected. how someone would see this and get to understanding that his/her keyboard has wrong keys to type right passwords? PS to whom it may concern: it's not my problem and i don't use it this way. but other people have no choice. safe the lost souls, do it better, please! A.H.
Re: "pgsql-zh-general" can't send chinese mail.
Hi, Am 04.06.23 um 11:15 schrieb Wen Yi: Hi team, I want to use the list "pgsql-zh-general" to communicate with chinese user. But it can't send chinese mail, because he recognizes all Chinese emails as spam. before this message your mail was listed at https://www.postgresql.org/list/pgsql-zh-general/since/202306040910 Can someone provide some solution? Thanks in advance! Yours, Wen Yi
Re: debugger from superuser only.... why?
hi, the first steps to use debugger: 1. modify config file 2. restart server ... i would say, enough reasons to be superuser or not?
Re: Start service
Am 22.09.23 um 20:40 schrieb Brad White: I'm trying to start a v15 service on a Windows 2012 R2 server where it hasn't been used for a while. The service is set to run as pgUser. pgUser owns the Postgres directory, including the data dir. The command the service is using is ' "C:\Program Files\PostgreSQL\15\bin\pg_ctl.exe" runservice -N "postgresql-x64-15" -D "C:\Program Files\PostgreSQL\15\data" -w' First off, it's interesting that "runservice" isn't listed as an option for pg_ctl. Windows Event Viewer shows it starting up, handing off logging to pg_log, then timing out. Waiting for server startup... 2023-09-22 12:31:15.173 CDT [5000] LOG: redirecting log output to logging collector process 2023-09-22 12:31:15.173 CDT [5000] HINT: Future log output will appear in directory "pg_log". Timed out waiting for server startup It does create a log file in pg_log, but it is empty. If I sub 'start' for 'runservice' and try to start it from CLI, I get C:\Users\administrator>"C:\Program Files\PostgreSQL\15\bin\pg_ctl.exe" start -N "postgresql-x64-15" -D "C:\Program Files\PostgreSQL\15\data" -w waiting for server to start2023-09-22 12:48:05.438 CDT [4796] FATAL: could not create lock file "postmaster.pid": Permission denied stopped waiting pg_ctl: could not start server Examine the log output. And again, I get an empty log file in pg_log. Is there somewhere else I should check? I get the same results if I pass username and password with -U and -P I'm running as administrator, so not sure how I get permission denied Checking EffectiveAccess shows that admin and pgUser have full control, so I assume this message is a red herring, standing in for the real issue. Without an actual error message to fix, I'm not sure how to proceed. Thanks, Brad. if you want to run postgresql server then you could use "pg_ctl start ..." but to run it as a windows service you first need to register it as a service. so look at pg_ctl register in the options.
Re: jdbc problem
Am 24.09.23 um 19:33 schrieb Raivo Rebane: Hi, I hav postgresql 15 installed in my windows computer. I have maven java project, wich works temporarly in Eclipse, but mvn install did'nt work. Now it works, but I have got error - Exception in thread "main" java.lang.NoSuchMethodError: 'org.postgresql.core.Encoding org.postgresql.core.BaseConnection.getEncoding()' at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getString(AbstractJdbc2ResultSet.java:1889) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getTimestamp(AbstractJdbc2ResultSet.java:438) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getTimestamp(AbstractJdbc2ResultSet.java:2406) at backendproject.BackendMain.main(BackendMain.java:64) backendproject.BackendMain.main(BackendMain.java:64) line is following - Timestamp oldest_timestamp = resultSet.getTimestamp("oldest_timestamp"); Query from Java is following - String query = "SELECT timestamp AS oldest_timestamp FROM mushrooms"; PreparedStatement statement = connection.prepareStatement(query); ResultSet resultSet = statement.executeQuery(); And pom.xml contains - org.postgis postgis-jdbc 1.3.3 org.postgresql postgresql 42.2.0 and mvn install gives - [INFO] --- dependency:3.6.0:copy-dependencies (copy-dependencies) @ backendproject --- [INFO] Copying postgis-jdbc-1.3.3.jar to C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\postgis-jdbc-1.3.3.jar [INFO] Copying postgis-stubs-1.3.3.jar to C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\postgis-stubs-1.3.3.jar [INFO] Copying postgresql-8.3-603.jdbc4.jar to C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\postgresql-8.3-603.jdbc4.jar [INFO] Copying postgresql-42.2.0.jar to C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\postgresql-42.2.0.jar What is reason of this error and how to resolv it ? Regards Raivo i would try to reorder the maven dependencies, so postgresql part is loaded first. or like other people with same error, try exclude postgis-stubs from postgis-jdbc: | ||org.postgis ||postgis-jdbc ||1.3.3 ||compile || || ||org.postgis ||postgis-stubs || || |||
Re: Right version of jdbc
Am 29.09.23 um 20:42 schrieb Dave Cramer: On Fri, 29 Sept 2023 at 14:22, Raivo Rebane wrote: Thanks, there was really JDK 17 in use. I changed it to Java 1.8 PS C:\Program Files\Apache Software Foundation\Tomcat 9.0\bin> java -version java version "1.8.0_381" Java(TM) SE Runtime Environment (build 1.8.0_381-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.381-b09, mixed mode) but the same error occured : java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost:5432/mushroom_database at java.sql.DriverManager.getConnection(DriverManager.java:689) at java.sql.DriverManager.getConnection(DriverManager.java:247) at MushroomAPIs.AddMushrooms.doGet(AddMushrooms.java:30) why java.sql gives that error ? for some reason the postgresql jar is not in the classpath. Dave try to call "Class.forName("org.postgresql.Driver");" before "connection = DriverManager.getConnection(DB_URL, USER, PASSWORD);" i had some issues with getConnection() some time ago and this was the solution. no idea why.
Re: Right version of jdbc
Am 30.09.23 um 08:33 schrieb Raivo Rebane: Hi, sometimes I am lucky and don't get the old error, but sometime not. I tried to use PreparedStatement, but I got error - org.postgresql.util.PSQLException: Can't use query methods that take a query string on a PreparedStatement. at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:145) at MushroomAPIs.Clean.deleteAllRecordsFromTable(Clean.java:34) and java code is - String deleteQuery = "DELETE FROM " + tableNam System.out.println(deleteQuery); PreparedStatement statement = connection.prepareStatement(deleteQuery); if your statement is already prepared with query, use statement.exequte(); or statement.executeQuery() without querystring; if you have a new statement without query, use execute and such with query string. May be it's easy for me to use normal statement ? Raivo On Sat, Sep 30, 2023 at 8:27 AM Raivo Rebane wrote: [snip] Am 30.09.23 um 09:18 schrieb Raivo Rebane: I fix previous error what was my bad knowledge, But new error occur which is related to postgres postgis jars. If You are kind to answer me more; Java code is : public static boolean CheckIsNewInMushrooms(Connection connection, Point AddLocation, String AddDescription) { boolean IsNew = true; try { String sqlQuery = "SELECT location, description FROM mushrooms"; try (PreparedStatement preparedStatement = connection.prepareStatement( sqlQuery)) { ResultSet resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { Point point = (Point) resultSet.getObject("location"); String description = resultSet.getString("description"); if (AddLocation.x == point.x && AddLocation.y == point.y && AddDescription .equals(description)) IsNew = false; } } } catch (SQLException e) { e.printStackTrace(); } return IsNew; } and at line Point point = (Point) resultSet.getObject("location"); java.lang.ClassCastException: org.postgresql.util.PGobject cannot be cast to org.postgis.Point at MushroomAPIs.ProcAddMushrooms.CheckIsNewInMushrooms(ProcAddMushrooms.java:45) How to get Point from resultset ? Is it related to postgis driver ? try another way to cast to Point. look for the way over PGgeometry like here https://postgis.net/docs/manual-3.3/ch07.html#idm3092 Regards Raivo