My Blog

contains PHP and other web related content. (Sometimes there are some off topic things - don't freak out!)

Posts Tagged ‘Eclipse PDT’

Exploring MySQL in Eclipse PDT

Monday, February 15th, 2010

As you probably know by now, I’m a huge fan of Eclipse PDT. Well, I wanted to stop using MySQL GUI tools for a bit and explore Eclipse tools.

Get the SQL Explorer Plugin


The first thing to do is to get the Eclipse SQL Explorer plugin. You can get that at the update URL:
http://eclipsesql.sourceforge.net/

Install this software like you normally would. Accept the license and you’re ready to go with the plugin. I would recommend letting Eclipse restart after the installation.

Eclipse Uses JDBC

Eclipse uses JDBC connections to connect to MySQL. You can get this on the MySQL connectors page:
Connector

Simply unzip the connector into your Eclipse program directory and move on.

Open Eclipse

Next, Open eclipse (if its not already open.) First step is to choose the SQL Explorer perspective. This can be done by going to the Window menu, clicking Open Perspective and choosing Other. Then, select the perspective from the list.

Now, create a connection profile. This is done by clicking on the Create New Connection Profile link. From here, name your connection, choose your adapter and fill in the proper credentials. (If you’re not familiar with this style credentials, you can visit this website: http://www.connectionstrings.com

What if I can’t find my Driver in the list?

There is a good chance that the driver may not be in the list by default.
Follow the following steps.

1) On the connection profile screen, click the ‘Add/Edit’ button
2) Select the MysQL driver in the list.
3) Click the Edit button on the right hand side.
4) If you do not see your driver in the list of Java Class Paths, click on the Extra Class Path tab.
5) Browse to find your most recent driver download and select that jar file.
6) Click on the list drivers button. com.mysql.jdbc.Driver should appear in the Driver Class Name box. If not, select it.
7) Click OK and then OK again to return to the connection profile box

Now you should be able to use the MySQL driver from the list.

Browsing the Database

After configuring the connection profile, you should see it in your list of connections. Once you expand it and double click the user, you will be prompted to enter your password (as well as choose some other connection profile options).

From here, you’re good to go! You can browse the databases in the Database Structure tab, you can edit SQL in the SQL Editor tab, etc.

Eclipse PDT2 won’t jump to functions/classes on ctrl-click: solved

Wednesday, April 1st, 2009

I am using the new PDT2 based off of Eclipse 3.4. The one thing I noticed as an issue for me was the building. I created a project based off of a checkout using SVN. After I had built the PHP project, I could not ctrl-click any of the functions that were part of my project. It just wouldn’t find them.

The solution for me was to configure the build path to include the project itself.

1. Right click on open project.
2. highlight build path
3. click on Configure build path…
4. Click Add Folder… button.
5. Put a check mark next to your project.
6. Click OK.

If necessary, click the project menu and choose the ‘clean…’ option to rebuild.

Eclipse PDT: Integrating Apache Bench for load testing

Friday, January 23rd, 2009

When I use an IDE, I expect for it to do everything I need for my project, from start to finish. As you may have read in earlier entries, I enjoy using Eclipse PDT. I think its time to include load testing into my arsenal of tools inside of eclipse. I’m going to focus on apache’s AB for this article.

(more…)

Eclipse PDT – Include Paths

Sunday, December 28th, 2008

When troubleshooting a different problem the other day, I re-entered the world of eclipse include paths. For those of you who are not familiar, the eclipse include path is located as the last option of a eclipse PDT PHP project.

What is the Include Paths option used for?

While it wasn’t so clear to me, trial and error seemed to be my friend. It turns out, most of my PHP projects that I built, all of my files were already included inside of the project, so I never had to use this option. However, when using other external system level libraries, like PEAR or Cake, you may not build your project with these directories included. However, your code may still use parts of these libraries. In order to provide proper auto completion and error checking, you can add these external libraries to the include paths option.

What the Include Paths option is NOT

This is not a direct replacement for your include path in your php.ini. Remember, when writing and testing code, make sure to use the same version of PHP – as well as the near exact same php.ini file – as you do on production. The Include Paths option is just used to make sure that auto completion and in IDE debugging (not to be confused with XDebug type debugging) works correctly. You may even want to change your default php binary to your normal php binary if the one that came with the PDT install is not your exact configuration.

So, how does this thing work?

First, create your project. Next, right click on the Include Paths option and choose “Configure Include Path”.
You will see two options, Add Variable… and Add External Folder…

Add Variable…

