Eclipse, Database Explorer

database explorer

Installing the Web Standard Tools update worked, and gave me the Database Explorer pane.

I downloaded the JDBC driver for SQL Server 2000 and then got to the dialog in Eclipse where I need to configure it.

Eclipse tries hard to provide defaults for things in most places, but here it fails.  I’m asked to provide the name of the JDBC driver class, and the connection URL.  I figure out the class name by unzipping the JDBC driver jar file and guessing at what looks like the class (com.microsoft.jdbc.sqlserver.SQLServerDriver) and guessing at what the Connection URL looks like ().

The Connection URL is a funny field since I have no idea what to put here, but the fairly long and involved string is shown at the top for me to copy.  But as soon as I type a character into the text field, the example string disappears.  Doh!  So I type out the string in Notepad and paste it into the Connection URL field.

Given my best guesses at what to type for the Connection URL (jdbc:sqlserver://servername), all I get is:

java.lang.reflect.InvocationTargetException; com/microsoft/jdbc/base/BaseDriver

Hmm.

My next attempt at a connection string was:

jdbc:microsoft:sqlserver://titan:1433

Pressing the Test Connection button doesn’t show anything at all now, but in the Error Log (which I fortunately had visible in the background), I can see ‘Unhandled event loop exception’ and ‘java.lang.IllegalArgumentException’.  It’s not trying very hard to make this easy for me.

Wow. After spending about a half hour trying variants of the connection string and other parameters, I give up and decide I’m going to restart Eclipse.  Click the ‘Finish’ button, and same message.  Unhandled event loop exception.  I guess the problem wasn’t necessarily with the database, but rather with the Eclipse UI.

Restart Eclipse, go back in to add a New Connection, enter the following URL:

jdbc:microsoft:sqlserver://titan:1433;ServerName=<servername>;
User=<username>;Password=<password>;DatabaseName=CommunityServer

And it worked first time.

That’s it for now.. I have the JDBC driver installed, I have the ability to connect to it and browse my tables, and I have a URL that I expect I can use in my own Java code to connect.  And I learned that rebooting Eclipse when things don’t seem to be working can fix things.