Java Applets connecting to Oracle DB thru OAS (JNDI)

i am developing an application, like i said before, i am using three applets, one controls a webcam, (records an image to disk and oracle), another controls a Electronic signature pad (records an image to disk and oracle), and finally a finger print reader (the same with this), at the beginning i didnt have any problem at all connecting this applet to the database, but top management wants to do things in another way, not allowing me to connect the applet directly to the database for security reason, My app resides on Oracle Application Server, and i use DataSource and Connection Pooling,
I want that this applets use the available datasource on OAS to connect to the Database, due that the DataBase IP Address wont be public but OAS IP address will, I know that i must use JNDI to accomplish this, but i didnt have any results at all
Message was edited by:
efebo_abel2002

i retrieved all the datasources from my app and i got this, i show my code and the returned errors, I can't connect my applet to the DB thru OAS datasources, any suggestions?
package rdf.struts.ajax;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NameClassPair;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.sql.DataSource;
public class ConductoresClient2 {
public static void main(String [] args) {
try {
final Context ctx = getInitialContext();
System.out.println(ctx!=null?"ctx no es null":"ctx es null");
NamingEnumeration nenum=ctx.list("jdbc");
while (nenum.hasMore()) {               
NameClassPair entry = (NameClassPair)nenum.next();
System.out.println("entry:="+entry.getName());
try {
DataSource ds=(DataSource)ctx.lookup("jdbc/"+entry.getName());
Connection conn=ds.getConnection();
Statement stm=conn.createStatement();
ResultSet rs=stm.executeQuery("SELECT * FROM palic_ow.conductores");
while(rs.next())
System.out.println("rs.getString(1):="+rs.getString(1));
System.out.println("rs.getString(2):="+rs.getString(2));
System.out.println("rs.getString(3):="+rs.getString(3));
catch (Exception e) {
System.out.println("Exception conectando a la base :"+e);
//java:comp/env/
}catch (Exception e) {
System.out.println("Exception obteniendo Context "+e);
private static Context getInitialContext() throws NamingException {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"oracle.j2ee.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL,"oc4jadmin");
env.put(Context.SECURITY_CREDENTIALS,"admin");
env.put(Context.PROVIDER_URL,"ormi://localhost:23791/sertracen");
return new InitialContext( env );
ctx no es null
entry:=OracleDS
Exception conectando a la base :javax.naming.NamingException: Lookup error: javax.naming.NamingException: javax/resource/Referenceable [Root exception is java.lang.NoClassDefFoundError: javax/resource/Referenceable]; nested exception is:
     javax.naming.NamingException: javax/resource/Referenceable [Root exception is java.lang.NoClassDefFoundError: javax/resource/Referenceable] [Root exception is javax.naming.NamingException: javax/resource/Referenceable [Root exception is java.lang.NoClassDefFoundError: javax/resource/Referenceable]]
entry:=v8PooledDS
Exception conectando a la base :javax.naming.NamingException: Disconnected: java.lang.NoClassDefFoundError: javax/resource/Referenceable
entry:=caom
Exception conectando a la base :javax.naming.NamingException: Lookup error: javax.naming.NamingException: javax/resource/Referenceable [Root exception is java.lang.NoClassDefFoundError: javax/resource/Referenceable]; nested exception is:
     javax.naming.NamingException: javax/resource/Referenceable [Root exception is java.lang.NoClassDefFoundError: javax/resource/Referenceable] [Root exception is javax.naming.NamingException: javax/resource/Referenceable [Root exception is java.lang.NoClassDefFoundError: javax/resource/Referenceable]]
entry:=v8DS
Exception conectando a la base :javax.naming.NamingException: Lookup error: javax.naming.NamingException: javax/resource/Referenceable [Root exception is java.lang.NoClassDefFoundError: javax/resource/Referenceable]; nested exception is:
     javax.naming.NamingException: javax/resource/Referenceable [Root exception is java.lang.NoClassDefFoundError: javax/resource/Referenceable] [Root exception is javax.naming.NamingException: javax/resource/Referenceable [Root exception is java.lang.NoClassDefFoundError: javax/resource/Referenceable]]
entry:=v8CoreDS
Exception conectando a la base :javax.naming.NamingException: Lookup error: javax.naming.NamingException: javax/resource/Referenceable [Root exception is java.lang.NoClassDefFoundError: javax/resource/Referenceable]; nested exception is:
     javax.naming.NamingException: javax/resource/Referenceable [Root exception is java.lang.NoClassDefFoundError: javax/resource/Referenceable] [Root exception is javax.naming.NamingException: javax/resource/Referenceable [Root exception is java.lang.NoClassDefFoundError: javax/resource/Referenceable]]
Process exited with exit code 0.
null

Similar Messages

  • Applet connected to oracle

    hi everybody,
    i've faced with a small problem while dealing with my homework.
    i have a simple applet connected to oracle. if i open it with applet viewer it works correctly but when i put the applet in a html file
    i'm getting following error:
    java.security.AccessControlException: access denied (java.util.PropertyPermission oracle.jserver.version read)
    at java.security.AccessControlContext.checkPermission(Unknown Source)
    at java.security.AccessController.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
    at java.lang.System.getProperty(Unknown Source)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(Oracle Driver.java)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at deneme.Connect(deneme.java:163)
    at deneme.<init>(deneme.java:41)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Nativ e Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknow n Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Un known Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at sun.applet.AppletPanel.createApplet(Unknown Source)
    at sun.plugin.AppletViewer.createApplet(Unknown Source)
    at sun.applet.AppletPanel.runLoader(Unknown Source)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.security.AccessControlException: access denied (java.util.PropertyPermission oracle.jserver.version read)
    at java.security.AccessControlContext.checkPermission(Unknown Source)
    at java.security.AccessController.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
    at java.lang.System.getProperty(Unknown Source)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(Oracle Driver.java)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at deneme.Connect(deneme.java:163)
    at deneme.<init>(deneme.java:41)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Nativ e Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknow n Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Un known Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at sun.applet.AppletPanel.createApplet(Unknown Source)
    at sun.plugin.AppletViewer.createApplet(Unknown Source)
    at sun.applet.AppletPanel.runLoader(Unknown Source)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    what's the problem? thanks in advance

    The simple answer is the applet security sandbox enforced by the browser. You should look on the Sun Java website for details on how to work with applets security.
    http://java.sun.com/
    Search on keywords applet security
    In a nutshell an applet can't open a socket to a server from other than that which it was served. There are (many) other security restrictions that you probably want to read about.
    The applet viewer doesn't enforce the sandbox security which it why it works well for you there.

  • How we build Java Database Connectivity for Oracle 8i Database

    Can any one send me a sample code for Java Database Connectivity for Oracle 8i Database
    it will be a grat help
    Thanks & Regards
    Rasika

    You don't need a DSN if you use Oracle's JDBC driver.
    You didn't read ANY of the previous replies. What makes you think this one willk help? Or any instruction, for that matter?
    Sounds like you just want someone to give it to you. OK, I'll bite, but you have to figure out the rest:
    import java.sql.*;
    import java.util.*;
    * Command line app that allows a user to connect with a database and
    * execute any valid SQL against it
    public class DataConnection
        public static final String DEFAULT_DRIVER   = "sun.jdbc.odbc.JdbcOdbcDriver";
        public static final String DEFAULT_URL      = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\Edu\\Java\\Forum\\DataConnection.mdb";
        public static final String DEFAULT_USERNAME = "admin";
        public static final String DEFAULT_PASSWORD = "";
        public static final String DEFAULT_DRIVER   = "com.mysql.jdbc.Driver";
        public static final String DEFAULT_URL      = "jdbc:mysql://localhost:3306/hibernate";
        public static final String DEFAULT_USERNAME = "admin";
        public static final String DEFAULT_PASSWORD = "";
        /** Database connection */
        private Connection connection;
         * Driver for the DataConnection
         * @param command line arguments
         * <ol start='0'>
         * <li>SQL query string</li>
         * <li>JDBC driver class</li>
         * <li>database URL</li>
         * <li>username</li>
         * <li>password</li>
         * </ol>
        public static void main(String [] args)
            DataConnection db = null;
            try
                if (args.length > 0)
                    String sql      = args[0];
                    String driver   = ((args.length > 1) ? args[1] : DEFAULT_DRIVER);
                    String url      = ((args.length > 2) ? args[2] : DEFAULT_URL);
                    String username = ((args.length > 3) ? args[3] : DEFAULT_USERNAME);
                    String password = ((args.length > 4) ? args[4] : DEFAULT_PASSWORD);
                    System.out.println("sql     : " + sql);
                    System.out.println("driver  : " + driver);
                    System.out.println("url     : " + url);
                    System.out.println("username: " + username);
                    System.out.println("password: " + password);
                    db = new DataConnection(driver, url, username, password);
                    System.out.println("Connection established");
                    Object result = db.executeSQL(sql);
                    System.out.println(result);
                else
                    System.out.println("Usage: db.DataConnection <sql> <driver> <url> <username> <password>");
            catch (SQLException e)
                System.err.println("SQL error: " + e.getErrorCode());
                System.err.println("SQL state: " + e.getSQLState());
                e.printStackTrace(System.err);
            catch (Exception e)
                e.printStackTrace(System.err);
            finally
                if (db != null)
                    db.close();
                db = null;
         * Create a DataConnection
         * @throws SQLException if the database connection fails
         * @throws ClassNotFoundException if the driver class can't be loaded
        public DataConnection() throws SQLException,ClassNotFoundException
            this(DEFAULT_DRIVER, DEFAULT_URL, DEFAULT_USERNAME, DEFAULT_PASSWORD);
         * Create a DataConnection
         * @throws SQLException if the database connection fails
         * @throws ClassNotFoundException if the driver class can't be loaded
        public DataConnection(final String driver,
                              final String url,
                              final String username,
                              final String password)
            throws SQLException,ClassNotFoundException
            Class.forName(driver);
            this.connection = DriverManager.getConnection(url, username, password);
         * Get Driver properties
         * @param database URL
         * @return list of driver properties
         * @throws SQLException if the query fails
        public List getDriverProperties(final String url)
            throws SQLException
            List driverProperties   = new ArrayList();
            Driver driver           = DriverManager.getDriver(url);
            if (driver != null)
                DriverPropertyInfo[] info = driver.getPropertyInfo(url, null);
                if (info != null)
                    driverProperties    = Arrays.asList(info);
            return driverProperties;
         * Clean up the connection
        public void close()
            close(this.connection);
         * Execute ANY SQL statement
         * @param SQL statement to execute
         * @returns list of row values if a ResultSet is returned,
         * OR an altered row count object if not
         * @throws SQLException if the query fails
        public Object executeSQL(final String sql) throws SQLException
            Object returnValue;
            Statement statement = null;
            ResultSet rs = null;
            try
                statement = this.connection.createStatement();
                boolean hasResultSet    = statement.execute(sql);
                if (hasResultSet)
                    rs                      = statement.getResultSet();
                    ResultSetMetaData meta  = rs.getMetaData();
                    int numColumns          = meta.getColumnCount();
                    List rows               = new ArrayList();
                    while (rs.next())
                        Map thisRow = new LinkedHashMap();
                        for (int i = 1; i <= numColumns; ++i)
                            String columnName   = meta.getColumnName(i);
                            Object value        = rs.getObject(columnName);
                            thisRow.put(columnName, value);
                        rows.add(thisRow);
                    returnValue = rows;
            else
                int updateCount = statement.getUpdateCount();
                returnValue     = new Integer(updateCount);
            finally
                close(rs);
                close(statement);
            return returnValue;
         * Close a database connection
         * @param connection to close
        public static final void close(Connection connection)
            try
                if (connection != null)
                    connection.close();
                    connection = null;
            catch (SQLException e)
                e.printStackTrace();
         * Close a statement
         * @param statement to close
        public static final void close(Statement statement)
            try
                if (statement != null)
                    statement.close();
                    statement = null;
            catch (SQLException e)
                e.printStackTrace();
         * Close a result set
         * @param rs to close
        public static final void close(ResultSet rs)
            try
                if (rs != null)
                    rs.close();
                    rs = null;
            catch (SQLException e)
                e.printStackTrace();
         * Close a database connection and statement
         * @param connection to close
         * @param statement to close
        public static final void close(Connection connection, Statement statement)
            close(statement);
            close(connection);
         * Close a database connection, statement, and result set
         * @param connection to close
         * @param statement to close
         * @param rs to close
        public static final void close(Connection connection,
                                       Statement statement,
                                       ResultSet rs)
            close(rs);
            close(statement);
            close(connection);
    }%

  • How to call Java Applet on a Oracle Portal page

    I have completed the below steps to add an Java Applet class file to the Oracle Portal.
    1. On the Portal Builder page, click the Navigator link.
    2. Click the Database Objects tab.
    3. In the Name column, scroll down to the schema in which you want to build the 4. object.
    5. Click the schema's name.
    6. Click Create New...Java Object.
    7. Click Java Class.
    8. Complete each wizard page until you reach this page.
    9. Granted PUBLIC access.
    I have created an html portlet on page an added:
    <applet class ="XXCPORT.MyJavaApplet">
    </applet>
    However, it does find the applet when I view the page. Is there some additional path or parameters I need to add?

    If you are asking if you can execute an external process (application/applet) from another application/applet - the answer is yes and no.
    Yes. If you have the security settings/policy to do so.
    No. This may require a security policy to be allowed - as an applet.

  • Java applet - Connection with OS

    I wrote some Java code to get the date and time via a NTP server.
    I get the correct date/time from the server and store it in a variable.
    Now I woudl like to pass the value to the 'date' command on the OS (Suse Linux), using JNI.
    Two problems:
    - How do I get the program to have root access to the 'date' command to change the date and time ?
    - How do I execute the 'date' command from within Java ?
    Thanks,
    J.M.

    Try asking this question on one of the Java developer forums. Specificlly the native method forum:
    http://forum.java.sun.com/forum.jsp?forum=52

  • Urgent : store and retrieve image to oracle database thru applet

    hi all
    i want the code sample for storing the image to oracle database
    development enviornment:
    server : oracle 9i , apache web server
    client : ie6 browser
    i am connecting to oracle database thru applet using oracle jdbc thin driver
    can anyone give me details about storing image to db
    1) what datatype should be used in table for image?
    2) my image files are on client machine... can i directly read those files from browser or first i have to copy those files to server?
    3) .gif files will do or what should be the fileformat?
    4) java code to store it to database (i am using jdk1.3)
    5) how to retrieve it back from database and display it in awt panel ?
    its very urgent ...
    i am doing some r&d and trying to do using blob....
    but it will take some time ...
    i will really be thankful if someone sends detail code....
    thankx in advance ....

