SQL Server JDBC Error: The TCP/IP connection to the host Failed

I had installed SQL SERVER 2014 Express edition and I was trying to connect to SQL SERVER from Java program using JDBC, but I was repeatedly getting following error:

com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "connect timed out. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".Error while closing connection !!null

20 Questions You can ask to Interviewer in Programming Job Interviews?

From the first round to HR round, from telephonic to face-to-face, in almost all kind of programming interviews, there will be a time when Interviewer will give you chance to ask questions. Many programmers are too concern about asking questions, and they politely decline ; Well it's your chance to learn about the Job you are going to do, and you shouldn't let this opportunity goes away. Interviewer, also judge you by your questions; a good, thoughtful, positive question can create the great impression on Interviewer's mind. It also shows that  the interest of a candidate for a Job.

Share Your Interview Experience with Javarevisited

Hello Guys,
How are you? Hope you are doing well.
It's been 5 years since I have started Javarevisited. In last five years, I have worked hard to make Javarevisited a good resource to prepare for Java interviews, and to make it even more useful, I am inviting you, my readers, to share your Interview experience with us, the Javarevisited community. If you like Javarevisited and think that it has helped you in past, and you want to give something back to the community, then it's time to share your own interview experience with us.

How to convert java.util.Date to java.sql.Date - JDBC Example

You often need to convert java.util.Date to java.sql.Date if you are storing dates in database e.g. SQL SERVER or MySQL. Since JDBC has their own data types for date and time e.g. java.sql.Date, java.sql.Time and java.sql.TimeStamp to match with database date, time and date time types, you cannot pass java.util.Date directly. All methods which are suppose to store dates e.g. setDate(paramName, paramValue) expects java.sql.Date, so it becomes essential to know how to convert java.util.Date to java.sql.Date in JDBC. You would be surprised to know that java.sql.Date is a subclass of java.util.Date and all it does is suppress or remove time-related fields from java.util.Date. It is also a good example of a class which violates Liskov substitution principle, because even though java.sql.Date extends java.util.Date, you cannot pass around it to the method which expect java.util.Date because all time-related methods e.g. getHour(), getMinute() and getSeconds() method throws java.util.NotSupportedException.