Help needed to access Oracle from Applet.

Please help. I have spent days reading info on the web and I simply cannot access to Oracle from an applet to work. Oracle is on a different IP than the Web Server. For my testing I am running the html directly from my local file system.
Here are the steps I have taken:
1. Create a key: "%JAVA_HOME%/bin/keytool" -genkey -alias MyAlias -keypass MyKPass -keystore C:\Keys.bin -storepass MySPass
2. Sign my jar: "%JAVA_HOME%/bin/jarsigner" -keystore C:\Keys.bin -storepass MySPass -keypass MyKPass -signedjar myjar-signed.jar myjar.jar MyAlias
3. Sign Oracle's Jar: "%JAVA_HOME%/bin/jarsigner" -keystore C:\Keys.bin -storepass MySPass -keypass MyKPass -signedjar ojdbc14-signed.jar ojdbc14.jar MyAlias
4. Applet Tag (at this time I have the two jars in the same folder as the HTML and JS files):
    <applet id="MyApp"
  codebase=""
  archive="myjar-signed.jar,ojdbc14-signed.jar"
  code="com/company/applets/Test.class"
  mayscript
  width="50" height="50">
    </applet>5. Javascript:
  document.observe("dom:loaded", function() {
  alert("Applet: " + $('MyApp').getVersion());
  $('MyApp').getConnection(url, user, pswd);
  alert("Applet: " + $('MyApp').getVersion() + "Got Connection.");
  $('MyApp').testConnection();
  alert("Applet: " + $('MyApp').getVersion() + "Connection Tested.");
});Execution:
1. The applet loads, The browser asks if I want to trust it, I say yes.
2. The '$('MyApp').getVersion()' works.
3. The '$('MyApp').getConnection(url, user, pswd);' fails. Java Code:
  public void getConnection(String url, String user, String pswd)
      throws Exception {
    try {
      System.out.println("Driver...");
      DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
      System.out.println("Connection...");
      _conn = DriverManager.getConnection(url, user, pswd);
      ...The driver registers, but the getConnection fails with a security error.
After much reading, I used policytool to update the policy file. It added:
keystore "file:/C:/Keys.bin", "jks";
grant signedBy "MyAlias" {
  permission java.security.AllPermission;
};This did not make any difference. Both IE and FF get the same error.
The JRE being used is 1.6.0_14.
Any help solving this would be MUCH appreciated.
Thanks.

I have simplified the problem, and now it has nothing to do with Oracle. It is a certificate/signing problem.
Here are the steps I took to set the test up:
Certificate:
"%JAVA_HOME%/bin/keytool" -genkey -storepass MyStorePswd -keyalg RSA -alias MyRsa -dname "CN=Company.com, OU=IT, O=Company Inc, L=Atlanta, ST=Georgia, C=US, DC=mailexpress, DC=com" -validity 999
"%JAVA_HOME%/bin/keytool" -selfcert -storepass MyStorePswd -alias MyRsa -validity 999
"%JAVA_HOME%/bin/keytool" -exportcert -storepass MyStorePswd -alias MyRsa -rfc -file MyRsa.cer
"%JAVA_HOME%/bin/keytool" -importcert -keystore "C:\Program Files\Java\jre6\lib\security\cacerts." -storepass changeit -alias MyRsa -file MyRsa.cer
Jar Signing:
"%JAVA_HOME%/bin/jarsigner" -storepass MyStorePswd -keypass MyStorePswd -signedjar Text-Project-signed.jar Text-Project.jar MyRsa
"%JAVA_HOME%/bin/jarsigner" -verify Text-Project-signed.jar
Result: jar verified.
HTML:
    <applet id="MyApp"
            codebase="file:/c:/projects/Text-Project/js/Memory"
            archive="Text-Project.jar"           <== unsigned test  OR
            archive="Text-Project-signed.jar"    <== signed   test
            code="com/company/applets/MemTest.class"
            mayscript
            width="50" height="50">
    </applet>
JavaScript:
document.observe("dom:loaded", function() {
  alert("Applet: " + $('MyApp').checkSecurity());
Function in the Applet:
  public String checkSecurity() {
    System.out.println("Security Check...");
    try {
      AccessController.checkPermission(new FilePermission("MemTest.js", "read"));
      AccessController.checkPermission(new FilePermission("MemTest.js", "write"));
      AccessController.checkPermission(new java.net.SocketPermission("192.168.1.121", "resolve"));
    } catch (Exception e) {
      e.printStackTrace();
      return e.getMessage();
    return "Security Checked OK";
  }Results (Internet Explorer):
1. Unsigned JAR, No policy:
Result = java.security.AccessControlException: access denied (java.io.FilePermission MemTest.js read)
(as expected)
2. Unsigned JAR, Policy = permission java.security.AllPermission:
Result = Security Checked OK
(as expected)
3. Signed JAR, No Policy: Popup states: signature verified; do you want to run the application.
Result = java.security.AccessControlException: access denied (java.io.FilePermission MemTest.js read)
(not expected)
Something is wrong with the certificate or signing process. Any ideas ?
Thanks.
Edited by: javadude.101 on Jul 29, 2009 12:29 PM

Similar Messages

  • Do I need additional Driver/Clients when accessing Oracle from CSharp ?

    I am trying to connect from within a CSharp program to Oracle database 10g Express.
    I coded in CSharp:
    using System.Data.OracleClient;
    but this line gives an unresolve error: Type or namespace missing ...?
    As far as I thought VisualStudio 2005 provides a standard client for Oracle database.
    How do I enable it ?
    Or do I need some additional files from Oracle to get it working ?

    You may find useful these links from the Oracle technology corner >
    http://www.oracle.com/technology/sample_code/tech/windows/ole_db/oledb92/index.html
    http://www.oracle.com/technology/sample_code/tech/windows/ole_db/oledb8/index.html
    Regards.

  • Accessing Oracle from Linux

    Hi,
    Can anybody help out in this.....!i shall be very thanx ful..
    My problem is, i have an Oracle database running on WinNT 4.0..it's been
    there for a while,now i need to access this database from a linux
    machine,using an application developed for linux platform developed in C.
    My doubt is :
    (i) How do i connect to the oracle database on WinNT from linux using C ?.
    (ii)Are there any C libraries for oracle connectivity on linux ?
    Thanx in advance
    Shine V
    null

    Say that you will use perl's DBI interface and DBD::Oracle, then
    you will still need to install Oracle on your linux box for the
    seek of compiling and installing DBD::Oracle on linux.
    Once you have DBI and DBD::Oracle installed, you may access any
    other oracle installations whethere local or remote.
    I see this as the simplest way, but I may well be wrong.
    regards,
    shaoping
    R     mi Bastide (guest) wrote:
    : Hello,
    : I have a Netware Oracle server already running, so I do not
    : really need to install a full blown Oracle server on my Linux
    : box. All I want to do is access my Oracle DB from Linux (with
    a
    : Perl interface) to do some web stuff.
    : What are the minimum requirements on the Linux box ? what do I
    : need to install ?
    : Thanks to all
    null

  • Accessing Oracle from ASP

    I'm going to convert a SQL Server 7.0 database and its stored procedures to Oracle8i. No problem, I'll use the workbench. What I'm much less clear on are the issues of accessing Oracle stored procedures from Active Server Pages. Can you provide some links to any relevant technical papers?

    If you're using ASP's, I assume you'll be coding to the ADO API to do your actual database access. Assuming this is the case, the Oracle OLE DB or ODBC driver can be used to make the actual connections and to call the stored procedures. If you have a functional ASP now going against a SQL Server database, it should require minimal effort to modify that ASP to go against an Oracle database. You'll merely need to tell it to use one of our drivers, rather than the Microsoft drivers.
    Since there are a number of ASP/ADO books available, I'm not sure that Oracle produces a lot of documentation about how to use those interfaces to access our database. One of the major goals of Microsoft's various data access protocols is that you should be able to write a single app that accesses any database.
    Justin Cave
    ODBC Development

  • ACCESSING ORACLE FROM ACCESS

    I CANT ACCESS ORACLE TABLES FROM MY ACCESS PROGRAM,,IT GIVES ME ERROR MESSAGES TNS, ODBC CONNECTION FAILED

    you have to create a data source name for oracle before trying to connect to the Oracle database. For this you have to go to Control Panel and open 32ODBC and create a System DSN if Oracle is on other machine or if it is on the same machine create User DSN.
    After creating this check the connectivity by opening the ODBC Test from
    start | Programs | Oracle for windows | Network
    after testing this you can specify the DSN name in your Access application and work on the Oracle database.
    I think this will help you ......
    Regards,
    Imran Hakeem

  • Help needed recovering project files from trash

    Hi everyone, I am hoping that someone will be able to help me. I just did something stupid!
    I created two new projects in iMovie this morning and then needed to clear out the mac in order to speed up a clip as I was getting the warning that my disk was full. So I copied a lot of files from iPhoto onto a hard drive and then moved them to trash including the raw files that I was using for these projects. (I got a bit carried away!) Yes the video files were in iPhoto and not iMovie Events as the last time I uploaded files iMovie was not playing the game.
    The files are still on the mac as I have not emptied the trash and they are also backed up on an external drive connected to the mac, but I have emptied the iPhoto trash. I tried importing the files back into iPhoto from trash and only got so far before the disk full message came up again. But even those ones that I did manage to re import are not showing up.
    Is there any way that I can continue with these projects or have I effectively ruined them? Do I need to start again from scratch? I hope not as they took me hours and hours to create and had pretty much finished them.
    Any help will be greatly appreciated. Thanks. :-)

    http://pondini.org/TM/17.html
    To see these "other" backups, you need the Browse Other Backup Disks or (Browse Other Time Machine Disks on Snow Leopard or Leopard) option.  It's available by Alt/Option-clicking the Time Machine icon in your Menubar, or by control-clicking (right-clicking) the Time Machine icon in your Dock.

  • Help, Need to change NAT from moderate to open for WRT54GS2

    just like to the topic says i used these methods:
    Open an Internet Explorer browser page on your wired computer(desktop).In the address bar type - 192.168.1.1 and press Enter...Leave Username blank & in Password use admin in lower case...
    On the set-up tab change the MTU Size to 1365 and click Save Settings...
    Click on "Administration" tab and disable the option UPnP and click Save Settings...
    Click on "Applications and Gaming" tab and then click on "Port Range Forwarding" subtab...
    1) On the first line in Application box type in ABC, in the start box type in 53 and End box type in 3074, leave the protocol as both and under ip address type in 192.168.1.20 and check the enable box, click Save Settings once done...
    2) Once you return to the set up page click on the Security tab and uncheck Block Anonymous Internet Requests and click on Save Settings...
    3)Click on the Status tab and take note of DNS1 and DNS2 Addresses...
    4) Goto the XBox Network Settings and IP Address Settings and select manual IP Settings and assign the following on your Xbox IP Address :- 192.168.1.20, Subnet Mask :- 255.255.255.0, Default Gateway :- 192.168.1.1...
    5) Also assign the DNS Addresses on the Xbox, Use DNS1 and DNS2 Addresses you took note off of the router status tab as Primary DNS & Secondary DNS for the xbox...
    6) Turn off your modem, router, and Xbox...Wait for a minute...
    7) Plug the modem power first, wait for another minute and plug the router power cable, wait another minute and turn on the Xbox and test it...it will connect...     i have firmare 1.0.01. i am using 2 Pluglink 9650 Powerline Ethernet Adapters to connect to my xbox for xbox live. if u need anything else let me know. PLEASE SOMEONE HELP 

    What device is upstream from the router?  If you have a modem that acts as a router as well, then you might have a double NAT problem.  It's a well documented problem and can usually be solved by bridging the modem or configuring the router to work as a switch only.

  • Ringtone help needed -- Galaxy 3 - downloaded from VZN and cannot find

    Downloaded Ringtones for Samsung Galaxy 3  cannot find on phone. How do I find them and activate them. Did come thru as attachments in a TXT msg from Verizon

    FIGURED IT OUT! Not easy to figure out at first.  Also, I see where Verizon's ringtones expire after 12 months, so you may want to manager your finances accordinly...
    ******Essentially you need to copy it from your dowload folder to a ringtone folder. Then set it as your setting for sound.****
    Go to Apps icon --> Choose MY FILES folder icon
    Select file folder called "SDCARD0"...
    Select file folder called "DOWNLOAD FOLDER"...the ringtones from Verizon were downloaded in here.   Scroll down to the to your ringtone... it will be listed by the name of the ringtone song.
    Select the ringtone you downloaded. You'll have to complete action using Google Play Music or Sound Player. I chose Soundplayer just once.  The song will play. You can pause it.
    Hit the SETTINGS KEY on bottom left of you phone on that next to the raised button.
    Select SET AS  and chose to save it in the PHONE RINGTONE.
    To activate it,
    Hit the SETTINGS KEY on bottom left of you phone on that next to the raised button.
    Select SETTINGS
    Select SOUND
    Select DEVICE RINGTONE and it will be in the folder!

  • Help needed to insert data from different database

    Hi ,
    I have a requirement where i need to fetch data from different database through database link .Depending on user request , the dblink needs to change and data from respective table from mentioned datbase has to be fetched and populated .Could i use execute immediate for this, would dblink work within execute immediate .If not , could pls let me know any other approach .

    What does "the dblink needs to change" mean?
    Are you trying to dynamically create database links at run-time? Or to point a query at one of a set of pre-established database links at run-time?
    Are you sure that you really need to get the data from the remote database in real time? Could you use materialized views/ Streams/ etc to move the data from the remote databases to the local database? That tends to be far more robust.
    Justin

  • Help needed to access a file from and email link.

    I received an email with a link to an Adobe document. When I attempt to open the link I receive a message " You do not have accewss to the file" How do I gain access?

    Then it is the case I mentioned, the author sent the URL from the address bar viewing the form in Edit mode rather than copying the Fillable Form link. 
    You'll need to respond to the form author and ask them to send out the correct link/URL to the fillable form (which does not ask for any login).  They can go to the "Distribute" tab and on the "Web Form" sub-tab click "Copy Link", if the form is "Closed" it will ask if they want to "Open" the form, the form needs to be in the "Open" state to collect responses so say "Yes".  This will copy the link to their clipboard and they can then send that link/URL out.
    Also, if they close the form (by clicking the X in the upper right corner) and are looking at the "My Forms" tab in FormsCentral, with the form selected there is a "Link" button in the toolbar along the top which copies the form URL to send out.
    Here are a few documents that include information on how to distribute forms: https://www.acrobat.com/formscentral/en/quickstart/distribute-web-form.html
    http://forums.adobe.com/docs/DOC-1413
    http://helpx.adobe.com/acrobat-com/formscentral/topics.html
    Thanks,
    Josh

  • Help needed in accessing the url from which a swf file has been loaded

    Hi All,
    Can anyone help me out in finding the url of the swf file
    from which it has been loaded? The purpose of the url is, I am
    loading some flv files using relative path. I just want to achieve
    the same by appending the relative path to the parent swf url from
    where the parent was loaded.
    I am a newbie to AS3, So please don t mind if this is a silly
    question.
    Can anyone help me on this.
    Thanks in advance,
    Prabakaran Srinivasan.

    Hi,
    Thanks for the reply. I think the option you gave is only
    applicable when the AS3 class comes in the DisplayObject hierarchy.
    I want this information in an AS3 class which does not extend any
    of the Sprite or its super class hierarchy. Can you let me know the
    possibility of fetching the value from such a class which i
    specified???
    Thanks,
    Prabakaran Srinivasan.

  • Urgent help needed - writing japanese into the applet code from servlet

    Hi,
    I have a jsp file which writes an applet as well as a popup menu on the applet. All the menu items and applet text displays japanese character.
    Two menu items on this popup menu are written by the same jsp while three dynamic menu items are written by a servlet which does so by writing a response back to the jsp.
    My problem is when I write the popup items from the servlet it doesn't display the japanese character but something like this "-- $B?7$7$$$*5RMM$rA*Br(B --"
    I am sure that something wrong in the way I write into the response in the SERVLET because JSP writes japanese menu items fine.
    my code in servlet is like this.
    response.setContentType("text/plain;charset=ISO-2022-JP");
    PrintWriter output = response.getWriter();
    output.println(\u30aa\u30f3\u30c7\u30de\u30f3\u30c9\u30ec\u30dd\u30fc\u30c8);
    I have set the font family to, font-family: gothic, mincho, arial unicode ms; in the jsp that takes care of displaying everything propertly but the MenuItems from the servlet :(
    Please write back if you have the solution.
    Thanks,
    preeti..

    i don't know exactly,but ithink that the problem is about the ISO-code
    japanese has got another number

  • How to access database from applet using connection pooling.

    Hi,
    I am using tomcat 4.1, JRE 1.4.2_10, MySQL 5.0, and IE 6.0. I can access the database using connection pooling from JSP without problems. But, if I try to acess from the applet, I get the following exception (related to JNDI.):
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    I know what this acception means, but I don't know how to fix it. I set up connection pooling in my Tomcat 4.1 that talks to MySQL 5.0. As I said, when I access from jsp, JNDI works. But, applet complains. Please help. In my applet, the following code accesses the database:
    ArrayList toolTipData =
          access.getToolTipData (projectName,interfac);This is the snipet of my Access class:
    public ArrayList getToolTipData (String projectName, String interfac) {
        System.out.println("In getToolTipData");
        ArrayList toolTipData = new ArrayList();
       try{
        Context ctx = new InitialContext();
        if(ctx == null )
            throw new Exception("No Context");
        DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/interfacesDB");
        if (ds != null) {
          Connection conn = ds.getConnection();
          if(conn != null)  {
              Statement s = conn.createStatement();
              //For some reason paramtized queries don't work, so I am forced
              //to this in slighly less eficient way.
              ResultSet rst = s.executeQuery("select * from interfaces");
              while (rst.next()) {
                 if (rst.getString("Project_Name").equals(projectName) &&
                     rst.getString("Interface").equals(interfac)) {
                   System.out.println("getToolTipData: ITG #" + rst.getString("ITG"));
                   toolTipData.add("ITG #: " + rst.getString("ITG"));
                   toolTipData.add("SPNE Prime Name: " +
                                   rst.getString("SPNE_Prime_Name"));
                   toolTipData.add("PD Prime Name: " +
                                   rst.getString("PD_Prime_Name"));
                   toolTipData.add("IT Prime Name: " +
                                   rst.getString("IT_Prime_Name"));
                   toolTipData.add("MLC Priority: " +
                                   rst.getString("MLC_Priority"));
                   toolTipData.add("Gary's Prime: " + rst.getString("Garys_Prime"));
                   toolTipData.add("QA Prime: " + rst.getString("QA_Prime"));
                   toolTipData.add("Brief Description: " +
                                   rst.getString("Brief_Description"));
                   toolTipData.add("Project_Status: " +
                                   rst.getString("Project_Status"));
              conn.close();
      }catch(Exception e) {
        e.printStackTrace();
      return toolTipData;
    ....

    The jsp runs on the server, whereas the applet runs on the client so
    you must package with your applet any jndi implementation specific classes
    and
    Properties props = new Properties();
    props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory" );
    props.setProperty("java.naming.provider.url", "url:1099");
    Context ctx = new InitialContext(props);
    Object ref = ctx.lookup("...");

  • Access Oracle from BSP

    Hi all,
    My requirement is to access some values from the oracle database table residing on a different server and display them in a BSP page.
    I think the connection to oracle is possible from an ABAP class.I am not really sure of how do we connect to an external database from ABAP.
    If anyone has done something like this before, it would be great if they help me out in this regard.
    Thanks in advace.
    Vivek

    Hi Vivek,
    I found this help in my SAP-GUI. Could not find the same information in help.sap.com
    Hope it helps.
    <b>Secondary Database Connections with Open SQL</b>
    You can use the CONNECTION addition to execute Open SQL commands on databases other than the R/3 standard database. This gives you a number of possibilities, for example you can transfer and update data in other databases, irrespective of whether the other system is an R/3 System or not. However, it is a prerequisite that it is a database system supported by SAP, because only in such a system is the software needed for an Open SQL access available in form of a shared library.
    <b>Note</b>
    This statement is for internal use only.
    Incompatible changes or further developments may occur at any time without warning or notice.
    <b>Setting Up a Secondary Database Connection</b>
    To a access another database you need an entry in the table DBCON that describes the access data of the database. If the secondary database is from a different manufacturer than the R/3 System database, you will need the SAP shared library as well as the client software provided by the manufacturer. How to create the DBCON entry and install the additional software is described in the standard SAP Notes for every for every supported database system.
    <b>Standard Database Connection</b>
    Every work process has a standard database connection to the R/3 standard database. It is communally used by all internal sessions. You can also explicitly access this database connection using the name DEFAULT. The DEFAULT connection can also be specified dynamically using CONNECTION (name), where the name field must have the value 'DEFAULT'.
    <b>Accessing Other Database Tables</b>
    If you use a database connection to access database tables that are not in the R/3 standard database, there must also be a database table with the same name and identical type in the ABAP Dictionary of the local R/3 System. Open SQL assumes that the type information of these remote database tables corresponds exactly with that of the local database table. This prerequisite is essential for the correct interpretation of the database contents, for example, and, if necessary, their conversion with regards to the ABAP type of the target fields (see INTO Clause). If this prerequisite is not met, this can lead to wrong data or runtime errors when reading or writing, depending on the database system. Because the ABAP runtime system cannot ensure the consistency of the type descriptions in the local and remote databases, the consistency must be guaranteed by the relevant application program.
    <b>Database Connections and Transactions</b>
    Every database connection forms its own transaction context. This means that database changes on one connection can be saved (using COMMIT) or discarded (using ROLLBACK) independently of changes on other database connections. You can, for example, commit and store protocol data on a secondary database connection without affecting the running transaction on the standard R/3 database connection.
    Secondary database connections are not known outside the limits of an internal session. So, if a program opens a database connection and then calls another program - with SUBMIT for example - that opens a connection to the same database, you have two different connections and therefore two different database transactions.
    For the first Open SQL commandthat requests a specific database connection, the system opens a corresponding connection. All subsequent commands (in the same internal session) for the same remote database use the same database connection and all form a database transaction. The transaction is ended by:
    A COMMIT CONNECTION or ROLLBACK CONNECTION on this
    connection
    <b>A COMMIT WORK or ROLLBACK WORK</b>
    A database commit or database rollback on this database connection in Native SQL,
    An implicit commit by a screen change, specifically the statements CALL SCREEN, CALL DIALOG, CALL TRANSACTION, MESSAGE
    A Remote Function Call (RFC), specifically the statements CALL FUNCTION ... DESTINATION, CALL FUNCTION ... STARTING NEW TASK, CALL FUNCTION ... IN BACKGROUND TASK, and WAIT.
    In summary, a database transaction is completed at the latest, when the application program reaches a state in which a change of work process could occur.
    <b>Note:</b>
    Working with parallel database connections, that is parallel transactions, can lead to lock situations that only one work process is involved in: A program changes a database row on the first connection and tries to change the same row on a second connection. This will result in the program waiting for the lock of the first program, without this first transaction ever being able to continue. You can only resolve this situation by ending the work process. This is done automatically for dialog processes, but must be done manually for background jobs. You should therefore not change the same table in one program on multiple database connections.
    <b>Interaction with Native SQL Connections.</b>
    In addition to the above, you can also explicitly open a connection using a CONNECT with Native SQL. Native SQL also allows you to explicitly close and disconnect a database connection using DISCONNECT. In this case, the database transaction in question is closed and corresponding database changes are discarded. You can use the Native SQL command GET CONNECTION to ascertain the current Native SQL connection. With Native SQL you can also access a connection that was opened with Open SQL. In this case it is sufficient to convert the active Native SQL connection using SET CONNECTION. It is not necessary to open it using CONNECT TO.
    <b>Managing Database Connections</b>
    The database connections are automatically managed by the runtime system. If a transaction is saved on a database connection (COMMIT) or rolled back (ROLLBACK), it can be reused by the runtime system. You can open a maximum of 10 database connections for each work process. On certain databases, you may not be able to reach this number.
    Regards,
    Subramanian V.

  • Urgent help needed in two clarifictions of applet code

    Hi,
    I have an applet code where I have two buttons. Now, if button A is clicked it should pass a particular query string while if button B is clicked it should pass another particular query string.
    I would like to confirm
    1) Whether the query string passed is a valid statement(/approach) and
    2) Why there is an error in assigning qryString to qryString1.
    Thanks for any help/advise in advance.
    THE CODE:
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    public class ReinApplet1 extends Applet implements ActionListener
    TextField text;
    Button button1;
    Button button2;
    TextArea taResults;
    public void init()
         button1 = new Button("A");
    button1.addActionListener(this);
    add(button1);
    button2 = new Button("B");
    button2.addActionListener(this);
    add(button2);
    taResults = new TextArea(2,30);
    add(taResults);
    // text = new TextField(20);
    // add(text);
    public void actionPerformed(ActionEvent e)
    Object obj = e.getSource();
    if(obj == button1)
    String qryString = "select name from test where letter = A";
    executeQuery();
    if(obj == button2)
    String qryString = "select name from test where letter = B";
    executeQuery();
    public void executeQuery()
    String qryString1 =qryString;
    try
    URL url=new URL("http://localhost:8080/examples/servlet/ReinServlet1");
    String qry=URLEncoder.encode("qry") + "=" +
    URLEncoder.encode(qryString1);
    URLConnection uc=url.openConnection();
    uc.setDoOutput(true);
    uc.setDoInput(true);
    uc.setUseCaches(false);
    uc.setRequestProperty("Content-type",
    "application/x-www-form-urlencoded");
    DataOutputStream dos=new DataOutputStream(uc.getOutputStream());
    dos.writeBytes(qry);
    dos.flush();
    dos.close();
    InputStreamReader in=new InputStreamReader(uc.getInputStream());
    int chr=in.read();
    while(chr != -1)
    taResults.append(String.valueOf((char) chr));
    chr = in.read();
    in.close();
    // br.close();
    catch(MalformedURLException e)
    taResults.setText(e.toString());
    catch(IOException e)
    taResults.setText(e.toString());

    String qryString = "select name from test where letter = A";
    ...this is a local variable ...local to your actionperformed method. The reason the assignment String qryString1 =qryString; doesn't work is because you have no scope to your actionperformed local variables from your executeQuery method. Either make qryString a class variable bty defining it outside any method ...ot, alternatively, pass the string into the executeQuery method.
    if(obj == button1)
      String qryString = "select name from test where letter = A";
      executeQuery(qryString);
    public void executeQuery(String query)
      String qryString1 = query;
    ...As for the sql statement, if you are going to refine the query through the letter column, you will need to pull it into the query when you select...
    ...such as: select name,letter from test where letter = B

Maybe you are looking for

  • Vendor payment and customer recipts across company codes

    Hi all, We are having 4 company codes in US.The vendors and customers are spread across company codes. 1st scenario: Vendor "abc" has a debit balance os 5000 in company code A. In company code B, the same vendor has credit balance of 10000. How can w

  • What is the current magic mouse model number?

    What is the current magic mouse model number?

  • Process Chains with Event Trigger

    Hi Experts, Happy Valentine day. I have a requirement to run a Process Chain using Event IDs. Now these Evenrt ID should be triggered by a Program which raises this Eovent. Then this Program should be scheduled in BAckground to run periodically. Has

  • Is there a way to set of an IPad as a point of sale system in a restaurant

    I am an assistant manager in a restaurant in Juneau Aslaska and I am wondering if there is a way to set up a point of sale system using the Ipad to be able to to run credit cards, print to different printers like one to the bar and one to the kitchen

  • Viewing xsl page in tomcat

    i have a login screen code written in xsl . I copied the file into tomcat 4.1.12 and it doesn't display page design but instead the source code how to enable it to show the page????