Eclipse, Run Configurations
In our last episode, I managed to connect to the database. Now what I want to do is extract data from the database and write it out as standalone XML files, one XML file per item.
I’m not going to go through every step of the process since I’m not really writing a tutorial here, just covering the stuff I’m doing so I’ve got a log of any problems I run into, so I can refer to this the next time. Getting started doing Java development in Eclipse is something that’s generally covered pretty well elsewhere.
One difference between Eclipse and Visual Studio took a little figuring out is that with Visual Studio, you say Start and it starts the active project, where Eclipse doesn’t have an active project concept. You can say Run last launched, or you can select a configuration to run. If you’ve not run your app yet, then you need to create a configuration before you can run it (by selecting Run…, clicking Java Application in the list, clicking New, and picking the class to start).
Where this is an improvement over Visual Studio is when you’re running the same binary in multiple contexts. The most obvious place where you’d do this is unit testing – you can create a run configuration for Java Application, one for JUnit, and run either one without needing to change any settings.
Anyway this example was easy to modify into something I could use to read the cs_Posts table out of Community Server. The only changes were to the connection string, driver class name, and the SQL query text.
Next step: Writing the records out as XML.