 There should be a PostgreSQL JDBC4 jar file which is the JDBC driver for PostgreSQL that should be present. So all you have to do is copy the file right click and say copy and then go to eclipse. So in eclipse we have a project which we had created yesterday. So if you expand that project you will find a web content directory within that, expand it and you have a webinf and there is a lib directory inside. So right click on that lib directory and paste the jar file that we just copied. So once you paste it you can see that the jar file appears within the lib directory. So the next step is to create a class which uses this jar file. So go to file new other and select class. Say next give some name say it can be just a test class. So we created a class. Now we have a sample JDBC program provided in Moodle you can browse to that. So you can copy the contents of this class file of this Java file. Yes it is given as a link in the here in this third step. Yeah the class name can be renamed if you I mean class name is secondary. I mean you can just name it to whatever the file name is. So you can so now here I have called the class as test and I yeah the sample JDBC program paste it on to the test.java and change the class name to test. The class name and the file name should match that's all. So you can go through that program to it's a simple program which first first loads the Postgres SQL driver for this line to execute the jar file that we added has to exist in the library. You have a class the contents of the class should be this file and then change the. So there is a driver manager dot get connection line there enter the database name that you have created yesterday with the university schema. So it's I've called it to do dbms2010 and then enter the username and password you can use any user that you have created yesterday who has access to the university schema. So what is the so you have the file name and the class name as the same after you paste it go to the line driver manager dot get connection I have highlighted it yeah. So there in place of my db so that is the URL that is that is how it knows which Postgres SQL database to connect to. So we are saying local host and we have to give the database name yeah it depends on what you have created yesterday we created a database in pgadmin yes this is the format of the URL so yeah so this is basically the host this is where the server is running Postgres SQL host you can give IP address also yes it can be any it is just to identify where is the server which is running the Postgres SQL database port it uses the default port it knows the port. So for normal usage you don't need to specify the port. So we specify the database name here and then give the username and password first day the one that you created in psql where you pasted the where you created the university schema on the first day you can go back to pgadmin and browse there you can check it from there. So I have given Postgres and 1 2 3 because that's the that's the password I have used in my my machine so no no this is the password for the Postgres user. So this is this is just the example with this in it is the same username and password which you use to connect using pgadmin 3 is the same username and password no no it was there was a command that everyone ran slash password Postgres and set a password so whatever password you gave there that's what you should be using everyone has given their own so there's we haven't stuck to convention there then how did you connect using pgadmin so you can change the password again you can just okay if you have forgotten the password so the the only so what you can do is again change the password reset the password using the manual I mean using the steps that we had given in in yesterday's in day one so in the day one tutorial we had this step for changing the password administering Postgres so you have you will have to go through these three steps and set the set a new password it won't ask for the old password you can just enter a new password for the Postgres user and then you can come back to and then you can use that new password so once so I'll move move ahead and for those who have not forgotten the password maybe I'll come back again so once you enter the username and password you can look at so you can in the program below below that line we have a connection dot prepare statement there's a line of code which says current connection dot prepare statement and passes a SQL query with a question mark so that query has a name university dot student so that is basically saying the schema name dot table name but in our case we don't have to give the schema name you can just say select star from student it will use the default public schema which for it will use the default public schema for the user Postgres user so you can just change it to select star from student where department name equal to question mark so that is that is the end of that is all the changes that are required so now you can once you are done with this you can run this program so you can right click right click on the file say run as and Java application so if there is any error it is not if it's not able to connect it gives an error so I get a message that I have connected so this is the system this is the print line command which we had which we have in our program so once it's connected it's actually asking for a department name so you can enter a department name in the console so once so how many of you have been able to successfully establish a connection okay as soon as the connection is established you get this message here below you are connected and below that you can you have to enter this line you have to enter biology with the B uppercase so it's basically asking for a department name you enter biology and hit enter it lists out all the all the students who belong to that department this is just a toy example where we fire once one small query and show the results so if the connection is fine you will get a list of students from the database yeah so it depends on how much data exists I have a large data set so it shows me a lot of records so if you are able to successfully run this you can now go through the program and try to understand how what the code is what the program is trying to do and maybe you can change change the query and try out some things and there is an assignment corresponding to this assignment 5 so this starts gets you started on assignment 5 so this gets a this gave a sample program which connects to database and gives some results so now you can actually look at assignment 5 and try to modify this program or write so write similar programs which do similar which fire queries and display results so first for the JDBC program itself actually we should have added it in our sample JDBC program but the way we are handling the exception is not exactly very not a very nice way so if you open the sample JDBC program towards the end of the file there is a catch clause catch SQL exception and we are just printing out could not connect so that is actually hiding what the real error message is and whatever the error is it just says could not connect so instead so you can so just you can comment out that line or remove that line and add this line I will type it out so you can say SQL except SQL E dot print stack trace semicolon is it visible till the yeah it gives the error message on top along with the stack trace so this gives a detailed the actual error that is that is happening on the server so please make these changes in changes in your so you can just start I will make one error so I will make a mistake where there is the invalid column name the column DEPT does not exist so here it connected successfully and now it is asking for a department name and when I actually enter the department name it gives an so now it gives a exact error message saying column DEPT does not exist so for any such syntax errors in SQL you will get a more meaningful error message.