The add variable option allows you to add PHP path variables in. You can configure this with the Window -> Preferences method – or just click the Configure Variables button at the bottom of the Add Variable option screen. For example, if you do a lot of PEAR programming, you might have a variable for PEAR available here.

Add External Folder…

This options is nice for third party php libraries that you may have on another drive or you might be accessing remotely. For example, I’ve mapped my E: drive on windows to an OpenID library that I use. Sometimes I need to include this with my projects when I’m using this third party tool.

Do I really need these?

Like I said, for the longest time, I never used the include paths. But, I started using more third party libraries and not wanting to include them in my main repository – and then this tool became useful. Try it out – and see if its useful for you.

Useful Eclipse Plugin: Find a file name in project immediately

Monday, September 1st, 2008

Unfortunately, at #superdev, there are times when the include_path in PHP is calculated. It is not always clear where to find a file. Other times there are just too many places to find the file. Because of this – and Eclipse PDT’s inability to find a file from an include or include_once statement when you ctrl click it, I needed to find a tool to find files fast.

Don’t be Lazy – use ‘Teh Google’

So for the longest time, I would determine what classes or functions were being used from the included file, and then do a search of the code base for “function functionName()” because I knew it would find that file … eventually.

Well, turns out, there is a better way.

Goto File Eclipse Plugin

I found this great plugin for eclipse: GotoFile @ muermann.org. I wish I had thought that this could be done – and searched earlier! heh. Turns out this plugin adds a new menu to your search menu by which you can launch the dialog window. Then, just start typing the name of the file and it live searches for you. When you finally find it, just double click it – and it’ll open up the file it found in your project. It appears to work for any file in your project – which is amazing. For more features and details, check out hte GotoFile Eclipse Plugin Home Page.

Using Eclipse PDT? Check out this wiki

Saturday, August 23rd, 2008

Are you a huge fan of Eclipse PDT (as I apparently am)?

You need to check out this Eclipse PDT Wiki. So far, a lot of cool articles. Watch for it to grow in the future!

XDebug and Eclipse PDT on Windows – From Start to Finish

Tuesday, May 20th, 2008

XDebug and Eclipse PDT on Windows – From Start to Finish

With our recent upgrade to php at “the triangle,” I felt it was time to start working on using a debugging and code profiling tool. When I say felt like it was time… I meant our PHP version finally supported it. *sigh*. Anyway, from start to finish, this is what I did in order to get Xdebug to integrate into my current eclipse PDT – as well as investigate the other features of xdebug. I tried to detail all of the mistakes I made as well as what I figured out. Let’s go:

(more…)

Eclipse Testing with TPTP – help me?

Monday, December 10th, 2007

I recently came across this tutorial here about Testing with TPTP- and I’m confused. Whats the benefit of this type of testing (um… creating JAVA code for a JUnit test… right?) compared to running some PHPUnit, Selenium and AB (from apache, or something…)? What am I missing – does anyone have any other good hands-on tutorials?

Master the ‘Run As’ option in Eclipse PDT with PHP

Saturday, July 21st, 2007

Most of my development in Eclipse PDT with the results tested outside of it – using firefox. PDT has a few options in the Run… menu:

  • PHP Script
  • PHP Webpage
  • Web Browser

So, lets take some time to look into how each one of these works, what are their configurations and what could be the benefit of using one above the other.

(more…)

Live Combined Error Reporting for Apache and PHP during Development

Friday, July 20th, 2007

So many times during development, I’ve missed little PHP errors because they were 1) on a processing page that was redirected or 2) output inside of a html tag – and rendered invisible. From time to time, I have to go back to my file system and check the php error log to see what happened. The first step to solving this was implimenting a custom error handler – which we did at (“the triangle”). But I’m torn on this: should the error handler script function the exact same during development as it does in production, or should we write two different error handlers. To keep the code as simple as possible and allow for scenario regeneration, I opted to have the error handler work the exact same way in development. Some might disagree, but thats not the point here. The issue was that I needed to watch the error log closer (I’m notoriously bad at not checking errors – see my previous post about error reporting…).

Another thing I knew would be nice to see would be the apache error log. As I’m not combining my error logs with php, I don’t often check the apache one. However, local mistakes can cause errors on the production server too.

Luckily, I was able to find a utility that made life easier – and of course – integrates into eclipse. Lets configure:

(more…)

  • twitter loader

Follow me on twitter: @aaronsaray

The views on this website are my own and do not reflect the opinions of my employer or clients.
Creative Commons License Home | Open Source | Book | Music | Art | Bio | Resume | Contact
My Baby