Connecting to MySQL Server with Netbeans - mysql

I'm trying to connect with MySQL Server using Netbeans, but once I got an error about denied access for user 'root', another time (when I use the password), Netbeans telling me:
java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long
I'm also using MySQL Workbench, so I know my server is working, but Netbeans can't establish a connection with it.
Versions of programs I'm using:
MySQL Server 8.0
MySQL Workbench 6.3 CE
NetBeans 8.2
Driver files I tried:
5.1.23, 5.1.46, 5.1.45 - provided by NetBeans with names (mysql-connector-java-[version number]-bin.jar
8.0.11 - provided by MySQL with path C:\Program Files (x86)\ Connector J 8.0\mysql-connector-java-8.0.11.jar
OS:
Windows 10 x64
Pics:
without using password (in MySQL Workbench I don't need to use password
with using password

Please check this link, it seems this error appears when you don't have the jdbc driver in the classpath. You have to add the jdbc connector jar to NetBeans by going to the "Services" window, expand "Databases", expand "Drivers" and right-click on "MySQL (Connector/J driver)", choose "Customize" there and click the "Add" button in the dialog, navigate to the jdbc connector and add it, afterwards hit the "Find" button of the "Driver Class" field and then choose the correct class name, hit "Ok" and make another right-click on "MySQL (Connector/J driver)" and choose "Connect Using..." and type in your connection settings.
I hope this helps.

Related

Cannot connect MySQL Server to Netbeans

I can't connect to my database using the "new connection" option by right-clicking on Databases in the services tab. I get the following error:
Error Image
Here is information about the server to help with a solution:
Server info
Additional server info
The password I have saved in keychain for the server is "password1" and the connection isn't working even though I entered that.
Ok I finally figured it out. I had to update the MySQL connector driver for Netbeans. I had version "mysql-connector-java-5.1.23-bin" installed and needed to add the new driver "mysql-connector-java-8.0.18.jar" to match the version of MySQL Workbench that I have.

Adding XAMPP SQL database to PhpStorm gives rejected details error

I've installed XAMPP and am running the built in SQL server, but for some reason whenever I try to test the connection of the XAMPP default (test) database through PhpStorm it comes up with an error message of:
The specified database user/password combination is rejected: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'GMT Summer Time' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone.
I haven't changed any settings in phpMyAdmin in XAMPP or anything i've left all settings as default. I followed some video tutorials on YouTube and they didn't get this error.
I can create databases and tables fine in phpMyAdmin with no username or password so i'm not sure what the issue is.
Any help will be appreciated
That's a known problem with latest JDBC drivers, see: https://youtrack.jetbrains.com/issue/DBE-7727. Workarounds:
In DataSource configuration window go to Advanced tab and set serverTimezone property to UTC.
Switch DataSource driver to MySQL Connector/J for 5.1 (my version is 5.1.46)

Pentaho connecting to MySQL database

I am working on Pentaho Data Integration tool version 7.1. I am trying to connect to a database using 'Table Input' step. but when I test the connection in this step in Pentaho it is giving me the below error message. I am able to connect to DB using the MySQL workbench (MySQL is 5.7). I have placed the 'mysql-connector-java-5.1.23-bin.jar' file in the lib folder. My Java is 1.8.0-131; I am using Windows 10.
Error connecting to database [mydb] :org.pentaho.di.core.exception.KettleDatabaseException:
Error occurred while trying to connect to the database
Error connecting to database: (using class org.gjt.mm.mysql.Driver)
Unknown database 'mydb'
Make sure your pentaho version supports mysql connector .if it is not, download the required version and paste -> extract the file and paste it in the
\pdi-ce-8.2.0.0-342\data-integration\lib
After that open spoon.bat goto menu ->tool->marketplace ->install
mysql plugin
Restart pentaho after installing mysql plugin.
then try connecting to mysql .Hope it will solve your issue
It looks like the JDBC does not find your database. It may come from a typing mistake in the name, password, that the user has not enough grant,...
To debug use the test button on the bottom of the new connection button:

Cannot connect to MySQL docker instance via DataGrip application

I have managed to successfully connect to a docker instance running MySQL via the mysql command line utility. However, I am struggling to do so via DataGrip application from JetBrains.
My mysql cli command is as follows:
mysql -h127.0.0.1 --port=8181 -uroot
The connection string that is generated in DataGrip is:
jdbc:mysql://127.0.0.1:8181
The error I am getting from DataGrip interface is:
[08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Is there anything that need to change in DataGrip that I am missing. I have read that the connection has to also be done via TCP. Not sure how to check that DataGrip is doing that.
Update: I eventually found the problem was the docker container I was using. It seems DataGrip is not able to connect to version 8.0.1 (mysql:8.0.1) mysql docker container. I tested using version 5.7 of the container and could successfully connect.
I was having an issue connecting MySQL 8.0.3 using DataGrip. You need to download the JDBC driver from Oracle website. Select Developer Releases (Since this is an unstable version). The 8.0.8 version worked for me. Download and save in a project folder or something similar on your computer. You will gonna need it later.
Go to DataGrip: File > DataSources. Click on the + and select Driver:
Screenshot of the Step above
On the section Driver Files > Additional files click on the + and select the jar file you just downloaded
After that on the Class dropdown select com.mysql.jdbc.Driver
Mark Dialect as MySQL
On the section URL templates, put the Name as default and Template as jdbc:mysql://{host::localhost}?[:{port::3306}][/{database}?][\?<&,user={user},password={password},{:identifier}={:identifier}>]
Click on apply
Done!
Screenshot of MySQL 8.0.3 running on Datagrip
Add a new datasource using the new driver.
If you find the following error:
[01S00] The server time zone value 'PDT' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support
You can do a temporary fix going to the Advanced tab and setting the serverTimezone variable for UTC as an example.
There are no *.jar-files anymore. Only *.deb-packages for my OS on the Oracle site https://dev.mysql.com/downloads/connector/j/5.1.html
So I selected driver Amazon Aurora MySQL for my MySQL 8.0.3 in docker.
It works!

How to Connect MySql from Eclipse using Data Source Explorer

I need help. Could you please answer these question? I would like to connect eclipse to my database and I have tried these in eclipse: Window>Show View>Other>Data Source Explorer. After that we get Database Connections under the eclipse and then right click on the database connection and click on New... then select MySql under Connection Profile Types: and I click on New Driver Definition. Under New Driver Definition dialog, there exists MySql JDBC Driver with specific System Version. I choose one, but the OK button is disabled. Also at the top it says: "Unable to locate JAR/zip in file system as specified by the driver definition: mysql-connector-java-xxx-bin.jar".
How can I specify a Driver Template and Definition Name under New Driver Definition dialog of Data Source Explorer (in Data Tools Platform)
I dont know your Eclipse version or your MySql server version but for Kepler and mysql 5.5 server, here what I did. First I downloaded mysql connector java jar file(mysql-connector-java-5.1.36-bin.jar) from http://dev.mysql.com/downloads. Then On the New Driver Definition dialog page, I choose MySQL JDBC Driver|MySQL|5.1 under Name/Type tag. Go to JAR List tab Clear all and Add JAR/Zip... and choosed my already downloaded jar file. Finally at the Properties tab I filled them like this:
Connection URL: jdbc:mysql://localhost:3306
Database Name: MyDatabaseNameHere
Driver Class: com.mysql.jdbc.Driver
Password: MyPasswordHere
User ID: root
In the end, OK butten changed to enabled and that is all.
I also faced same issue. Just download the specific mysql JAR file needed. Now you need to add it to the JAR files tab. But before doing it click on clear all. That is the important step.