thanks for replying my post so fast, but i m confused due to i m new in this, can you modify my codes so that let it works? and also show me how to set the settings u mentioned?
thanks a zillion....:D ----- Original Message ----- From: "Martin Sandiford" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Cc: "Neo Gigs" <[EMAIL PROTECTED]> Sent: Monday, March 11, 2002 12:42 PM Subject: RE: Help in JDBC The <%! directive is strictly for declarations. The Class.forName() line is a statement. You can change this in to a statement trivially thus: Class driver = Class.forName("blahblah"); Tomcat (any jsp compiler?) will put the contents of <%! directives in the class body for the jsp page (ie outside the _jspService method), which leads to the syntax error you are getting. You may want to consider loading the driver as part of the _jspService routine, and encapsulating in try/catch block. This will allow you to do some error handling if the driver fails to load for some reason. Martin -----Original Message----- From: Neo Gigs [mailto:[EMAIL PROTECTED]] Sent: Monday, 11 March 2002 2:31 PM To: Tomcat Users List Subject: Help in JDBC hi there, I had the following codes on my JSP page: <html> <head><title>Stored Procedure Call using JDBC</title></head> <body> To test JDBC call to fire stored procedure named <b>sp_GetClatTypeIE</b> <%! Class.forName("oracle.jdbc.driver.OracleDriver"); %> <%@ page language="java" import="java.sql.*, java.math.*, java.io.*" %> <% try{ String url = "jdbc:oracle:thin:@10.97.2.50:1521:REL4"; String scall = "begin sp_GetClatTypeIE(?, ?); end;"; Connection conn = DriverManager.getConnection(url, "tux", "tux"); CallableStatement cs = conn.prepareCall(scall); cs.registerOutParameter(2, Types.VARCHAR); cs.setInt(1, 22555); cs.execute(); cs.close(); conn.close(); String output = cs.getString(2); } catch (SQLException e) { System.err.println("Error: " + e.getMessage()); } out.println("Result is: " + output); %> </body> </html> and when i run it on my Tomcat 3.3a (Sun), i get this error returned: org.apache.jasper.JasperException: Unable to compile /software/jakarta-tomcat-3.3a/work/DEFAULT/ROOT/SpTest_2.java:12: Type expected. Class.forName("oracle.jdbc.driver.OracleDriver"); ^ 1 error at org.apache.tomcat.facade.JasperLiaison.javac(Unknown Source) at org.apache.tomcat.facade.JasperLiaison.processJspFile(Unknown Source) at org.apache.tomcat.facade.JspInterceptor.requestMap(Unknown Source) at org.apache.tomcat.core.ContextManager.processRequest(Unknown Source) at org.apache.tomcat.core.ContextManager.internalService(Unknown Source) at org.apache.tomcat.core.ContextManager.service(Unknown Source) at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source) at java.lang.Thread.run(Thread.java:484) whats wrong? please help me! Thanks Regards, Neo Gigs ======== VB?http://communities.msn.com.my/VisualBasicwithNeohttp://www.vbcity.com/for umhttp://www.vbweb.co.ukGet paid cash receive email?http://www.MintMail.com/?m=1414418 Reading SMS got paid?http://www.dynamicsms.com.au/intro.asp?ref=0123502385&refc=348 Malaysianshop.com http://www.malaysianshop.comMore Traffic? http://www.exitblaze.com/cgi-bin/intro_track.pl?b=25924&c=xbad1============= =================================== Note:This is intended to addressees only, if you wanna be removed, let me know. -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]> _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]>