Eclipse Tips
If you want to share your tips about using Eclipse, please email them to me at csun@calstatela.edu.
Using Eclipse as a database client
Open a SQL file in Eclipse. Right click and select "Use Database
Connection..." -> "Create a new connection" -> "Next". In the
next screen you'll need to provide the information about your database,
and here's mine using PostgreSQL 8.2:
- Connection Identification: check "Use default naming convention"
- Database Manager: Generic JDBC 1.0 (since PostgreSQL is not listed there)
- User ID: cysun
- Password: abcd
- JDBC Driver: Other
- Database: CS520 Database on Localhost
- JDBC Driver Class: org.postgresql.Driver
- Class location: D:\Program Files\PostgreSQL\8.2\jdbc\postgresql-8.2-504.jdbc3.jar
- Connection URL: jdbc:postgresql://localhost:5432/csns
Click "Next" then "Finish".
Now that a database connection is configured, next time when you try
to run a SQL script, simply open it, right click and select "Run SQL".
Run Ant Script within Eclipse
Suppose we have a build file in our project, e.g. build.xml, which contains a target called hello. We can of course run this target by going to the command line and type: ant hello. We can also run this target inside Eclipse as follows:
- Choose "External Tools ..." from the drop-down menu of the
"External Tools" button on the toolbar. The button looks like a green
play button with a red suitcase.
- On the left panel of the window, choose "Ant Build", then click
the "New" button at the upper-left corner of the panel. The button
looks like a white sheet of paper with a plus sign.
- On the right panel of the window, change the name of the configuration to something descriptive. I usually use <project_name> <target_name>, e.g. spring-examples hello.
- Also on the right panel, choose the "Targets" tab, and select the target(s) you want to run.
- Click on the "Run" button at the buttom of the window.
Note that after you run the target once, next time if you want to run
it, you can simple select it from the drop-down menu of the "External
Tools" button on the toolbar.