1

I'm learning java and I'm trying to connect mySql database with Intellij Idea.

I downloaded mysql and mysql workbench. Also , i downloaded "mysql connection jar". And i add the jar from modules section.

My code and the error : https://prnt.sc/rchbuo

Mysql workbench server info : https://prnt.sc/rchcm6

Everything seems OK. But i get error. Do you have a suggestion ?

Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95
Emre
  • 53
  • 6

1 Answers1

1

The way Java works, external modules are .jar files. Here's a guide to installing the MySQL java module, branded Connector/J. Try extracting the contents of your mysql-connector-java.8.0.19.tar file. It contains the .jar file you need as an external module..

This is definitely baffling to Java newcomers. .jar files are basically .zip files with a standardized set of stuff in them. The whole Java system knows how to treat them as code modules. .tar files, on the other hand, are a kind of multifile archive that originated with UNIX. Java treats them as plain old files (that is, ignores them).

Patience! You'll get the knack!

O. Jones
  • 103,626
  • 17
  • 118
  • 172