Texas Tech University



Setting up MySQL,SSH, and the database settup in MyEclipseDisclaimer – This was done on a Widnows 7 machine, so there may be slight differences. Also, I am assuming you have already installed and have a basic idea of how to use MyEclipse. Some of this may seem basic, but I didn’t want to leave any grey areas1 – If you haven’t already, download the zip file containing the examples used in class - – Unzip the files. I suggest creating a folder to hold the extracted files, as well as the other files you will download in these instructions, to make them all easier to find3 – Now download the MySQL Installer here (you’ll need to know if you have a 32 bit or 64 bit OS and select the appropriate download from the two I have circled) - – Start the MySQL installer you downloaded in the previous step. I will just post screen shots of each of the install screens if you don’t remember which options to select, with captions where needed.-I did not get this both times I installed it, but it is just extraneous stuff that you can get if you want. To continue with the actual install, hit the “x” to close this and you’ll get the following:You may get a browser pop up to register the software which you can do if you like, but you will eventually get to the actual configuration wizard:- If you think you may have more than 20 simultaneous connections to your databases(s), you may want to select OLTP or manually set the concurrent connections- Here you need to be sure to select the second option which is un-checked by default. Also, Dr John suggests you uncheck “Launch the MySQL Server automatically” option, due to potential performance issues. If you do, you will need to manually start the MySQL server. - To start the service in Windows 7, go to the start menu and type services.msc in the search bar at the bottom, and hit enter to bring up the services menu. Then find MySQL from the list, right click on it, and select start. You’ll need to do this every time you turn your computer off, or manually stop the MySQl service-default username will be “root”MySQL is installed and ready (remember to start it from the services menu if necessary)5 – Next you will also need to download MySQL Connector/J to get the necessary jar file we will use later - the zip archive (second option in this screen shot), not the compressed TAR, unless you have Unix OS6 – Extract the MySQL Connector/J files wherever you like. The only thing we will need from those files is the mysql-connector-java-5.1.12-bin jar, but you might as well keep the rest. You may need it, for instance, if you have errors connected to this jar in MyEclipse. You will need to show MyEclipse where that folder is located if you want to see source code connected to the errors in the error console (don’t worry if you don’t understand exactly what I mean by that, I am just saying it is best to keep all the files).7 – Now test to be sure you can login to MySQL. Open a command prompt, and type ”mysql –p –u root” If you selected a username other than root you will need to use that. It will then ask for your password, which you entered during the MySQl configuration Wizard. If you are successful, you will see the following:If you cannot get in, first make sure the MySQL service is running as explained earlier. Other than that, your guess is as good as mine. Leave that command prompt open where it is for now.8 – Now you need to create the database “Books” that we were seeing in class. There are different ways to create new databases or import existing ones. For this, you need to open the class example files from step 1 and go to the following directory - \JavaHTP7e_examples\ch25\fig25_23 Use notepad to open the books.sql file9 – Copy all of the text from the word pad opened in the previous step, and copy it into the Command Prompt you have open, then hit enter, which will create the database and all the tables. This will get you caught up to what we did in class, but you will need to know how to do this for other databases Dr John uses in class.After you copy and paste the text and it executes, you will see the following (broken into two images)10 – Now to work with everything in MyEclipse, so go ahead and open MyEclipse. For now stay in the java perspective. The first thing to do (if you haven’t already) is to import the class examples file system so you can open them like Dr John does in class. To do this, right click in the Package Explorer and select New -> Java Project. Call it whatever you like (I called mine ClassExamples). Hopefully you know this by this point, but here is what you need to make the settings look like:Hit finish11 – The project you just created will appear in the package explorer on the left. Right click on the project, and select Import…From the next window select File System (should be the third option under the general folder). You will then need to browse to the extracted class example folder from step 1. I just put all the example files in this one project. Be sure to select the check box in the left column or you will not be able to hit finish. Hit finish when it is ready.12 – Now the project you created will contain whatever examples you put in it. Browse to the following and open DisplayAuthors.java: 13 – In DisplayAuthors.java, go to line 31 and find the following line of code:DriverManager.getConnection( DATABASE_URL, "jhtp7", "jhtp7" );Replace the first jhtp7 with the username you created during MySQl configuration (probably “root”), and replace the second jhtp7 with the password you created. This will need to be done for every java file that uses these usernames and passwords. Alternatively, you can create a MySQL user with username and password of “jhtp7”. I don’t cover that here though.Now we can move on to the actual database stuff.14 – Now that the books database exists and we edited the java file we can work with it in MyEclipse. You need to pen the Database Explorer perspective for this, so choose the “MyEclipse Database Explorer” perspective like so:15 – Right click in the DB Browser pane and select “New”16 – Fill everything out like this (put whatever you want for the Driver Name text box. It is basically asking what you want to name the project):17 – In this same window, we now need to add the jar we downloaded in step 5. So you need to click “Add Jar” and browse to the extracted Connector/J files, and open the mysql-connector-java-5.1.12-bin jar. Once you do you will no longer have build errors and it should look like this:Hit “Test Driver” to make sure everything is correct. Hopefully you will see:18 – Hit “OK” and then “Finish” to complete the project. The project will now appear in the DB Browser on the left side. Right click on it and hit “Open Connection”. You may be asked to enter your password one more time. Hit save password if you like so you won’t need to do this every time. 19 – Now the Project will populate with the data, and you can expand/collapse it to see everything. The last thing we covered was creating the ER Diagram. To do this, just right click on the following, and select “New ER Diagram”You then need to browse to the folder containing the files we have been working with and hit OK:When you get to this screen, hit “Add All” to move everything from the left column to the right column and hit finish.You should see: That is about it for MySQL and setting it up in Eclipse. If you need help getting zeus and ssh setup read on…20 – First you will need to download an ssh client. Putty is a good one (you may want to do this install from internet explorer to avoid some potential install issues) - easiest install is to use the installer:21 – The putty install is basic, so I won’t cover that step by step. Once you have it installed, open the Putty SSH client. You will get the following screen, so just enter the ip address and hit Open:You will get a security warning that you can just hit Yes on. If you hit No it will still open the connection, but it will not save it.It will first ask for your username, which for me was just my last name. Then it will ask for your password which for me was my four digit number + sean. Example: username – lastnamepassword – 1234seanThat is all we have covered concerning this so far. That should pretty much get you to where you need to be by Tuesday ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download