Can`t connect to PostgreSQL database in Pentaho Kettle - java

I`m trying to connect to my PostgreSQL database. What I create a connection and click the button "Test", I receive an error message. I can connect to this db via pgadmin without any problems, so it is not a connection or credentials issue
I`m using Pentaho kettle 8.3, Windows, java version "1.8.0_231"
Error connecting to database [Name] :org.pentaho.di.core.exception.KettleDatabaseException:
Error occurred while trying to connect to the database
Error connecting to database: (using class org.postgresql.Driver)
Ошибка при попытке подсоединения.
Full error stack: https://pastebin.com/cLiB288e

Try to add postgresql-42.1.1.jar in the /lib folder of PDI, restart the spoon and try again.

i faced 2 issues myself connecting to PostgreSQL few months back and following 2 things helped me
1.add postgres-42.1.1jar file in the 'lib' folder under PDI and restart the spoon.
if the normal JDBC connection convention does not work for you try below tip
while configuring the connection specify host name as follows
{HOST IP}:{HOST PORT}/{instance name}?

Related

Something unusual has occurred to cause the driver to fail. Heroku postgresql database

I have created a heroku posgresql database and I am trying to connect my Android app to this database. I am using Android Studio for making the Android app. I have used the following code for creating the connection:
try {
Class.forName("org.postgresql.Driver");
Connection db = DriverManager.getConnection(dbUrl);
}
catch(Exception e){
//handles exception
}
When I execute this code I get the following error: Something unusual has occurred tot cause the driver to fail. Please report this exception.
This is the driver I use: posgresql-42.2.12
The heroku database has version 12.2
Android studio has java version 1.8
I am not sure if the driver is in the classpath and I am not sure how to check this. I added the driver to the project this way: app > New > Module > Import .JAR/.AAR Package (here I selected the driver).
To check if the Driver is registered in DriverManager I used this code:
Enumeration<Driver> drivers = DriverManager.getDrivers();
drivers.nextElement().getClass().getName();
This gives: org.postgresql.Driver
To check if the Driver understandes the URL I used this code:
DriverManager.getDriver(dbUrl).getClass().getName();
This also gives org.posgresql.Driver so I think the Driver is registered to the DriverManager and should be able to connect to the database using the URL. I just really don't know why I keep getting an error when I try to connect with the database.
So why does the error occur and how can I resolve the issue?
My first guess would be a malformed connection string. Are you using a proper JDBC URL (i.e. it starts with jdbc:) for dbUrl? Also make sure you include sslmode=require.
In addition, please be aware that the database URL is managed by Heroku and will change under certain circumstances. You can read more about using Heroku Postgres from outside of Heroku in this DevCenter article.

Netbeans cannot establish a connection to jdbc

I'm trying to create a JDBC connection between a project in Netbeans and a MySQL database. In the Netbeans connection wizard I receive the following
error: Cannot establish a connection to jdbc:mysql://localhost:3306/murach using com.mysql.jdbc.Driver (Unable to load authentication plugin 'caching_sha2_password'.)
I'm running Netbeans 8.2, MySQL 8.0.15 and Java JDK 1.8.0_201. I am able to connect to the database using the credentials supplied in the wizard via the command prompt.
I also confirmed that port 3306 is open in Windows Firewall.
make the driver something like com.mysql5.jdbc.Driver

Connecting Netbeans and MySQL but getting Big Integer error

So I am trying to add new connection to my Netbeans' database which is MySQL but I am getting Big Integer casting error can someone please help me?
In detail:
I right click on existing MySQL Server at localhost:3306 [root(disconnected) >> select connect and this pops up
Unable to connect to the MySQL server:
org.netbeans.api.db.explorer.DatabaseException: org.netbeans.api.db.explorer.DatabaseException: java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long.
The server may not be running or your MySQL connection properties may not be set correctly. Do you want to edit your MySQL connection properties?
And my basic and admin properties are OK.
And I tried this too: Right click on databases >> select New Connection >> Driver: MySQL(Connector/J driver), JDBC URL: jdbc:mysql://localhost:3306/mysql , but when I test the connection it gives me the same error.
**MySQL server is running.
Thank you.
This is a JDBC Driver problem
I had a similar problem in netbeans. I resolved by removing the default driver (Connector/J driver) from the driver list under databases/drivers as shown below.
This happened with jdbc v8.0.12 on mysql v8.0
So after removing the default jdbc driver, I add an old version of the driver mysql-connector-java-5.1.47.
The connection the succeeded.
What is the version of your MySQL driver and your MySQL? If you want to use MySQL 8, for example, you could try to use a MySQL driver which supports MySQL 8.
Try updating your mysql driver.
To install the driver:
1° Go to the services tab, just after databases.
2° Right click on the drivers folder and select add new driver.
3° Click add and look for the .jar of the driver you downloaded.
Remove and clean the jdbc connector jar files already come with netbeans.
Add a new connector jar file to the jdbc library.
(You can download ==> mysql-connector-java/8.0.11
Try again, connection is going to be ok now.

Why IntelliJ IDEA doesn't connect oracle database with java code in maven project?

I'm trying to make maven project which should work with oracle database.
First I tried to connect database to DB Browser in IDEA, but I've no idea how to use it in code if it's even possible. However I use following java code:
Base.open("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:#localhost:1521:XE", "SYSTEM", "pass");
it doesn't run with error Failed to connect to JDBC URL:
jdbc:oracle:thin:#localhost:1521:XE Caused by: java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1
ORA-12705: Cannot access NLS data files or invalid environment specified.
But according to connection info in DB browser it's written right. What's going wrong?
Problem solved by following code before Base.open(...);: Locale.setDefault(Locale.ENGLISH);

Could not connect to New SQL Server in eclipse

Connecting/pinging a database in eclipse gives me error:
My software is: MySql Server 5.5.12, Connector/J 5.1.17, Eclipse IDE for Java EE Developers v. 1.4.0.20110615-0550.
Logging from console or phpmyadmin works ok.
Here is also screenshot of connection settings:
Any suggestions about this error?
You are loading a MSSQL driver, but you are running a MySQL server.
http://www.mysql.com/products/connector/
change the driver to Mysql driver 5.0 and it will connect properly

Categories