    Hi,
    The code below might answer few of your questions.
    There is a restrcition on size of image, it must be less than 4KB.
    //Code to insert image in database
    //mytable is the table name that contains two fields in databse:name,image of type varchar and blob
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection con =null ;
    Statement stmt =null ;
    con =DriverManager.getConnection  ("jdbc:oracle:thin:@<hostname>:1521:orclsid", "system","manager");
    PreparedStatement preparedStatement = con.prepareStatement("insert into mytable (name,image) values (?,?)");
    preparedStatement.setString(1,"Amol");
    InputStream inputStream = new BufferedInputStream(new FileInputStream("C:\\WINNT\\Temp\\netscape\\images\\menubg.jpg"));
    preparedStatement.setBinaryStream(2, inputStream, inputStream.available());
    preparedStatement.executeUpdate();
    preparedStatement.close();
    inputStream.close(); To retrieve image,here is the snippet
    ResultSet resultSet = stmt.executeQuery("select image from mytable'");
    if (resultSet.next())
    byte[] image1 = resultSet.getBytes("image");
    FileOutputStream fos=new FileOutputStream("c://splash11.jpg"); //will retrieve bytes and create a file
    //by the name specified
    fos.write(image1);
    -Amol

  • Inputstream.java.io.IOException  ,  applet connection

