hi

> Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
 this trick failed.

here is my code

<%@ page import="java.sql.*" %>
<%@ page import="java.lang.*" %>
<%! Connection myConnection; %>
<%--Connection myConnection =
DriverManager.getConnection("jdbc:oracle:oci8:@ORCLNCS","ramkumar","ramkumar
");--%>
<%!
public void jspInit() {
try{
Class.forName("oracle.jdbc.driver.OracleDriver");



Connection myConnection =
DriverManager.getConnection("oci8:@ORCLNCS","ravink","ravink");
}catch(Exception exp){}
}
%>

<%! public void jspDestroy(){
try{
myConnection.close();
}catch(Exception e){}
} %>

<%
Statement myStatement = myConnection.createStatement();
try{
    myStatement.execute("select * from discovery_data");
    ResultSet mySet = myStatement.getResultSet();
        while (mySet.next()){
        String ipAddress = mySet.getString("IP_ADDRESS");
        String deviceModel = mySet.getString("DEVICE_MODEL");
        String userName = mySet.getString("USER_NAME");
        out.println(" IP Address : " + ipAddress + "Device Model :" +
deviceModel + "User Name :" + userName);
        }
        }
        catch ( Exception e){
                        System.out.println( "SQL Erro:" + e.toString());
                }

                myStatement.close();
                myConnection.close();
         %>



friza taib wrote:

  Hi,
  Try put newInstance();

  Class newClass =
  Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();

  >From: Ravi N <[EMAIL PROTECTED]>
  >Reply-To: A mailing list about Java Server Pages specification and
  >     reference <[EMAIL PROTECTED]>
  >To: [EMAIL PROTECTED]
  >Subject: problem with Class.forName
  >Date: Tue, 30 Jan 2001 15:28:47 +0530
  >
  >hi,
  >
  >  i am facing a peculiar a problem with Class.forName(...),
  >
  >i am getting this error
  >
  >
  >500 Internal Server Error
  >
  >/dataBase.jsp:
  >
  >javax.servlet.ServletException: Compilation error occured:
  >  Found 1 errors in JSP file:
  >D:\\JRun3.0\\servers\\default\\default-app\\dataBase.jsp:15: Error: No
  >method named "forName" was found in type "Class".
  >
  >allaire.jrun.scripting.DefaultCFE:
  >Errors reported by
  >compiler:d:/JRun
  3.0/servers/default/default-app/WEB-INF/jsp/jrun__dataBase2e
  >jspd.java:88:18:88:65: Error: No method named "forName" was found in type
  >"Class".
  >
  >         at

>allaire.jrun.scripting.JavaCompilerService.compile(JavaCompilerService.java
,
  >Compiled Code)
  >         at allaire.jrun.jsp.JSPServlet.compilePage(JSPServlet.java,
  >Compiled
  >Code)
  >         at allaire.jrun.jsp.JSPServlet.createServlet(JSPServlet.java,
  >Compiled Code)
  >         at allaire.jrun.jsp.JSPServlet.loadPage(JSPServlet.java,
Compiled
  >Code)
  >         at allaire.jrun.jsp.JSPServlet.service(JSPServlet.java, Compiled
  >Code)
  >         at allaire.jrun.servlet.JRunSE.service(JRunSE.java, Compiled
Code)
  >         at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java, Compiled
  >Code)
  >         at

>allaire.jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.ja
v
  >a, Compiled Code)
  >         at allaire.jrun.servlet.JRunSE.service(JRunSE.java, Compiled
Code)
  >         at allaire.jrun.servlet.JvmContext.dispatch(JvmContext.java,
  >Compiled Code)
  >         at allaire.jrun.http.WebEndpoint.run(WebEndpoint.java, Compiled
  >Code)
  >         at allaire.jrun.ThreadPool.run(ThreadPool.java, Compiled Code)
  >         at allaire.jrun.WorkerThread.run(WorkerThread.java, Compiled
Code)
  >
  >
  >
  >here is the code
  >
  ><%!
  >public void jspInit() {
  >try{
  >Class newClass = Class.forName("oracle.jdbc.driver.OracleDriver");
  >Connection myConnection =
  >DriverManager.getConnection("oci8:@ORCLNCS","ravink","ravink");
  >}catch(Exception exp){}
  >}
  >%>
  >
  >where i am going wrong?
  >i have spend hours with this problem,plse help me out
  >
  >proj is on jrun3.0/winnt
  >
  >
  >thanx & regards,
  >ravi
  >
  >========
  ===================================================================
  >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
  >JSP-INTEREST".
  >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
  >DIGEST".
  >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

  _________________________________________________________________________
  Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


===========================================================================
  To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
  JSP-INTEREST".
  For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
  DIGEST".
  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".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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

Reply via email to