Declare your getConn( ) method inside the declaration tag i.e.
<%!
.........your code here
%>
instead of the scriptlet tag.
This could be one reason for the error.
Have a nice day.
With regards,
Sachin S. Khanna.
www.emailanorder.com
----- Original Message -----
From: Jose Castro <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 19, 2000 4:38 PM
Subject: Error inserting in DataBase
> Hi,
>
> I'm new with JSP's, and right now I'm testing JSP with WebLogic Server and
> with two databases (Oracle and CloudScape).
> The following code is used to insert some data in the database, but it
> returns an error that I don't know how to fix.
>
> ERROR:
>
E:\weblogic\myserver\classfiles\examples\jsp\_dbtest\_Personal_95_form_95_v4
> _95_2.java:77: '}' expected.
> probably occurred due to an error in dbtest\Personal_form_v4_2.jsp line
20:
> " %>
>
>
E:\weblogic\myserver\classfiles\examples\jsp\_dbtest\_Personal_95_form_95_v4
> _95_2.java:78: Statement expected.
> probably occurred due to an error in dbtest\Personal_form_v4_2.jsp line
21:
>
>
>
E:\weblogic\myserver\classfiles\examples\jsp\_dbtest\_Personal_95_form_95_v4
> _95_2.java:85: Type expected.
> (No more information available, probably caused by another error)
>
>
> CODE (with line numbers):
> 16. <%@ page import="
> 17. weblogic.db.jdbc.*,
> 18. java.sql.*,
> 19. weblogic.common.*
> 20. " %>
>
>
> 23. <%
> 24. Connection conn = null;
> 25. public Connection getCon()
> 26. {
> 27. Class.forName("weblogic.jdbc.pool.Driver").newInstance();
> 28. conn = DriverManager.getConnection("jdbc:weblogic:pool:oraclePool");
> 29. return conn;
> 30. }
> 31. %>
> 32.
> 33. <%
> 34. conn = getCon();
> 35. if (conn != null)
> 36. {
> 37. String employee_id = (String) request.getParameter("employee_id");
> 38. String name = (String) request.getParameter("name");
> 39.
> 40. Statement stmt = conn.createStatement();
> 41. stmt.executeUpdate("INSERT INTO JSP_TESTS VALUES (employee_id,
name)");
> 42. ResultSet ds = stmt.getResultSet();
> 43. ds.close();
> 44. }
> 45. %>
>
>
===========================================================================
> 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
>
===========================================================================
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