IMHO, the line with Class.forName shuold be:
Class.forName("oracle.jdbc.driver.OracleDriver");
It's a simple line, without t = Class.for...., because you load a Class
explicitly.
--jerry
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet API
Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Ari Kukkonen
Sent: Friday, October 01, 1999 3:01 PM
To: [EMAIL PROTECTED]
Subject: Type expected
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