Connect to MySQL Data Source in PHPStorm - php

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:
Open the Database tab, usually located on the very upper right of
PHPSTORM.
Click on the small wrench (Data Source and Property)
In this new popup window choose MySQL from the left.
Delete Red driver files with the minus symbol
Click Download
From there on you should be good to go. (phpstorm handles the rest)
Detailed version:
Open the Database tab, usually located on the very upper right of PHPSTORM.
Click on the small wrench (Data Source and Property)
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:
http://download.jetbrains.com/idea/jdbc-drivers/mysql-connector-java-5.1.35-bin.jar
http://download.jetbrains.com/idea/jdbc-drivers/mysql-connector-java-5.1.40-bin.jar
http://download.jetbrains.com/idea/jdbc-drivers/mysql-connector-java-5.1.44-bin.jar
http://download.jetbrains.com/idea/jdbc-drivers/mysql-connector-java-5.1.45-bin.jar
http://download.jetbrains.com/idea/jdbc-drivers/mysql-connector-java-5.1.46-bin.jar
http://download.jetbrains.com/idea/jdbc-drivers/mysql-connector-java-5.1.47-bin.jar
http://download.jetbrains.com/idea/jdbc-drivers/mysql-connector-java-5.1.48-bin.jar
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:
Useful phpstorm UI reference link

Code Monkey's answer pointed me in the right direction, but my firewall blocked the download from within PHPstorm. Luckily the error message included the download URL to find the driver.
So I downloaded the driver with help from the URL, and then added it manually:

PHPStorm 2020.1 with Material Dark theme:
Hit Alt+0 or View→Tool Windows→Database to open the Database tool window.
Click the pancakes-with-wrench icon
Click the TEST CONNECTION button
This will prompt you to download the drivers - do it
You will have to enter your root password again

Had the same issue. I resolved it in the Data source and drivers window on panel Mysql. There is checkbox "Use provided driver" and next to it there was link "Version 5.1 (latest)". I clicked on it a now it works.

Anyone else who came here trying to locate the Database tab in the latest version of PhpStorm (Version 2017.1), which is hidden at first, try the following, taken from PhpStorm Website
Database support is provided through the Database Tool Window on the right-hand side of the IDE. Use the View | Tool Windows | Database menu or Find Action, by pressing Ctrl+Alt+A (Alt-CMD-A on Mac OS X) and search for "Database" to open it.

if nothig of above works, you can delete .PhpStorm2017.3/config/jdbc-drivers folder. then navigate to your db properties and download the driver again

Related

How to make visual code recognize classes available from extension, such as mongodb?

I have installed phpintellephsense and have enabled MongoDb extension for PHP.
But apparently vscode can't recognize classes from mongodb extension, and can't give suggestion about that class... The code included work fine though...
I'm on ubuntu 21.04, using vscode 1.58.2, phpintelephsense v1.7.1, php 7.4
Please give me some direction ... class not recognized
I just found the solution when I exploring Intellephsense setting.
Steps:
Open Extension Panel on the Left, search for Intellephsense
Click setting button(gear icon)
Search setting 'Intellephsense:Stubs'
Click 'Add Item', scroll to find mongodb, click 'Add'
Voila... all the jaggy red line vanished.. and when I hover on the variable, VSCode able to show description and available method from that class...

PHP Desktop Chrome has stopped working

i have used php desktop application for codeigniter project its work properly
now i used inno setup to create setup for php desktop application
inno setup : step for inno setup
i have follow all the step and setup was create but after execute application not run and below error generate
Problem signature:
Problem Event Name: APPCRASH
Application Name: phpdesktop-chrome.exe
Application Version: 31.8.0.0
Application Timestamp: 546f0770
Fault Module Name: libcef.dll
Fault Module Version: 3.1650.1562.0
Fault Module Timestamp: 52d3dd6e
Exception Code: 80000003
Exception Offset: 001179c0
OS Version: 6.1.7600.2.0.0.256.1
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.txt
here is screenshot :
Method 1 – Reinstall google chrome or upgrade google chrome
(1) Go to “control panel –> Programs and features –> Select google chrome” to uninstall it.
(2) Now go to this path in your local computer “C:Program FilesGoogle” and delete “Chrome” folder. If you are using 64 bit computer then path of the folder will be ” C:Program Files (x86)Google”.
(3) Now, Go here and download latest version of google chrome and install it.
(4) Restart your computer after reinstalling google chrome and check whether problem is resolved or not.
Method 2 – Clear cookies and disable unwanted extensions and apps
(1) Click on this icon (Top right side of gogole chrome) –> go to settings –> Show advanced settings

Laravel reporting errors

