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...

Similar Messages

  • Connectivity of Applet with Oracle

    I am able to connect an Applet to oracle.It is displayed on the client browser only when there is an .java.policy file in my home directory.I created a .java.policy file on my server home directory.It is not running on the client machine.Please let me know how i can overcome this problem.Going through some of the previous topics in the forum i saw that signing the applet is one of the solution....please let me know how i can sign the applet.....its very urgent.

    we're currently looking at building the reports j2ee thin client for ibm websphere - however do not have a scheduled date for this. you can see if the j2ee thin client meets your requirements by looking at the doc for it for the bea client:
    http://otn.oracle.com/products/reports/htdocs/getstart/examples/Tools/thinclient/bea/Readme.html
    is something like this for websphere what you are looking for?
    thanks
    paul narth
    oracle reports & portal product management

  • Embedding Java Applet in Oracle Form

    I'd like to embed Java applet in Oracle Form. Please someone help me..let me know how to do it. Also I need to know how'll I use a jar within Oracle. Please help.
    Regards
    Rashed

    Hi Grant
    Thanks...I developed an applet which has a button on it and clicking the button something will happen. I mean this is a complete java project. Now I need to use this java applet from Oracle Form...that means I'll develop an oracle form on which the applet will be embedded so that the button on the applet can be pressed. Now could you please help me do this? I also have another problem but I need to resolve this first.
    Rashed

  • Java Connection Pooling issue with Oracle 10g Express Edition

    Hello
    I have a Java based web application that uses the Oracle 10g Express Edition database. I am using a connection pool to get connections to the database.
    I use the NetBeans IDE and run my web application on the bundled Tomcat server(5.5.7) that comes with the IDE. Though when I initially run the application from the IDE, the connection pool is set up fine, when I recompile my java code and try to run the application again, I get the following error each time:
    Listener refused the connection with the following error:
    ORA-12516, TNS:listener could not find available handler with the
    matching protocol stack.
    The logs before the error shows up, indicate that the connection pool object is fine and gives me the number of available connections and the number of active connections and so on, which I have printed from the constructor of the Connection Pool class:
    For e.g.:
    Cache size = 17
    Available Connections = 17
    Cache Limit = 1000
    Active size = 0
    However, if I kill my Tomcat server process and run the application again, it works fine with no error.
    I looked around for possible causes and solutions and all I could find
    was increasing the processes parameter value in the init.ora file. I have increased the parameter value to from 100 to 20000 now, in increments of 500/1000 each time but it hasnt worked so far.
    Someone else suggested that I increase the size of my connection pool; I initially had it set to a minimum limit of 5, an initial limit of 10 and a maximum limit of 1000. However if I set the Initial Limit to anything above 17 connections, I see the following log on the Bundled Tomcat log and my application doesn't run at all:
    Log: Loading JDBC Driver : class=oracle.jdbc.driver.OracleDriver ...
    Log: Loaded JDBC Driver
    Log: Connection with URL=jdbc:oracle:thin:@localhost:1521:xe as username/password
    Error code not handled : 0
    Exception Message :java.sql.SQLException: Listener refused the connection with the following error:
    ORA-12519, TNS: no appropriate service handler found
    The Connection descriptor used by the client was:
    localhost:1521:xe
    // End of log
    And the Bundled Tomcat server automatically shuts down.
    Again the System.out statements from the Connection Pool class constructor show that the cache has been initialized and that currently there are free connections available in the pool.
    E.g.
    Cache size = 18
    Available Connections = 18
    Cache Limit = 1000
    Active size = 0
    Has anyone faced anything similar? Could someone please suggest what I'm doing wrong here and what I should do to set right this problem?
    Swetha

    hello, please pardon me, my english is basic. i do of my best. i had the same problem until reading the pdf documentation 2 days for java devvelloper.it is simple, follow this way.
    try {OracleDataSource ds;
         Connection conn;
      ds = new OracleDataSource();
      ds.setURL("jdbc:oracle:thin:@localhost");
      conn = ds.getConnection("userid","password");
    Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
    don't forget to Dowload the user client of oracle Express Edition. do the rest of your program and it will work. take a look to the documentation pdf for java develloper. all it is explained.  good look                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to chage java version in Oracle 10g

    Hi all,
    I've installed on my server the Oracle 10g that includes the JRE 1.4.2_10. So, I have another JRE installed on my server and I would like to set the Oracle to use this one. How can I do this?
    Any Help will be appreciated,
    Alcides Flach

    Are you trying to write Java stored procedures that run inside Oracle's JVM? Or are you trying to write Java code that is executed on a middle tier application server that happens to connect to an Oracle database?
    Justin

  • User Connections getting increase in Oracle 10g database

    Hi All,
    we have a java application setup in Websphere 6.0 server with Oracle 10g as a back end database.
    Our application server is load balanced by two seperate server.
    We found that there are more number of inactive connections getting established to database from application server.
    Those connections keep on increasing automatically though we closed all the session created through application.
    Is there any specific reason behind this. Currently we are killing those sessions manually.
    Kindly help me in resolving this issue.
    Thanks in advance.
    Regards
    Aruna

    The main reason for this is products like Websphere are stateless, and establish a connection for every statement, execute the statement and close the connection.
    Refrain from setting up connection pooling, either in Websphere or at the database site, and you will keep seeing this.
    As such it is not a database problem. It is a problem of developers who don't know connection pooling.
    Sybrand Bakker
    Senior Oracle DBA
    Experts: those who did read documentation.

  • How to avoid:Query returns extra trailing spaces in oracle 10g

    I want to use cursor sharing FORCE, SIMILAR for performance tuning. but i am having some problems like query process will give extra trailing spaces this will throw errors from the java application while reading literals.
    do we have any option in oracle 10g to avoid extra trailing spaces during query processing ?
    alter session set cursor_sharing ='EXACT'
    select 1 from dual;
    '1'
    1
    alter session set curson_sharing='FORCE'
    select 2 from dual;
    '2'
    2
    alter session set curson_sharing='SIMILAR'
    select 3 from dual;
    '3'
    3

    You are right, But we already wrote millions of queries during that time we used cursor sharing is EXACT. so i don't want to take risk in modifying all the existing queries by adding TRIM.
    do we have any option in oracle to trim after/ during processing the query.
    Now we are facing performance issues and suggested us to use SIMILAR as cursor_sharing. but all the selected rows are giving extra tralining spaces.
    I think i am clear now.

  • Java Process in Oracle 10g AS

    Hi,
    The folowing process takes 50% cpu and sometimes it takes 100% cpu in Oracle 10g AS (OS version 5.8), what is the way to get ride of this problem?
    /ORACLE_HOME/jdk/jre/bin/java -server -cp /ORACLE_HOME
    Also, please let me know how to get into oracle 10g AS OEM
    Thanks in Advance
    bala

    Also, not to add to your troubles, but this is something you really should research and know yourself.
    If you're the person responsible for running AS in your organisation, then you should know how to stop, start and restart the processes whilst blindfolded (figuratively speaking).
    The first time your server crashes during a critical period, you really don't want to have to wait until you get an answer back from an internet forum before you know how to restart it.
    If it's not your responsibility to administer the AS, then you need to find the person who is responsible and ask them.

  • SQL QUERY to create new schema in Oracle 10g Express

    Can anyone provide the SQL query to create a new schema in Oracle 10g Express edition.

    Can anyone provide a SQl query to create a
    schema/user named 'test' with username as 'system'
    and password as 'manager'system user is created during database creation, it's internal Oracle admin user that shouldn't be used as schema holder.
    In Oracle database, Oracle user is schema holder there's no seperate schema name to be defined other than username.

  • Query Regarding Rich Text Editor in Oracle 10G

    Hello.
    Can anyone let me know is their any privilege in Oracle 10g that we Incorporate the Rich Text Editor functionality. Currently we are working on Laboratory / Radiology Template based Reports in which they are requesting their should be option through which we can simply Cut and Paste our organized TEXT(REPORT) which are formatted in MS WORD with Bold,Underline and in Bullets format, it should simply paste in Editor and we can view a Template based report with formatted REPORT.
    We are using Oracle 10G and it's Applet based Application. Any clue how can we Accomplish this? Any Suitable Suggestion?
    Thanks

    Sorry, I referred this already.. This also returns the HTML text. But i don't want the HTML text. I want Normal Text what i enter in the Editor. But as of now all the editors are returning HTML text. So in the front end also it is showing HTML text only.
    I entered the text in Editor as
    System Defaulted Note
    Quote entered
    But editor returns as below and the same way it is showing in the Front end application instead of above text.
    <html>
    <head>
    </head>
    <body>
    System Defaulted Note
    <p>
    Quote entered
    </p>
    </body>
    </html>

  • Connectivity Betwen BW And ORACLE 10g

    Hi All
      we are on BW 3.5, we need to pull the data from oracle 10g Server, Our BW is On Win NT and database is Oracle 9iand oracle 10g server is  on Win NT. I would like to Know what steps we need to take to establish the connectivity
    Here Oracle versions are different.
    Pls Help

    Hi,
    have a look on this note: 830576
    hope it help's

  • Problem connecting Discoverer plus to Oracle 10g DB

    I have a problem connecting Disocverer Plus to DB 10g.
    DB 10g is located on a different server than Discoverer. All windows environment. When I enter DB name it gives me ORA-12154 error.
    Question – I searched all the documents and it doesn’t say how to configure DB 10g to work with Discoverer. Could some one help me pointing me in a right direction? Do I have to create Data Warehouse or can I connect to the DB directly.
    I added Database connection on the DB 10g listener. Do I have to do it on the BI listener as well. So complicated and no guidance.
    thanks

    In your Discoverer 10g home, navigate to:
    $OH/network/admin
    configure your tnsnames.ora alias's
    or a shortcut... on Oracle BI Discoverer connection string enter:
    username
    pwd
    db string like this (no breaks):
    (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=yourmachine.domain)(PORT=1523)))(CONNECT_DATA=(SID = vis)))
    There is guidance. The Discoverer Configuration Guide
    or MetaLink Support notes.
    The configuration guide specifically documents common problems
    http://download-west.oracle.com/docs/html/B13918_03/tshoot.htm#sthref1287
    D.1.4 Discoverer reports the error ORA-12154
    OracleBI Discoverer reports error ORA-12154: Could not resolve service name.
    Problem
    OracleBI Discoverer cannot connect to the database alias specified by the connection details.
    Solution
    Make sure that:
    the database alias is in the tnsnames.ora file on the middle tier
    the database alias exists in the tnsnames.ora file on every machine that runs sessions
    Hint: If you have SQL*Plus (or any other Oracle product) running on that machine, try connecting to the database with that product.
    Hope that helps point you in the right direction.
    Regards,
    Steve.

  • Connect form builder to oracle 10g express ?

    Hi ,
    How can i connect form builder 10 to oracle 10g express ?

    error -> ORA -12154That normally means there is some problem with tnsnames.ora :
    $ oerr ora 12154
    12154, 00000, "TNS:could not resolve the connect identifier specified"
    // *Cause:  A connection to a database or other service was requested using
    // a connect identifier, and the connect identifier specified could not
    // be resolved into a connect descriptor using one of the naming methods
    // configured. For example, if the type of connect identifier used was a
    // net service name then the net service name could not be found in a
    // naming method repository, or the repository could not be
    // located or reached.
    // *Action:
    //   - If you are using local naming (TNSNAMES.ORA file):
    //      - Make sure that "TNSNAMES" is listed as one of the values of the
    //        NAMES.DIRECTORY_PATH parameter in the Oracle Net profile
    //        (SQLNET.ORA)
    //      - Verify that a TNSNAMES.ORA file exists and is in the proper
    //        directory and is accessible.
    //      - Check that the net service name used as the connect identifier
    //        exists in the TNSNAMES.ORA file.
    //      - Make sure there are no syntax errors anywhere in the TNSNAMES.ORA
    //        file.  Look for unmatched parentheses or stray characters. Errors
    //        in a TNSNAMES.ORA file may make it unusable.
    //   - If you are using directory naming:
    //      - Verify that "LDAP" is listed as one of the values of the
    //        NAMES.DIRETORY_PATH parameter in the Oracle Net profile
    //        (SQLNET.ORA).
    //      - Verify that the LDAP directory server is up and that it is
    //        accessible.
    //      - Verify that the net service name or database name used as the
    //        connect identifier is configured in the directory.
    //      - Verify that the default context being used is correct by
    //        specifying a fully qualified net service name or a full LDAP DN
    //        as the connect identifier
    //   - If you are using easy connect naming:
    //      - Verify that "EZCONNECT" is listed as one of the values of the
    //        NAMES.DIRETORY_PATH parameter in the Oracle Net profile
    //        (SQLNET.ORA).
    //      - Make sure the host, port and service name specified
    //        are correct.
    //      - Try enclosing the connect identifier in quote marks.
    //   See the Oracle Net Services Administrators Guide or the Oracle
    //   operating system specific guide for more information on naming.
    $Does
    C:\>tnsping xework ?
    You could also try using "<host name or IP address>/xe" as connection string (database).

  • Un-embed applet on oracle 10g forms from web browser

    Hi all,
    I want to ask how can i seperately open my applet from web browser in oracle 10g forms. To be more precise to my question, i dont want to use my applet in web browser. It should be opened in new window i.e. applet window.
    Regards,
    Qasim Javaid Malik

    If you want to run forms without the IE browser (hidden)
    Try this
    To open web forms just like client server with a hidden IE window, I have invented two methods.
    ****** make seperateFrame = True on formsweb.cfg ******
    Method 1
    <job id="SYMA">
    <script language="VBScript">
    Const SW_HIDE = 0
    Const High = 128
    strComputer = "."
    strCommand = "C:\Program Files\Internet Explorer\IEXPLORE.EXE http://symphony-devl.atradiusnet.com/forms/frmservlet?config=syma"
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")
    ' Configure the Notepad process to show a window
    Set objStartup = objWMIService.Get("Win32_ProcessStartup")
    Set objConfig = objStartup.SpawnInstance_
    ' Create Notepad process
    Set objProcess = objWMIService.Get("Win32_Process")
    intReturn = objProcess.Create _
    (strCommand,Symphony, objConfig, intProcessID)
    If intReturn <> 0 Then
    Wscript.Echo "Process could not be created." & _
    vbNewLine & "Command line: " & strCommand & _
    vbNewLine & "Return value: " & intReturn
    Else
    Wscript.Echo "Process created." & _
    vbNewLine & "Command line: " & strCommand & _
    vbNewLine & "Process ID: " & intProcessID
    End If
    </script>
    </job>
    Method 2
    <job id="SYMA">
    <script language="VBScript">
    dim objShell
    set objShell = CreateObject("InternetExplorer.Application")
    objShell.ShellExecute "C:\Program Files\Internet Explorer\IEXPLORE.EXE", "http://ws-79767.atradiusnet.com:8890/forms/frmservlet?config=localJpi", "", "open",0
    </script>
    </job>
    Change the URL as appropriate, it's fantasitic .... !!!!!!
    Any questions let me know ...... !

  • Connecting Java application to Oracle Database with JDBC

    How can I connect my Java application using Oracle 11g database?
    Please provide the steps involved along with the coding.

    What kind of Java application? Stand alone/desktop? Or web? Do you need dedicated, individual connections, or connection pooling for 10,000 concurrent users?
    You'll find a few clues in This Article [This Article|http://javawebdb.com/2012/01/30/connecting-a-java-servlet-to-a-database/]

Maybe you are looking for

  • How do i get itunes to work on a kindle

    How can i get itunes on my kindle? I downloaded the executable but the kindle apparently doesn't know what to do with it.

  • Charging a mac air in the car

    how can i charge my mac air in the car?

  • 'Update' maintenance mode in transaction PRAA

    Hi, We are trying to create an employee vendor using the transaction PRAA by selecting the 'Update' maintenance mode. The issue is that the clerk's email address is being copied from the reference vendor if the personnel does not have an email addres

  • PLS help me in solving this-sending multiple smss

    Hi all, ive developed an application which is capable of sending smss. when i send 300 characters as a single sms, the default system automatically devides into 2 smss and send to the destination, and at the destination all the characters are reassem

  • No option to select IMAP when setting up new account

    Hi All, I bought an iMac yesterday and am trying to set up my Gmail so I can sync it with my MacBook Pro and my iPad. Until now, I had IMAP enabled on the Gmail server, but in Mac OS Mail the account was set up as POP. Still, I was getting all my mai