Linux Oracle Java Apps work but Applets won't execute or JServ Scripts won't execute
Date: Tue, 06 Jul 1999 06:07:10 GMT
Message-ID: <37899d0b.1136376_at_news.mbayweb.com>
Hi All,
I have installed Oracle 8.0.5.1 on RedHat 6.0. I installed the test tables etc that comes with the installation. I still can't figure out how to create the users/passwords. When I created the Database i had to set up the sys system and a few others. Every example shows a user scott/tiger to logon. I have been able to run most with sys/password or system/password. Do I need to create any other users?
I have created a few java apps to test the query with sqlplus and they work fine however, when I try the sample JdbcApplet. produces a null exception error when run. I figured out it isn't connecting to the database because I have been looking at the listener.log and don't see any connections but with the java Application I see the connection and the query is returned. I have also tried to execute a program using a simple Jserv servlet and I can't see the connection which leads me to believe I am having trouble with the web executing the connection(sandbox effect i believe) as i should be.
Any help would be appreciated.
exp applet
import java.sql.*; import java.applet.Applet; // import Applet class import java.awt.Graphics; // import Graphics class import java.util.*; import java.awt.*; /** * This Sample should list all names from the EMP table.*
*/
public class EmployeeApp extends Applet {
public TextArea output;
static final String query = "select ENAME from EMP";
public int position;
public void init() {
try{
//load driver DriverManager.registerDriver ( new oracle.jdbc.driver.OracleDriver()); Connection conn = DriverManager.getConnection("jdbc:oracle:thin:_at_(describe=(address=(host=workstation1.cypress-tech.net)(protocol=tcp)(port=1521))(connect_data=(sid=orcl)))","sys","database"); Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery(query); this.setLayout(new BorderLayout()); Panel p = new Panel(); p.setLayout(new FlowLayout(FlowLayout.LEFT)); this.add("Center", output); while(rset.next()) output.appendText(rset.getString(1)+"\n");
}
catch(SQLException ex) {
System.out.println(ex);
}
}// end of init()
}// end of class
Example of a Java App that works fine
import java.sql.*;
class Employee
{
public static void main (String args [])
throws SQLException
{
// Load the Oracle JDBC driver
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
Connection conn =
DriverManager.getConnection("jdbc:oracle:thin:_at_(description=(address=(host=workstation1.cypress-tech.net)(protocol=tcp)(port=1521))(connect_data=(sid=orcl)))","sys","database");
// Create a Statement
Statement stmt = conn.createStatement ();
// Select the ENAME column from the EMP table ResultSet rset = stmt.executeQuery ("select ENAME from EMP");
// Iterate through the result and print the employee names
while (rset.next ())
System.out.println (rset.getString (1));
}
}
Received on Tue Jul 06 1999 - 08:07:10 CEST