When Laravel throw an error it show me a page with the description of error pointing me in what file is located the error, in this page are a link with this format
subl://open?url=file://home/user/etc
I know that the goal is open the file with sublime text but it doesn't work.
I would like to know how to configure firefox in order to be able to open the file.
My working environment is laravel whith ubuntu 12
Firefox 35.01
and Sublime text 2
This is done by registering a new protocol handler for the browser. In Firefox the process is discussed here for a myriad of Firefox versions and operating systems. In your specific case (FF 3.5+ on Linux), it can be done via this procedure:
Firefox 3.5 and above
(Works without installed Gnome libraries)
Type about:config into the Location Bar (address bar) and press Enter.
Right-click -> New -> Boolean -> Name: network.protocol-handler.expose.foo -> Value -> false (Replace foo with the protocol you're specifying)
Next time you click a link of protocol-type foo you will be asked which application to open it with.

Issue with opening sqlite database file

I am trying to make use of sqlite for the first time, now I have used this :
$this->linkIdentifier = new SQLiteDatabase($database);
and it created a database just fine as website.sqlite opening it again doesn't give any problem but as soon as I use http://code.google.com/p/phpliteadmin/ to create a table and I try to open it again it gives me this error : file is encrypted or is not a database
What could be causing this ?
Just for clarification: There are SQLite database-files of version 2 and version 3. With "new SQLiteDatabase()", you create a db-file of version 2. With "new SQLite3()" you create a file of version 3.
PhpLiteAdmin has support for both versions if the appropriate php extension is installed. PhpLiteAdmin tells you the extension being used when you open the "structure" tab of the database under "SQLite extension". It should say "SQLiteDatabase" there if you open a version 2 database. If it does not, e.g. because this extension is not installed, you might not be able to edit a version 2 database in phpLiteAdmin.
The SQLiteDatabase extension might not be included in recent versions of PHP, e.g. in PHP 5.4, it is only available via PECL.
I suggest to use PHP's own SQLite3 functions to create and save a database. Make sure to set the SQLITE3_OPEN_CREATE flag.

Problems opening php files in Eclipse

I've just set up PDT in eclipse (Galileo), but get the error below when opening any .php file.
Does anyone know how I can fix this?
Thanks in advance
TAO.
PHP FILE:
<?php
echo "test"
?>
ERROR:
Could not open the editor: Editor could not be initialized.
Details:
java.lang.AbstractMethodError: org.eclipse.php.internal.core.compiler.ast.parser.PHPSourceParserFactory.parse(Lorg/eclipse/dltk/compiler/env/IModuleSource;Lorg/eclipse/dltk/compiler/problem/IProblemReporter;)Lorg/eclipse/dltk/ast/parser/IModuleDeclaration;
at org.eclipse.dltk.core.SourceParserUtil.parse(SourceParserUtil.java:137)
at org.eclipse.dltk.core.SourceParserUtil.getModuleDeclaration(SourceParserUtil.java:197)
at org.eclipse.dltk.core.SourceParserUtil.getModuleDeclaration(SourceParserUtil.java:183)
at org.eclipse.dltk.core.SourceParserUtil.getModuleDeclaration(SourceParserUtil.java:174)
at org.eclipse.dltk.core.AbstractSourceElementParser.parse(AbstractSourceElementParser.java:42)
at org.eclipse.dltk.core.AbstractSourceElementParser.parseSourceModule(AbstractSourceElementParser.java:26)
at org.eclipse.dltk.internal.core.AbstractSourceModule.buildStructure(AbstractSourceModule.java:507)
at org.eclipse.dltk.internal.core.Openable.generateInfos(Openable.java:185)
at org.eclipse.dltk.internal.core.ModelElement.openWhenClosed(ModelElement.java:182)
at org.eclipse.dltk.internal.core.BecomeWorkingCopyOperation.executeOperation(BecomeWorkingCopyOperation.java:45)
at org.eclipse.dltk.internal.core.ModelOperation.run(ModelOperation.java:698)
at org.eclipse.dltk.internal.core.ModelOperation.runOperation(ModelOperation.java:764)
at org.eclipse.dltk.internal.core.SourceModule.becomeWorkingCopy(SourceModule.java:68)
at org.eclipse.dltk.internal.ui.editor.SourceModuleDocumentProvider.createFileInfo(SourceModuleDocumentProvider.java:1251)
at org.eclipse.ui.editors.text.TextFileDocumentProvider.connect(TextFileDocumentProvider.java:478)
at org.eclipse.dltk.internal.ui.editor.SourceModuleDocumentProvider.connect(SourceModuleDocumentProvider.java:1484)
at org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput(AbstractTextEditor.java:4134)
at org.eclipse.ui.texteditor.StatusTextEditor.doSetInput(StatusTextEditor.java:203)
at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.doSetInput(AbstractDecoratedTextEditor.java:1413)
at org.eclipse.ui.editors.text.TextEditor.doSetInput(TextEditor.java:166)
at org.eclipse.wst.sse.ui.StructuredTextEditor.doSetInput(StructuredTextEditor.java:1712)
at org.eclipse.php.internal.ui.editor.PHPStructuredEditor.doSetInput(PHPStructuredEditor.java:2208)
at org.eclipse.ui.texteditor.AbstractTextEditor$19.run(AbstractTextEditor.java:3115)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:759)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:756)
at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2579)
at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java:3133)
at org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTextEditor.java:3160)
at org.eclipse.wst.sse.ui.StructuredTextEditor.init(StructuredTextEditor.java:2321)
at org.eclipse.php.internal.ui.editor.PHPStructuredEditor.init(PHPStructuredEditor.java:1151)
at org.eclipse.ui.internal.EditorManager.createSite(EditorManager.java:798)
at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:644)
at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:462)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1256)
at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1209)
at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1608)
at org.eclipse.ui.internal.PartStack.add(PartStack.java:499)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103)
at org.eclipse.ui.internal.PartStack.add(PartStack.java:485)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112)
at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:63)
at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:225)
at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:213)
at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:778)
at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:677)
at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:638)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2854)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2762)
at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2754)
at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2705)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2701)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2685)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2676)
at org.eclipse.dltk.internal.ui.editor.EditorUtility.openInEditor(EditorUtility.java:405)
at org.eclipse.dltk.internal.ui.editor.EditorUtility.openInEditor(EditorUtility.java:166)
at org.eclipse.dltk.internal.ui.actions.OpenActionUtil.open(OpenActionUtil.java:45)
at org.eclipse.dltk.ui.actions.OpenAction.run(OpenAction.java:259)
at org.eclipse.dltk.ui.actions.OpenAction.run(OpenAction.java:240)
at org.eclipse.dltk.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:259)
at org.eclipse.dltk.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:235)
at org.eclipse.dltk.internal.ui.scriptview.ScriptExplorerActionGroup.handleOpen(ScriptExplorerActionGroup.java:304)
at org.eclipse.php.internal.ui.explorer.PHPExplorerActionGroup.handleOpen(PHPExplorerActionGroup.java:103)
at org.eclipse.dltk.internal.ui.scriptview.ScriptExplorerPart$4.open(ScriptExplorerPart.java:667)
at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:842)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.runtime.Platform.run(Platform.java:888)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:840)
at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1101)
at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1205)
at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:264)
at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:258)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:298)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3880)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3473)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
I've had the same problem too when upgrading DLTK to 2.0 M5.
Switching back to M4 seems to have solved the problem for me:
Download the DLTK 2.0 M4 plugin archive:
http://download.eclipse.org/technology/dltk/downloads/drops/R2.0/S-2.0M4-200912141114/
(Core Frameworks line)
Extract the zip archive
Locate your eclipse plugin directory (on my Ubuntu, in /.eclipse/org.eclipse.platform_3.5.0_155965261/plugins).
Make sure eclipse is closed. Erase or rename the faulty jar file:
$ mv org.eclipse.dltk.core_2.0.0.v20100212-1450.jar org.eclipse.dltk.core_2.0.0.v20100212-1450.jar.bak
copy org.eclipse.dltk.core_2.0.0.v20100201-1709.jar from the archive version to your plugin directory.
rename the copied file to the M5 version one:
$ mv org.eclipse.dltk.core_2.0.0.v20100201-1709.jar org.eclipse.dltk.core_2.0.0.v20100212-1450.jar
Hope it helps.
For those of you coming to this older post, I just wanted to let you know that there is another option that brings the PHP intelligence of VS Code to Eclipse Neon and later. It's a plug-in called CodeMix and provides support for PHP in addition to many other dynamic languages through the many available extensions. You can find out more about it on the CodeMix page, or install it into Eclipse directly from the Eclipse marketplace.
Sadly, following the latest updates to the DLTK, Benoit's recipe no longer works for me. However, downloading the nightly build of PDT did. Here's what you do:
Download the nightly PDP build: N201003021518/pdt-Update-N201003021518.zip
(by the time you follow this recipe, the latest stable build might have moved on, so check under https://build.eclipse.org/hudson/view/Athena%20CBI/job/cbi-pdt-2.2-helios/lastStableBuild/ - expand the "Build Artifacts" link until you find the zip file.)
Create a local update site:
mkdir /tmp/eclipse
cd /tmp/eclipse_pdt
unzip ~/Downloads/pdt-Update-N201003021518.zip
In Eclipse, select Help -> Install New Software -> Work With: Add -> Local… -> /tmp/eclipse_pdt
(Click OK and give it a name such as "PDT Nightly Build")
In the main window, select the features you want to install (I selected all but PDT Mylyn Feature)
Next
Finish
When asked whether to accept “unsigned” content, say OK. Restart Eclipse when prompted.
I had the same problem. I started of by downloading "Eclipse Classic 3.5.2", deciding it was time to bid farewell to 3.3. The first plugin I installed was the PDT 2.1, which left me wading through a series of errors, including:
"Editor could not be initialized"
"Semantic Highlighting Job"
"Processing Dirty Regions"
Benoit's jar fix sorted out the editer initilisation problem, but I was still left hunting for fixes for the other errors. In the end I decided to back out the upgrade by simply deleting the 3.5.2 folder (thank you Eclipse developers for not filling my registry with junk), and downloaded the "Eclipse for PHP Developers" package, as it includes PDT. So far everything appears to be working.

Categories