Postgres NetBeans connection driver issue - postgresql

I am tryng to configure a connection to postrgresql db server via Services window of Netbeans 7.3.1 and I get the following error:
Cannot establish a connection to jdbc:postgresql://xxx.xxx.xx:5432/ using org.postgresql.Driver (ERROR: Unsupported startup parameter: extra_float_digits)
I have foud a possible workaround :
ignore_startup_parameters = extra_float_digits
Is there some way to set this parameter in a config file?
Thanks

From PostgreSQL 9.2, a new server parameter extra_float_digits is added to control precision display of floating-point numbers Source. I think that it is better to use the right jdbc version for your server PostgreSQL version(9.0.3.2). In your case 9.0-802 JDBC 4

Related

Failed PostgreSQL database connection in Pentaho Data Integration PDI

Objective: Set up a connection with PostgreSQL db in PDI. I'm a noob in all this stuff, so each step forward requires long resolution time.
I'm trying to set up the connection to a PostgreSQL database in order to prepare some queries for an ETL process in PDI. But there's no way to succeed with the connection.
I've tried with PostgreSQL connection type and with Generic database connection type and the error is always related with the drivers.
The version of the PostgreSQL db I'm trying to connect is 9.5.25 and I'm working in Ubuntu 20.04 and Java 8 as demands Pentaho Data Integration.
Below the error message after failed connection:
"Connection failed. Verify all connection parameters and confirm that the appropriate driver is installed. Connection to [IP]:[Port] refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections."
I am literally in despair, don't know what I'm doing wrong. Will be very grateful with anyone who can help me.
You need to add the jdbc driver to connect to postgresql DB in the pdi-installation/lib directory, you just put the *.jar file there and restart spoon to have the library available.
That driver can be downloaded from postgresql downloads. The Community Edition of PDI only comes with a small number of jdbc drivers, for each type of database you need to connect to, you should check if the jdbc driver is available in that directory, and if it's up to date or if you need a more recent version of the driver.
This is a link for the official Pentaho documentation, looking for information in Hitachi Vantara documentation is becoming more and more difficult, they don't always clarify what steps apply only for the Enterprise Edition and are not available for the Community Edition: https://help.hitachivantara.com/Documentation/Pentaho/9.2/Setup/JDBC_Drivers_Reference

PosgreSQL odbc ssl connection, libpq connection parameter error:invalid connection option "{sslrootcert"

I am having problems with odbc psql link on centos8 and with postgres-odbc version 10.3(this one was the default one in the repository)
I have defined my ssl cert files as such
pqopt={sslrootcert=/etc/ssl/certs/db_ssl_cert/client.crt \
sslcert=/etc/ssl/certs/db_ssl_cert/postgresql_client.crt \
sslkey=/etc/ssl/certs/db_ssl_cert/postgresql_client.key}
But I keep getting error(when using isql), even though I can connect using psql
[08001][unixODBC]libpq connection parameter error:invalid connection option "{sslrootcert"
I get this error no matter what I put in front of the first = sign.
Should the certificates be in ~/.postgresql/ directory?
What is the problem? On my windows machine I input parameters as above and no problems with the driver version 11.0, should I simply update the driver to the latest version, or what would be the solution as pgopt was supported from 9.6 postgres-odbc?

Migrating to Oracle using Corda Enterprise Database Manager Tool Unable to Connect

I am using Corda Enterprise 3.1 and trying to move the vault from H2 to Oracle 12c using the Database Migration tool supplied. I have made the changes in the node.conf configuration using values I know work to connect from IntelliJ. The driver is Oracle's ojdbc8.jar that came with Oracle SQL Developer. The connection string is below but with some specifics masked. It doesn't work. Any ideas?
dataSourceClassName = oracle.jdbc.pool.OracleDataSource
dataSource.url = "jdbc:oracle:thin:#xxxxx.wellsfargo.com:1539:XXXXXX"
Here is the error I get:
-- 2018-08-07T00:04:55,757Z migration.tool.handleCommand - Exporting the current db migrations ... Failed to create datasource. Please
check that the correct JDBC driver is installed in one of the
following folders:
- /apps/team/drivers/jdbc
Caused By java.sql.SQLRecoverableException: IO Error: The Network Adapter could
not establish the connection
This issue was caused by an error in the host URL.

How to set application name in a Postgresql JDBC url?

I want to set the application name of the connections of my application. So when I list the rows in pg_stat_activity I can have a non empty application_name column.
I have setup the following JDBC url for connecting to my Postgresql database:
jdbc:postgresql://localhost:5435/MyDB?application-name=MyApp
I have tried also this url with no more success.
jdbc:postgresql://localhost:5435/MyDB?application_name=MyApp
What is the correct parameter name ?
Here is my JDBC driver version: 9.1-901.jdbc4
Looking at the PostgreSQL JDBC 9.1 documentation, connection parameters, the correct property name in the JDBC url is ApplicationName:
ApplicationName = String
Specifies the name of the application that is using the connection. This allows a database administrator to see what applications are connected to the server and what resources they are using through views like pg_stat_activity
So try:
jdbc:postgresql://localhost:5435/MyDB?ApplicationName=MyApp
Be aware some comments suggest that this is broken in the 9.1 version driver. Given it is a more than 5 year old version, you should upgrade to a newer version anyway. Check https://jdbc.postgresql.org/ for the latest version and use that.

c3p0 pool cannot establish a connection. How to debug this?

I have a Tomcat and PostgreSQL installed on a server. I'm having a connection problem trying to connect from my servlet to PostgreSQL database using c3p0 pool.
I can reach DB if I'm running Tomcat locally on my laptop. Also I can connect from server to DB using psql (i.e. command line sql utility). But when I'm trying to deploy my servlet to server and establish a connection I'm getting the following error:
java.sql.SQLException: Connections could not be acquired from the underlying database!
com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
...
com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1319)
com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
What should I check to locate a problem? It should be a trivial issue but may be due to 4 a.m. I'm missing something :) Thanks in advance!
PS: Connection from all network interfaces are allowed to database. PostgreSQL JDBC driver and c3p0 pool are distributed in WAR. Tomcat configuration is very default. JNDI is not used.
You need to check a few things:
java.policy which tomcat is using
(e.g.
/etc/tomcat5.5/policy.d/02debian.policy)
db server settings (e.g.
/etc/postgresql/pg_hba.conf)
try connecting without pool first as
in my case c3p0 was hiding important information from me
Adding to #Alexey's answer, I had this issue with Tomcat and PostgreSQL 9.4. In my case, the md5 authentication method in postgres was causing the issue.
If you are using Windows server or RHEL server, make sure you update the authentication method in pg_hba.conf file. Modify it to trust and restart postgresql.