    I'm working on a problem with the failure of a java
    applet connection to a java servlet.
    The connection is via the internet, and over port 80.
    the java console loggin reports the following
    There was an attempt to redirect a url request,
    but the attempt was not allowed by the client. IOException caught in run
    could some one let me know what the URL re-direction is here,
    much apreciated,
    slainte

    I have often found this problem with inexperts java programmers.
    I could tell you better luck next time, but today I feel generous, so I will answer.
    There is a redirect domain problem. When you try to connect the site you receive an ICMP error message, which is the responsable of the error message you can see. That occurs because the URL connects to another URL different (surely because its original URL has changed to another) and you only have to discover the new URL, and try to connect to it.

  • Exmpl of Servlet connect with ORacle

    Hi folks,
    Can anyone send me example of Java Servlet connectivity with Oracle.
    i m not able to connect servlet with oracle.
    u guys can reply me on [email protected]
    thanks
    dal hit

    No.
    The code for connecting to Oracle from a Servlet is no different from connecting to Oracle from any other Java application. So tell you what, you show us what you've tried and the error message(s) and we'll help you debug it.
    99.999% of the time it's a failure to put the driver Jar file into the classpath, the specifics of which vary from application server to application server. Which one are you using?
    u guys can reply me on [email protected]
    We can, but we won't. This is not your personal bugfixing service. Pay if you want that kind of help. If you want it for free, do it through the forums or go away.
    Probably you'll never read this response, but that's your problem not mine.

