Hi...
sorry but my jsp doesn't run...
my class have this code:
import java.sql.*;
import java.io.*;
import java.util.Date;
class JdbcTest
{
public static void main (String args [])
throws SQLException, IOException
{
System.out.println ("Loading Oracle driver");
try
{
Class.forName ("oracle.jdbc.driver.OracleDriver");
}
catch (/*ClassNotFound*/ Exception e)
{
System.out.println ("Could not load the driver");
e.printStackTrace ();
}
System.out.println ("Connecting to the remote database");
Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@(DESCRIPTION
=(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.3.4)(PORT =
1521)))(CON
NECT_DATA =(SERVICE_NAME = abc)(SRVR = DEDICATED)))","scott","scott");
System.out.println ("OK");
Statement stmt = conn.createStatement ();
// Query the employee names
ResultSet rset = stmt.executeQuery ("SELECT dttofed From TABLE");
while (rset.next ())
{
// Print the name out
System.out.println (rset.getString (1));
}
}
}
and my jsp have this: i'm not include the class in my jsp code. only
i rewrote this...
<%@ page import="java.sql.*" %>
<HTML>
<HEAD><TITLE>Simple Oracle Example</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER>
<B>Employees</B>
<BR><BR>
<%
Connection conn = null;
try
{
Class.forName ("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection ("jdbc:oracle:thin:@(DESCRIPTION
=(ADDRESS
_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.3.4)(PORT =
1521)))(CONNECT_DATA
=(SERVICE_NAME = abc)(SRVR = DEDICATED)))","scott","scott");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT dttofed From TDFDF97");
//Print start of table and column headers
out.println("<TABLE
CELLSPACING=\"0\" CELLPADDING=\"3\" BORDER=\"1\">");
out.println("<TR><TH>ID</TH><TH>NAME</TH></TR>");
//Loop through results of query.
while (rs.next ())
{
// Print the name out
out.println("<TR>");
out.println("<TD>" + "registro" + "</TD>");
out.println("<TD>" + rs.getString(1) + "</TD>");
out.println("</TR>");
}
out.println("</TABLE>");
}
catch(SQLException e)
{
out.println("SQLException: " + e.getMessage() + "<BR>");
while((e = e.getNextException()) != null)
out.println(e.getMessage() + "<BR>");
}
catch(ClassNotFoundException e)
{
out.println ("Could not load the driver");
e.printStackTrace ();
}
finally
{
//Clean up resources, close the connection.
if(conn != null)
{
try
{
conn.close();
}
catch (Exception ignored) {}
}
}
%>
</CENTER>
</BODY>
</HTML>
But when i run the last code on my server this say:
Employees
Could not load the driver
When my java class run fine....
why..???
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>