I'm using an IDE "Phpstorm" with "wampserver". i want to connect with MySQL data source, but i'm getting a problem:
Connection to MySQL - DatabaseName@localhost failed: Exception in thread "main" java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:190) at com.intellij.persistence.database.console.RemoteJdbcServer.main(RemoteJdbcServer.java:15)
I also downloaded mysql-connector-java-gpl-5.1.29.msi
and installed it, but I'm still getting some problems.
When I had this issue, there was a section of the Data Sources and Drivers Dialogue box that said "Driver Files" I expanded it and there was a link to download driver files.
I clicked it - and after a few seconds (with no obvious visual progress indicator) the message changed to say using MySQL drivers.
After that it worked.
Short version:
From there on you should be good to go. (phpstorm handles the rest)
Detailed version:
New Version v2020: If it's not there open it from View -> Tool Windows -> Database
New Version v2020 - In this new popup window choose MySQL from the left.
New Version v2020: - Now you should be on the settings tab where you can see driver files, if any of them are red just delete them with the minus symbol, as soon as there are no driver files left you are able to click on download.
If any of the above fail try these:
Delete the drivers in use and reinstall. Usually located at ~/.PhpStormXXXX/config/jdbc-drivers. After that repeat the first instructions in this post. (short version)
Using a proxy? Make sure you have configured it within phpstorm! At Appearance & Behavior -> System Settings -> HTTP Proxy.
Make sure you have the latest drivers: Create a new mysql datasource, if the driver needs an update it will display it on the very bottom of the popup
try other versions New Version v2020:
Installing the Driver Manually
I couldn't find any official Jetbrains mysql driver repo page, but these urls are official and work:
The Newest version number can be found here: https://dev.mysql.com/downloads/connector/j/5.1.html
just replace the [VERSION] with the current version e.g. http://download.jetbrains.com/idea/jdbc-drivers/mysql-connector-java-[VERSION]-bin.jar
Add the downloaded file with clicking on the small grey plus. (in older versions green and on the right)
New Version v2020:
Or try the official mysql repo (caution you MUST register to download!):
Go to http://dev.mysql.com/downloads/connector/ within the dropdown select "Platform Independent" it will show you the options to download tar or zip files. Download one of them and extract it, Within the resulting folder you will find a mysql-connector-XXX.jar file. Add it to phpstorm in the mysql datasource dialog box.
Other stuff:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With