  • 'No more data to read from socket' error connecting to Oracle 9i

    Hi,
    My Java app connecting to Oracle 9i gets an error: No more data to read from socket.
    Application host is running oraClient805 and JDK1.3.1_06 SE
    Connection string jdbc:oracle:thin:@myhost:1521:mysid worked fine connecting to the Oracle 8 version.
    I've checked tnsnames.ora, tried tnsping util to Ora 9i, it's OK. As well I could connect directly through the SQL Worksheet.
    Could anyone suggest what could be wrong or different to make a connection from Java app to Oracle 9i ?
    I was advised to upgrade the driver, but I am not sure what do I need. I have classes102, classes111, and classes12 in the %ORACLE_HOME%\jdbc\lib\ directory. Do I miss something?
    Thanks a lot.
    Tatiana

    I believe there might be problems using the older drivers with oracle 9. You might search this forum for more info.

  • DataSocket & Java Applet

    Is it possible to program a java applet to access information from instruments using DataSocket? Is there an API? There is an API announced on this website:
    http://flagpole.mit.edu/applets/DataSocket/DS-HOWTO.html
    It says it's a Beta but I cannot acces the link that redirect on NI's Website

    Hi GGingras,
    National Instruments used to provide and support a product known as DataSocket JavaBean. Unfortunately, it has been discontinued. So, DataSocket is not much of an option. There are a few other ways, however, that you can take to gain access to instruments.
    One way would be to create a Remote Panel, which does not need a java applet. Here is a link to a tutorial on how to create one.
    If you must use Java, you could export your LabVIEW VIs into a DLL using Application Builder, and then use the JNI (Java Native Interface) to talk to this DLL. Here is a link that may provide some more information on how to do this.
    Lastly, you can communicate over TCP/IP. You can write a server using TCP/IP primitives and have the java applet connect to it and exchange data via TCP or UDP.
    Hope this helps. Let me know if you need any more information. Happy Coding!
    Jeremy L.
    National Instruments
    Jeremy L.
    National Instruments

