Your problem below seems to be with Java syntax, not database connectivity
or JDBC APIs. It may be because you are using a declaration instead of a
scriptlet where you should, or vice-versa, but the servlet produced from
your JSP doesn't have its methods nested properly (according to the error).
Typically, that's what this sort of error indicates:
> '}' expected.
> out.print(_jspx_html_data[1]);
If you figure out where the messed up braces are, the rest of the exceptions
may just go away. Take a look at the parsed servlet code to figure it out.
If I may plug JRun 3.0 for a second here, it allows you to define a
datasource in the admin so that you don't have to put sloppy looking JDBC
code in your JSP. JRun handles the JDBC connection and driver code,
accesses the datasource via JNDI, and even manages connection pooling for
you. Furthermore, JRun bundles a cross-compatible taglib for making SQL
queries, formatting SQL results as XML, and looping over ResultSets (among
other things).
Scott Stirling
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Jayman Dalal
> Sent: Sunday, June 11, 2000 12:42 PM
> To: [EMAIL PROTECTED]
> Subject: JSP-JDBC-Database Connectivity
>
>
> Dear Fellow JSP Enthusiasts.
>
> Hi.
> I am using RHL6.2-JSWDK1.0.1-Netscape Navigator 4.72-Postgresql Database
> 6.5-JDK1.2. I am trying to estabish connectivity between web browser and
> database using jsp and jdbc.
>
> Please if anyone can send me sample code for doing the same, it will be
> highly appreciated.
>
> Basically I am trying to query records from a database using jdbc. I was
> able to do using jdbc application. But when I tried to do it using jsp,
> i got 500 error in browser and with the following error at console:-
>
> com.sun.jsp.runtime.JspServlet: init
> Scratch dir for the JSP engine is: work/%3A8080%2Fexamples
> IMPORTANT: Do not modify the generated servlets
> Unhandled error! You might want to consider having an error page to
> report such error
> com.sun.jsp.JspException: Compilation
> failed:work/%3A8080%2Fexamples/jsp_0002ftutorial_0002fjdbctest_000
> 2ejspjdbctest_jsp_1.java:69:
> '}' expected.
> out.print(_jspx_html_data[1]);
> ^
> work/%3A8080%2Fexamples/jsp_0002ftutorial_0002fjdbctest_0002ejspjd
> bctest_jsp_1.java:71:
> Statement expected.
> private Connection con;
> ^
> work/%3A8080%2Fexamples/jsp_0002ftutorial_0002fjdbctest_0002ejspjd
> bctest_jsp_1.java:75:
> Can't specify array dimension in a declaration.
> out.print(_jspx_html_data[2]);
> ^
> work/%3A8080%2Fexamples/jsp_0002ftutorial_0002fjdbctest_0002ejspjd
> bctest_jsp_1.java:75:
> Identifier expected.
> out.print(_jspx_html_data[2]);
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets