This is probably a better question to ask at Sun's JSP-INTEREST list.
But here's a quick example to get you started.
<jsp:useBean id="dDBInterface" scope="session"
class="com.zethcon.WebSynapse.DBInterface" />
. . .
<%
String sUserName = ((String)session.getValue("PID"));
String sVPath = "";
if(dDBInterface.insertWebTransLog(sUserName,sVPath +
"websynapse/OrderInq/InBoundDtl.jsp"))
{}
%>
-----Original Message-----
From: Mario Henley Becerril Geldis [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 22, 2002 10:22 AM
To: [EMAIL PROTECTED]
Subject: Run class on jsp
I am a beginner on JSP enviroment..
I have a class file, this connect a Oracle database, and query to single
table...now i want run this class on a jsp page...how i do it..??
my 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:@(DESCRIPT
ION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.3.4)(PORT =
1521)
))(CONNECT_DATA =(SERVICE_NAME = votoedos)(SRVR =
DEDICATED)))","scott","enie");
System.out.println ("OK");
Statement stmt = conn.createStatement ();
// Query the employee names
ResultSet rset = stmt.executeQuery ("SELECT dttofed From
TDFDF97_NL");
while (rset.next ())
{
// Print the name out
System.out.println (rset.getString (1));
}
}
}
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>