  • Problem in connection with oracle

    I've Oracle10g database installed in my system, i wrote a simple application in java that connects to oracle database using oracle thin driver. I've jdk1.6.0_02
        package RegistrationPackage;
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.jdbc.pool.OracleDataSource;
    public class JDBCVersion {   
        public JDBCVersion() {
        public static void main (String args[])
              throws SQLException
            OracleDataSource ods = new OracleDataSource();
              String url = "jdbc:oracle:thin:@//localhost:1521/orcl";  //1
              ods.setURL(url);//2
              ods.setUser("system");//3
              ods.setPassword("tripathi");
              Connection conn = ods.getConnection();
          // gets driver info:
          //System.out.println("JDBC driver version is " + meta.getDriverVersion());
    }i got following exception
      Exception in thread "main" java.sql.SQLException: Listener refused the connection with the following error:
    ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
    The Connection descriptor used by the client was:
    //localhost:1521/orcl
            at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
            at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:380)
            at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:401)
            at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:441)
            at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
            at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
            at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:839)
            at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:389)
            at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:278)
            at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:199)
            at RegistrationPackage.JDBCVersion.main(JDBCVersion.java:24)
    Java Result: 1I'm sure that problem is in line no. 1.
    I've a bit confusion, i dont know at which port my oracle database server listen through which connection can be made. apparently, I'm not sure about host name however, i used localhost just because a local copy of database server installed in my system.
    please show me the right direction
    regards
    san

    got it!
    actually the was due to incorrect SID.

  • Query to connect Java Applet to Oracle 10g.

    I am developing an Applet in Java 1.5.0.7.My database is Oracle 10g.Now when i connect Oracle to Java I get the Error : java.lang.ExceptionInInitializerError
    and it does not get connected.Please help me anyone.
    Below is the code which i have written.
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.MouseEvent;
    import java.beans.PropertyChangeEvent;
    import java.beans.PropertyChangeListener;
    import java.sql.*;
    import java.util.ArrayList;
    import javax.swing.JApplet;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    public class tt7 extends JApplet
         implements ActionListener, PropertyChangeListener
    private int m_uniqueID = 0;
         JLabel m_lblRadius;
         // A button the user can click to display the Add Theme wizard.
         JButton m_btnAddTheme;
         static String m_mapxtremeURL = null;
         // TODO: Specify a map file name such as "uk.mdf" (if the mdf file is in
         // in same directory that the applet was loaded from),
         // or an URL to a map file, such as "http://host.com/maps/uk.mdf".
         // Or, instead of specifying this URL explicitly here, you can specify it
         // in the HTML page that loads the applet (using the 'filetoload' param).
    ResultSet rs=null ;
    ArrayList arrlist=null;
    ArrayList arrlist1=null;
    ArrayList arrlist2=null;
    //Connection con=null;
    Statement st=null;
         public void start()
         } // start method
         public void init()
    try{
    // System.out.println("helloooooooo");
    Class.forName("oracle.jdbc.driver.OracleDriver");
    //Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection con= DriverManager.getConnection("Jdbc:oracle:thin:@asl005:1521:geo","system","1234567");//"jdbc:oracle:thin:@asl005:1521:geo","system","1234567");
    System.out.println("helloooooooo");
    System.out.println("CON:"+con.toString());
    st = con.createStatement();
    System.out.println("St:"+st);
    catch(Exception e2){System.out.println("Exception :"+e2);}
    catch(ExceptionInInitializerError s)
    System.out.println("Exception2 :"+s);
    }// If the HTML page specified parameters, use them to
              // override our default values.
              // See if a MapDef file was specified in the HTML file.
         }     // propertyChange method
         // Respond to the user actions, such as clicking
         // the Add Theme button.
    public void actionPerformed(ActionEvent e)
    // LocalDataProviderRef localDPRef = null;
    // a static label displayed in the applet
    public void propertyChange(PropertyChangeEvent evt) {
    This is the HTML CODE...
    <HTML>
    <HEAD>
    <TITLE>SimpleMap applet demonstration</TITLE>
    </HEAD>
    <BODY>
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = 600 HEIGHT = 440
    codebase="http://java.sun.com/products/plugin/1.3.1/jinstall-131-win32.cab#Version=1,3,1,0">
    <PARAM NAME = CODE VALUE = "tt7.class" >
    <PARAM NAME=archive VALUE="classes12.jar">
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.5">
    <COMMENT>
    <EMBED type="application/x-java-applet;version=1.5"
    CODE = "tt7.class"
    WIDTH = 600 HEIGHT = 440
    archive="classes12.jar"
    pluginspage="http://java.sun.com/products/plugin/1.3.1/plugin-install.html">
    <NOEMBED></COMMENT>
    alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
    Your browser is completely ignoring the &lt;APPLET&gt; tag!
    </NOEMBED></EMBED>
    </OBJECT>
    </BODY>
    </HTML>

    My dear colleague, You better consider asking this question in Jdeveloper forum.
    I have a simple code for Windows application. You can easily convert it into Applet application..
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.sql.*;
    public class QueryFrame extends Frame {
    TextField inputText;
    public QueryFrame() {
    super("Query Interface");
    setSize(450, 250);
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    ActionListener printListener = new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
    ConnectAndRun(inputText.getText());
    Panel toolbar = new Panel();
    toolbar.setLayout(new FlowLayout(FlowLayout.LEFT));
    Button queryButton = new Button("Run Query");
    queryButton.addActionListener(printListener);
    toolbar.add(queryButton);
    inputText = new TextField(14);
    toolbar.add(inputText);          
    // The "preferred" BorderLayout add call
    add(toolbar, BorderLayout.NORTH);
    public static void main(String args[]) {
    QueryFrame tf1 = new QueryFrame();
    tf1.setVisible(true);
         public void ConnectAndRun(String s)
              String sqlquery;
              if (s.equals(""))
              sqlquery ="select * from DEPT where LOC is null";
              else
              sqlquery ="select * from DEPT where LOC like '" + s + "'";
              System.out.println(sqlquery);
              try
              DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
         Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@localhost:1521:HELLO","scott","tiger");
         Statement stmt = conn.createStatement ();
              ResultSet rset = stmt.executeQuery (sqlquery);
              while (rset.next ())
                   System.out.println( rset.getInt("DEPTNO"));
                   System.out.println( rset.getString("DNAME"));
                   System.out.println (rset.getString("LOC"));
              rset.close();
         stmt.close();          
              catch (SQLException se)
                   System.out.println(se);
    Make sure you have appropriate libraries in classpath...

  • Java applet to connect to Oracle Database?

    Hello,
    I need to make a standalone java applet where I can enter the following:
    database url:
    driver:
    database:
    user name:
    password:
    host name:
    port:
    and then click "ok" and it is supposed to connect me to my Oracle account set up at my school. Ive never done anything like this before. Can anyone please provide me with some code to get started? Thank soooo much!

    look into jdbc. You will find it a bit more tricky if you insist on using an applet (why not an app?), as they do not by default have permission to do this sort of stuff (security issues). You will need to create the applet, and then sign it using a certificate. You may be able to get a development-only certificate for free from some eastern european website... I would strongly urge you to use an app instead if you are in any way able to.

  • So I can update my Oracle Java Applet Plug-in to Development Kit 7, Update 65, can you link me to the correct Oracle download page from your Plugin Update page?

    When I periodically accessed your Plugin Check and Updates web page in the past, I really appreciated you connecting me to the correct Plugin Updates vendor web page when I clicked on your red Update Now button. This time, however, your Java Applet Plug-in "Update Now" button linked me to the Oracle Java "7u65 Updates Release Notes" instead of the usual download page. It seems rather unexpected for me, or any other conscientious user for that matter, to search the appropriate "JDK 7U65" file download from the Oracle website.
    Thank you,

    This is getting way too complicated for normal peop.
    First: the "Update Plugin" does not work, it goes to a page with all sort of computer jargon but no "Update button" anywhere.
    Second: this forum jscher2000 gives a good solution, but I downloaded the incorrect java update, because my computer is 64 bit. how am I supposed to know my browser is what it refers to and that FF is 32 bit.....???$%^&*()??
    Third: some of those "critical update" software are not even on my computer....well at least I don't think it is, I search for "shockwave" and did not find it.
    I love Moz FF but the updating is starting to get out of control. why give us (computer idiot) an auto recommendation update not tailored to our computer? Perhaps in big letters at the top there should be an explanation "this is general suggestion these plugin needs updating, not to tailored with your computer, do your own research"
    and/or add info I need to know like the 32 bit thing, took me forever to download the 64bit update for JAVA and it was the wrong one.
    Now I am just afraid to update anything for FF because it is too darn confusing.

  • Connect db oracle with applet

    My problem is the connection between applet and db oracle that it resides in another host of the web server.
    Security problem address to me to I use oracle connection manager.
    cman.ora is so shaped:
    cman = (ADDRESS_LIST=
    (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.20.14)(PORT=1630)(QUEUESIZE=32))
    while the db connection is:
    "jdbc:oracle:thin:@(description=(address_list= " +
    "(address=(protocol=tcp)(port=1630)(host=192.168.20.14))"+
    "(address=(protocol=tcp)(port=1521)(host=192.168.40.14)))" +
    "(connect_data=(sid=dbbackup))"
    but occurs the error :
    java.sql.SQLException: Eccezione IO: Connection reset
    WHY?
    thank's all

    Hi,
    You should avoid connecting to a database from an applet. The applet should instead connect to a server process, which has a database connetion (or a pool of connections)
    /Kaj

Maybe you are looking for

  • 'Sign and Save As' in Acrobat 8.1.2 Professional

    Hello! I realize this is not a critical error or anything, but it is a major nuisance to the tech-unsavy and easily frustrated in my office. When signing a document with a Digital Signature in Acrobat 7.0, you had the option to "Sign and Save" which

  • Need a good notebook app for my iPad

    Hello all, I'm looking really hard for a notebook app that will allow me to create note folders, manipulate texts, docx files, and excell in the app store.  Not seeing anything good.  Im currently using notes that come with the iPad.  I also have Goo

  • AirPlay Mirroring shows scrambled output in guest account

    When using Mountain Lion's AirPlay Mirroring in the guest account, all I see on an Apple TV is some flickering scrambled image. The same issue is observed by one other user on the Net. The reponse by another user is as follows.. "To be more precise:

  • Some fancy Aperture workspace options, in pictures.

    (Note:  I am running 3.2.2 on 10.6.8 using modest hardware (13" MBP {5.5}).  I have never experienced any problems with these workspaces, even with large (30,000 RAW Masters) and very large (300,000 JPGs) Libraries.  I suggest trying all this on a pr

  • Default clause in tables

    Hi, I'm using java API to deploy my publication and publication items. The problem is that, on client side, the tables are generated without the default clause on columns. I'm using this method: createPublicationItem(java.lang.String name, Consolidat