> static String driver = "oracle.jdbc.driver.OracleDriver";
> Class t = Class.forName (oracle.jdbc.driver.OracleDriver);
Maybe you had a typo?
Class t = Class.forName(driver); //String expected
Also look at your URL. What it @servername? Did you forget to supply
your server name?
Danny Rubi
Ari Kukkonen wrote:
> Could somebody tell me what is wrong with this servlet:
>
> import java.sql.*;
> import java.io.*;
> import java.util.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
>
> public class SimpleServlet extends HttpServlet
> {
> static String driver = "oracle.jdbc.driver.OracleDriver";
> Class t = Class.forName (oracle.jdbc.driver.OracleDriver);
>
> try {
> Connection conn = DriverManager.getConnection
> ("jdbc:oracle:thin:@servername:1521:ORCL", "Scott", "Tiger");
>
>
> // Create a Statement
> Statement stmt = conn.createStatement ();
>
> // Select the ENAME column from the EMP table
> ResultSet resset = stmt.executeQuery ("select NAME from EMPLOYEES");
>
> // Iterate through the result and print the employee names
> // while (resset.next())
> // System.out.println (resset.getString (1));
> } catch (SQLException ex) {}
>
> }
>
> When I try to compile it with JDK 1.1.8 The error message is:
>
> SimpleServlet.java:47: Type expected.
> try {
> ^
> 1 error
>
> Similar thing with an applet works like it should...
>
> Ari Kukkonen
>
> --
> Konecranes Components Corporation
> IT Technician
> E-Mail: [EMAIL PROTECTED]
> Phone: +358 20 427 2232 Cellphone: +358 40 747 7537
> --
> "If everything seems to be going well, you have obviously overclocked something."
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html