• Post Reply Bookmark Topic Watch Topic
  • New Topic

help Required in compiling a Jsp page

 
Varshini Priya
Ranch Hand
Posts: 95
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi

Im trying to execute a jsp code and when I try to run the page, I get the below error



org.apache.jasper.JasperException: An exception occurred processing JSP page /data.jsp at line 23

20: <H1>Fetching Data From a Database</H1>
21:
22: <%
23: Connection connection = DriverManager.getConnection(
24: "jdbcracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=xxx.com)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ABCTG447.world)(INSTANCE_NAME=ABCTG447B)))", "user=pmig", "password=8412afg");
25:
26: Statement statement = connection.createStatement();


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

java.sql.SQLException: No suitable driver found for jdbcracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=xxx.com)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ABCTG447.world)(INSTANCE_NAME=ABCTG447B)))
java.sql.DriverManager.getConnection(Unknown Source)
java.sql.DriverManager.getConnection(Unknown Source)
org.apache.jsp.data_jsp._jspService(data_jsp.java:79)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717



I guess the jar file classes12.jar needs to be installed. But not sure where to install it. Please assist. Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not something that you should be doing in a JSP. Move the code out to a servlet controller or bean.
 
Varshini Priya
Ranch Hand
Posts: 95
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Can you please be a bit more specific and let me know why this is not correct. Thanks
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming that the DB URL is correct, do you have the DB driver jar file in the WEB-INF/lib folder?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Varshini Priya wrote:Can you please be a bit more specific and let me know why this is not correct. Thanks

Modern JSPs should have no Java code within them. That is a practice that has been discredited for over 8 years.

Look up information on the JSTL and EL (Expression Language).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!