JDBC Plugins for Eclipse

I was previously using DbVisualizer to query and update my Oracle databases and was not completely satisfied with it. I actually prefer PhpMyAdmin but that only works with MySQL.

Since I use Eclipse so much for development I decided to look for a JDBC plugin that is at least as good as DbVisualizer. My goal is to have in one workspace access to my database as well as my source and configuration files.

I went to EclipsePlugins and downloaded the three highest rated JDBC plugins, all which happen to be free (in some cases just for non-commercial use).

  1. DBEdit
  2. QuantumDB
  3. SQLExplorer

I installed DBEdit 1.0.3_1, Quantum DB 3.0.1 (which requires GEF, I installed 3.1.1), SQLExplorer 2.2.4.

Setup was quite simple with DBEdit, just add the JDBC driver to the CLASSPATH, give it the JDBC URL and connect. Setup was almost as simple with Quantum DB though it asks you for the components of the JDBC URL instead of the URL directly. I couldn’t figure out how to setup SQLExplorer within five minutes so I gave up.

DBEdit and Quantum DB have similar interfaces and both are similar to DbVisualizer though Quantum DB’s appealed to me a little more. However Quantum DB’s interface responded much more quickly and querying of tables was much faster. DBEdit has a nice feature, which I did not completely test, of inline editing of cell values which seems quite powerful.

Because of Quantum DB’s speed and responsiveness I am going to continue to use that as my primary JDBC plugin but I will also keep DBEdit on the side to use for its inline editing but also in case I find Quantum DB does something in an unintuitive manner.

Update: Since I posted this less than a month ago I found DBEdit much more useful than Quantum DB. It’s inline editing, inserting feature, and other editing features really make it powerful. Also its filter, scrolling through result sets, etc. are great. I highly recommend DBEdit.

Share

HOWTO: Disable Windows Error Reporting?

Occasionally you will see a window popup like this one.

windows error reporting

This happens when a program error or a system error occurs. Windows prompts you to send an error report, theoretically so that Microsoft can use the information to make Windows more robust.

Personally I don’t trust Microsoft so I wanted to turn this off. Fortunately Microsoft provides a way as outlined in this article.

Share

mysqlimport

MySQL provides a utility for importing text files into a database called mysqlimport. It has some nice features including:

  1. If you don’t include the ID in the data of the text file and your table is set up to auto-increment the ID then it will create the ID for you when importing the data.
  2. It recognizes different delimiters for the data, the common delimiters being tabs and commas.
  3. It will delete previous data.

An example of how to use it is:
mysqlimport --user=admin --password=admin --local --delete --verbose -c name,pos,age,b,tm,rel,dl,ab,r,h,d,t,hr,rbi,bb,k,sb,cs,'$$' --fields -terminated-by='\t' roto batters.txt

Note how in this example that the tab delimiter is specified by ‘\t’. Also special column names must be enclosed within quotes like ‘$$’. And finally the name of the text file you are using must be the same as the name of the table in which you are importing.

One frustrating thing about mysqlimport is that if there are warnings or errors during import it does not actually tell you what the errors are. mysqlimport does not have a problem with no data being present where it expects there to be some, for example in a comma delimited file if it sees ,, it just assumes that column should be blank or 0, depending on the data type.

However mysqlimport will count as a warning if it sees more data fields then you specified in the number of columns. This could happen because you forgot to specify a column or it could happen because your data has empty spaces at the end of the line.

To debug these warnings or errors what I do is import smaller sets of the data at a time to try to discover what is causing the problem. Usually the same pattern is causing the warning so once you discover what is the problem you can eliminate it from throughout the text file.

Share

WordPress Contact E-Mail Form

Naively, I put up email addresses for sales, information, and site feedback on the Contact Us page. The spam robots discovered these email addresses and have begun to spam me.

Fortunately there is a WordPress plugin, PXS Mail Form, for email forms that seems quite mature and even protects against exploits. You can see how it is used on this page.

I made only one change to this plugin that allows you to set the subject of the email form using a GET request. Previously you could only do this using a POST request.

***************
*** 58,69 ****
              } else {
              $show_subject = 1;
              $subject = '';
!             if (empty($_POST['your_subject'])) {
              $subject = get_option('pxs_subject');
              $subject = stripslashes($subject);
              $subject_mm = '';
              } else {
!             $subject = $_POST['your_subject'];
              $subject = stripslashes($subject);
              $subject_mm =  ': '.$subject;
              }
--- 58,69 ----
              } else {
              $show_subject = 1;
              $subject = '';
!             if (empty($_REQUEST['your_subject'])) {
              $subject = get_option('pxs_subject');
              $subject = stripslashes($subject);
              $subject_mm = '';
              } else {
!             $subject = $_REQUEST['your_subject'];
              $subject = stripslashes($subject);
              $subject_mm =  ': '.$subject;
              }
Share

Hibernation: Insufficient System Resources Exist to Complete the API

pianoOccasionally when I try to hibernate I receive an “Insufficient System Resources Exist to Complete the API” error message. When this happens I am forced to shutdown instead of hibernate.

This is a known issue for computers with 1 GB of RAM or more. Microsoft has a KB article about this. To obtain the hotfix Microsoft requires you go through Microsoft support which is a big pain so I have made it available here .

Share