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
Related
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}?
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.
In Intellij Idea 12, i'm trying to start glassfish and deploy my application.
I got that error: rg.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Connection could not be allocated because: java.net.ConnectException. Port 1527 closed.
But when I run the same project in Netbeans, I see that Netbeans start the connection on 1527 before starting Glassfish. And the option is checked: "Enable JDBC Driver Deployment".
How can I do the same in Intellij?
Thanks in advance
That was due to the Apache derby server that wasn't running.
I need to run before the script "startNetworkServer" from derby driver to make it work
I have a Java application, which uses Apache Derby. Using Eclipse Export option, I exported it as JAR file. When I am running Eclipse, and the server is connected to port 1527, the JAR executes correctly.
However when eclipse is closed, (and the server is not connected to 1527) on executing jar, i get this error
java.sql.SQLNonTransientConnectionException: java.net.ConnectException
: Error connecting to server localhost on port 1527 with message
Connection refused.
This is understandable. But i want to distribute the JAR. So is there a way to start the server programmatically, whenever JAR is executed?
You can start the NetworkServer programmatically:
NetworkServerControl serverControl = new NetworkServerControl(InetAddress.getByName("myhost"),1621)
serverControl.shutdown();
Simplest is to use embedded Derby
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
conn = DriverManager.getConnection("jdbc:derby:" + DATA_STORE + ";create=true");
You need to start the server programmatically.
How this is done is documented in the manual:
http://db.apache.org/derby/docs/10.8/adminguide/tadminconfig814963.html
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