Eclipse, Tomcat and MySQL for Java Web Development
I am currently working on a web development project for school. Eclipse is pretty much a given. Tomcat is required by the guidelines and I decided to go with the MySQL as my database server. I took the instructions from this page. But here is my “Pro-Version” synopsis for savvy people who just want to get going. My system is a Windows 7 64-bit but this should be valid just about anywhere because these are platform independent bundles.
- Install the latest JDK if you haven’t already. (I am working of 7u5)
- Install Tomcat. You can lay it down anywhere, it’s just an unpack. (I use 7)
- Install Eclipse. It’s also an unpack. Unless you’re not doing Java at all (and here you are) there is no reason not to go for the JavaEE version which contains just about everything. (I use the Juno version)
- Make sure Eclipse knows where you’ve put your jdk. (If it’s not automatic, I’m sure you can figure it out by yourself)
- Install MySQL Community Edition (I have 5.5.27). Check in as new user and then select to skip the process. The installation itself is pretty straight forward. You’ll most likely want the developer install. And don’t forget to grab the connector/j library (Mine is 5.1.21) as well.
- Put connector/j library in a place you can find it. Like in the Java main directory or with your project.
- Go into your MySQL command prompt and create a new database (“create database something;”).
- Go back to Eclipse and open the Data Source Explorer view.
- Right click on Database Connections and select new.
- Select MySQL and rename it to whatever you want. This is the name of the connection you will have listed.
- In the open window you will see practically nothing. Click the New Driver Definition.
- Select the latest JDBC driver.
- Click the JAR list tab and clear everything there. Add the connector/j jar.
- Head over to the Properties tab. In the connection URL, make sure you write your database name as you created it. The Database Name field is for display purposes. Also make sure the user and password fields are correct to match your installation. Then hit OK.
- Now your empty window from before should actually display something. To make sure everything is as it should, cllick Test Connection.
- If everything worked, you should get a ping succeeded message. If not, go back and see what you did wrong. It could be that you didn’t start your MySQL server at all after you installed it. Who knows.
- But if it worked, your database connection and database should be displayed on the list.
Posted in High-Tech, School by Eran with comments disabled.