java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
I have written an simple jsp code to connect to the database and retrive some records.
In the first stage, it is giving me below error message.
" java.sql.SQLException: Io exception: The Network Adapter could not establish the connection "
I m running it on the eclipse.
Jsp code file :
<%@ page import="java.sql.*" %>
ResultSet rs=st.executeQuery("select * from service_types");
<table width="830" border="1" align="center" bordercolor="#000000">
<td width="63" align="center"><span class="style25">Your Account Balance: <b>Rs.</b></span></td>
<td width="63" align="center"><span class="style25"><%=rs.getString(2)%></span></td>
out.println("the error is "+e);
Note : I have removed the html tags from the file.
Can someone help help.
I m trying to learn basic programming using the JSPs, to build an front for my daily activities.
I think I have missed out some configurations.
Please help me thank you in advance.
If you are just starting to use JSP then you need to know that you are doing it wrong. Putting Java code into a JSP is a practice that has been obsolete and discredited for 12 years now. 12 years!
you should be putting such code in Java classes and not in the JSPs.
I know that I m not following any architecture but I want to know the reason beyond the error displayed.
If I can resolve this one, I would be going to do it in an MVC.
In my first step, I m facing the problem.
What could be the reason for it.
If any jar files are missed by me ?
, Ranch Hand
Can you try with -
Also check for IP address of Db service its mapping present in /etc/hosts file (On Windows machine eg. - C:/Program Files/System32/Drivers/etc/hosts)
If I had asked people what they wanted, they would have said faster horses - Ford. Tiny ad:
Why should you try IntelliJ IDEA ?
This thread has been viewed 3228 times.
All times above are in ranch (not your local) time.
The current ranch time is
Aug 22, 2018 00:17:28.