I love PHPStorm as my IDE of choice — this replaced my Zend CE IDE last year following the PHP-Conference in Santa Clara which I was fortunate enough to be able to attend. Yesterday, I discovered add-ons, or in the PHPStorm nomenclature, Plug-ins. Plug-ins are programs which integrate into the IDE with the intent and purpose of making your life a lot easier.
Initially, what caught my eye was a plug-in called “CSS-X-Fire” which integrates the Firebug CSS editor into the IDE with CSS capabilities. Since I’ve been debugging my fair share of CSS lately, I thought this would be a pretty cool tool to have at my disposal. Let’s see what else they have…
*gasp* SO MUCH COOL STUFF! *gasp*
I installed the BASH shell next just for fun which not only gives me a shell within my IDE, but also provides BASH syntax highlighting. And, yes, my work-site I support has a lot of BASH utility scripts, so cool.
Next, I see a gem called Database Navigator written by Mr. Dan Cioca. This plug-in gives you access to your MySQL environment, through the IDE.
In other words, you no longer need an additional app (such as PHPMyAdmin, or Navicat, or whatever) open on your desktop because you can access the same functionality from within the IDE, including a pretty damn cool mysql> console!
The tricky part, I learned, is that if you’re developing on a Mac environment, then you need to install the ODBC Connector/J JDBC driver for MySQL. As of this writing, the latest release is 5.1.16. Once you download and extract the contents, you’re going to be most-interested in a file named: mysql-connector-java-5.1.16-bin.jar. You can place this file anywhere — being lazy, I left it in my downloads directory…lol…
Once you’ve downloaded and installed the DBNavigator plugin, you’re going to re-start PHPStorm. When you do, you will see a new menu item called DB Navigator. You should also see a new window on the left-side of the IDE that shares space with your file-system/project-files window. Clicking on “Settings” under the DB Navigator menu and pull up the configuration dialog. In order for DB Navigator to connect to any database, you have to configure that connection. DB Navigator uses the Connector/J driver to accomplish this.
Above, is a screenie from my configuration. Once you’ve entered the Driver Library information, you’ll be able to select the jdbc driver from the drop-down. Add your account user-name and password, and test the connection. You should be good-to-go at this stage!
Using the DB Navigator within PHPStorm’s IDE is simple. Just open the DB Browser window and start clicking. The browser allows you to, well, browse all you content. To access content, say you’re working on a particularly devilish query and you want to run some test, just open the mysql console by clicking on DB Navigator menu (at the top) and then clicking on mysql console. You’ll be prompted to select a db. After doing so, a new window will open, as a text-edit window in the IDE.
Enter your query. One thing to note, you have to prepend the db name to the table name in the form of db_name.table_name — something you wouldn’t normally have to to do (but probably should) when using other tools. Click the “Play” button to have the results of your query displayed to the bottom window which will open. And that’s pretty much it!