Why Oracle9i statement can not add " ; " in java  ?

Hi,
I have a following java programme:
import java.sql.*;
public class Result1 {
public static void main(String args[]) {
Connection con = null;
try {
     Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
System.out.println("JDBC driver loaded");
con = DriverManager.getConnection
("jdbc:oracle:oci:@xxxxxx","xxx","xxx");
System.out.println("Database connection established");
ResultSet rs=null;
String user_id1="user101";
String queryString = ("SELECT * FROM fixed_asset;");
PreparedStatement stmt = con.prepareStatement(queryString);
rs = stmt.executeQuery();
while (rs.next()) {
String s2 = rs.getString("db_id");
System.out.println(s2);
catch (ClassNotFoundException cnfe) {
System.out.println("ClassNotFoundException: Could not locate driver");
} catch (SQLException cnfe) {
System.out.println("SQLException: Could not connect to database");
} catch (Exception e) {
System.out.println
("An unknown error occurred while connecting to database");
} finally {
try {
if (con != null) {
con.close();
} catch(SQLException sqle) {
System.out.println("Unable to close database connection.");
This prog can be compiled, but when it run it show can't not connect to database.
But when i remove the ; in the queryString such that
String queryString = ("SELECT * FROM fixed_asset");
It can complete show the result i want .
Why it can not support ";" and how can i add two execute statements at the same time?
Thx ,
Ricky

When you include the semicolon, the error is generated when you execute the statement and probably indicates an invalid character error. Your error handler is assuming that any SQLException indicates that the program was unable to connect to the database, which is an incorrect assumption. Including a semicolon in a standalone SQL statement is invalid syntax.
In Oracle, you cannot pass a semicolon separated list of SQL statements to the database to be processed. If the statements are related, however, you can use an anonymous PL/SQL block to achieve the same result, i.e.
BEGIN
  <<statement 1>>;
  <<statement 2>>;
  <<statement 3>>;
END;Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC

Similar Messages

  • Trying to print e-mails using iCloud but can not add my printer Epson Stylus Photo PX810FW Why not?r

    Trying to print e-mails using iCloud but can not add my printer Epson Stylus Photo PX810FW
    Why not?

    Trying to print e-mails using iCloud but can not add my printer Epson Stylus Photo PX810FW
    Why not?

  • Can not add a picture to the JFrame from an ActionListener class

    As topic says, I can not add a picture to the JFrame from an ActionListener class which is a class inside the JFrame class.
    I have a Map.java class where I load an image with ImageIcon chosen with JFileChooser.
    I my window class (main class), I have following:
    class OpenImage_Listener implements ActionListener
         public void actionPerformed(ActionEvent e)
              int ans = open.showOpenDialog(MainProgram.this);     // "open" is the JFileChooser reference
              if(ans == open.APPROVE_OPTION)
                   File file = open.getSelectedFile();                    
                   MainProgram.this.add(new Map(file.getName()), BorderLayout.CENTER);     // this line does not work - it does not add the choosen picture on the window,
                            //but if I add the picture outside this listener class and inside the MainProgram constructor, the picture apperas, but then I cannot use the JFileChooser.
                            showMessageDialog(MainProgram.this, fil.getName() ,"It works", INFORMATION_MESSAGE);  // this popup works, and thereby the ActionListener also works.
    }So why can�t I add a picture to the window from the above listener class?

    The SSCCE:
    Ok, I think I solved it with the picture, but now I cannot add new components after adding the picture.
    Look at the comment in the actionlistener class:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class Test extends JFrame{
         JButton b = new JButton("Open");
         JFileChooser jfc = new JFileChooser(System.getProperty("user.dir"));
         Picture pane;
         Test(){
              super("Main Program");
              setLayout(new BorderLayout());
              JPanel north = new JPanel();
              add(north, BorderLayout.NORTH);
              north.add(b);
              b.addActionListener(new Listener());
              setVisible(true);
              setSize(500,500);
              pane = new Picture("");
              add(pane, BorderLayout.CENTER);
         class Listener implements ActionListener {
              public void actionPerformed(ActionEvent e){
                   int ans = jfc.showOpenDialog(Test.this);
                   if(ans == jfc.APPROVE_OPTION)
                        File file = jfc.getSelectedFile();
                        Test.this.add(new Picture(file.getName()), BorderLayout.CENTER);
                        pane.add(new JButton("NEW BUTTON")); // Why does this button not appear on the window???
                        pane.repaint();
                        pane.revalidate();
         public static void main(String[] args)
              Test t = new Test();
    class Picture extends JPanel
         Image pic;
         String filename;
         Picture(String filename)
              setLayout(null);
              this.filename = filename;
              pic = Toolkit.getDefaultToolkit().getImage(filename);
            protected void paintComponent(Graphics g)
                super.paintComponent(g);
                g.drawImage(pic,0,0,getWidth(),getHeight(),this);
                revalidate();
    }

  • Can not add games to iPod touch 4g...

    Can not add games to iPod touch 4g from ITunes (PC) it worked befour new update but why not now..

    I can now transfer apps including games to my ipod from windows pc in Itunes. I click on ipod tab on the left hand side then click on the apps tab then tick the box at the top to sync and now i can drag and drop apps. No apps or music was lost, still all on my ipod touch, but it did mix my apps up so i had to sort them out. I don't know why it did not work, no setting where change, but the update might of change it.

  • Can not add entries to iCloud synced calendar on iphone

    I can not add new entried to my iPhone Calandar that is suposed to sync up to iCloud. (Adding via iCal on MacBook Pro is OK)
    I am also stil not able to just completely delete my iCould account from my iPhone.
    Realy frustrating. Any help appreciated. (Suggestions for a reset  are NOT, as I have been reset my phone at least 50 times over the last few days already)
    Is there a way to completely reset/clear an iCloud account?
    Why does the iPhone insist on trying to contact iCould if I want to remove the account from my phone?
    G.

    the bug seems to be in the handshake between the phone and icloud - i cloud needs to know the phone is off the cloud, but you can't connect to icloud from the phone to tell it, because there is a bug. it appears some people have been able to get decent tech support from apple - I have not.

  • Can not add movie to itune

    Hi,
      I just set up new itunes for ipod touch but i just can not add movie file (mp4) to library in itunes. Please help! Thanks so much!

    Make sure you're looking for it in the Movies or TV Shows libraries, or do a search for it by name.
    Did you check if the format is compatible with iTunes (QuickTime plays more formats if you have add-ons)?
    "but when I open that file with itunes"
    This statement confuses me as your point 1/ says you can't find it in iTunes.

  • My computer crashed. So does this mean I can not add any more music to my ipod from a different computer without all the songs being erased? Can I sync my ipod to a new computer if I allow all the songs to be erased?

    My computer crashed. So does this mean I can not add any more music to my ipod from a different computer without all the songs being erased? The ipod works fine and now i got a new computer. So it seems like my only options are leaving my ipod in a state where i cant add anymore songs or erasing all my songs and trying to use my ipod from my new computer. Can someone please inform me on how to have my ipod work from a different computer, even if i have to erase my songs. Thanks.

    Yes, if you choose the Erase and Sync option (or restore your iPod) you will be allowed to sync your iPod with the new computer.
    If you would like to save the content that's currently on your iPod, see this older thread from another forum member Zevoneer discussing the different ways to copy the content on an iPod back to your PC.
    https://discussions.apple.com/thread/2417169?start=0&tstart=0
    B-rock

  • Can I add a JAVA sneak preview to my installed ABAP trial version

    Hello experts,
    I have installed the ABAP sneak preview 7.01 and I need to install an SLD to it so i can register my ABAP stack to another SLD.
    As i know i have to install the JAVA stack first before intalling SLD, it that right?
    Is that possible to add a JAVA stack to my ABAP trial version? i can not find a JAVA sneak preview download in SDN..
    Thanks a lot!
    Best regards, Charlie

    Hi Charlie,
    It does say that you shouldn't have another SAP system installed but you can definately install two systems without a problem.
    Sapinst should do it for you but make sure that you have different instance numbers and ports selected  during the start of the install.
    Gingle explains the process well here:
    /people/glen.spalding/blog/2010/06/20/the-full-monty--part-9--the-ce2-install
    Cheers
    Phillip

  • Can not add new printer

    I reset my printer list on my mother's MacBook and tried to add a new printer. There are no printers to add in the Add Printer list. I ran Repair Disk Permissions and still I can not add any printers through the System Preferences>Print & Fax. Why are there no printers to select?

    Try reinstalling the printer drivers (software) that came with the printer or go to the printer manufacture web site and download the drivers there.

  • Why the ejb can not pass the complie?

    I just use the work shop to create a simple ejb(SampleEJB.ejb) like:
    package SampleEJB;
    import javax.ejb.*;
    import weblogic.ejb.*;
    * @ejbgen:session
    * ejb-name = "Sample"
    * @ejbgen:jndi-name
    * remote = "ejb.SampleRemoteHome"
    * @ejbgen:file-generation remote-class = "true" remote-class-name = "Sample"
    remote-home = "true" remote-home-name = "SampleHome" local-class = "false" local-class-name
    = "SampleLocal" local-home = "false" local-home-name = "SampleLocalHome"
    public class SampleEJB
    extends GenericSessionBean
    implements SessionBean
    public void ejbCreate() {
    // Your code here
    * @ejbgen:remote-method
    public void Hello(){
              System.out.println("Hello");
    * @ejbgen:remote-method
    public void Hello2(){
              System.out.println("Hello2");
    but when i build it. The compiler give me error:
    ¾¯¸æ: SampleEJB.java:14: ÕÒ²»µ½ JNDI Ãû³Æ¡£
    [Info:] Creating D:\DOCUME~1\Yong\LOCALS~1\Temp\/wlw_SampleEJB_build\SampleEJB\SampleHome.java
    [Info:] Creating D:\DOCUME~1\Yong\LOCALS~1\Temp\/wlw_SampleEJB_build\SampleEJB\Sample.java
    [Info:] Creating D:\DOCUME~1\Yong\LOCALS~1\Temp\/wlw_SampleEJB_build\META-INF\ejb-jar.xml
    [Info:] null [Bean] MAKE CLASS NAME G:SampleHome P:SampleEJB N:SampleHome
    [Info:] null [Bean] MAKE CLASS NAME G:Sample P:SampleEJB N:Sample
    [Info:] Creating D:\DOCUME~1\Yong\LOCALS~1\Temp\/wlw_SampleEJB_build\META-INF\weblogic-ejb-jar.xml
    [Info:] Creating D:\DOCUME~1\Yong\LOCALS~1\Temp\/wlw_SampleEJB_build\ejbgen-build.xml
    SourceLoader roots: 10
    post-ejbgen:
    ¾¯¸æ: EJBGen ok. Compiling...
    Compiling 3 source files to D:\DOCUME~1\Yong\LOCALS~1\Temp\wlw_SampleEJB_build
    ¾¯¸æ: All files compiled. Running ejbc...
    <2004-5-3 ÏÂÎç16ʱ20·Ö17Ãë CST> <Warning> <EJB> <BEA-010212> <The EJB 'Sample(Jar:
    D:\DOCUME~1\Yong\LOCALS~1\Temp\wlw_SampleEJB_build)' contains at least one method
    without an explicit transaction attribute setting. The default transaction attribute
    of Supports will be used for the following methods: remote[Hello2(), Hello()]
    >
    SourceLoader roots: 60
    D:\DOCUME~1\Yong\LOCALS~1\Temp\wlw_SampleEJB_build\SampleEJB\Sample_vngkt3_HomeImpl.java:13:
    cannot resolve symbol
    symbol : class SampleHome
    location: class SampleEJB.SampleEJB
    implements SampleEJB.SampleHome, weblogic.utils.PlatformConstants
    ^
    D:\DOCUME~1\Yong\LOCALS~1\Temp\wlw_SampleEJB_build\SampleEJB\Sample_vngkt3_HomeImpl.java:69:
    cannot resolve symbol
    symbol : class Sample
    location: class SampleEJB.SampleEJB
    public SampleEJB.Sample create ()
    ^
    D:\DOCUME~1\Yong\LOCALS~1\Temp\wlw_SampleEJB_build\SampleEJB\Sample_vngkt3_EOImpl.java:15:
    cannot resolve symbol
    symbol : class Sample
    location: class SampleEJB.SampleEJB
    implements SampleEJB.Sample, weblogic.utils.PlatformConstants
    ^
    D:\DOCUME~1\Yong\LOCALS~1\Temp\wlw_SampleEJB_build\SampleEJB\Sample_vngkt3_HomeImpl.java:73:
    cannot resolve symbol
    symbol : class Sample
    location: class SampleEJB.SampleEJB
    return (SampleEJB.Sample) super.create(md_ejbCreate);
    ^
    4 errors
    ´íÎó: ERROR: Error from ejbc: Compiler failed executable.exec
    ´íÎó: ERROR: ejbc couldn't invoke compiler
    BUILD FAILED
    ´íÎó: ERROR: Error from ejbc: Compiler failed executable.exec
    ´íÎó: ERROR: ejbc couldn't invoke compiler
    Why? who can give me a hand

    I met the same problem. I am a newbie, but why weblogic even can not build a simple startup ejb project?

  • Why my spotlight can not find my personal files ? It can find them before but can not find them now,I want to know why?

    why my spotlight can not find my personal files ? It can find them before but can not find them now,I want to know why?

    From the menu bar, select
     ▹ System Preferences ▹ Spotlight ▹ Privacy
    The list of items excluded from Spotlight indexing is shown (it may be empty.) Click the plus (“+”) icon to add an item to the list. Select your boot volume (under DEVICES) and add it to the list. Then remove it from the list by selecting it and clicking the minus (“-“) icon.
    Spotlight will rebuild the index. If you try to do a Spotlight search now from the magnifying-glass icon in the top right corner of the display, a pulsing dot will appear in the icon. When the dot disappears, the indexing is complete.

  • Can not add IPS devices to IME 7.0.1, 7.0.2, 7.0.3 or 7.1.1

    Hi!
    On a new XP SP3 machine with Java 1.6.0.27, I can not add any IPS devices (AIP-SSM-20). I can log in on them with ssh or ASDM.
    I always get this error:
    "Error response from IME Server - IOException: Read Time Out. IME IME Server is not responding. Please check if it is running"
    IME Server service is running (IMEServer.exe and IMEJava.exe process are running on the PC). Trying to restart services it hungs on "Stoping" ... have to kill both process with taskkill and then, restart the Cisco IPS Manager Express service. MySQL-IME servies is up and running
    I tried with IME 7.0.1, 7.0.2, 7.0.3 and 7.1.1 with same result.
    NO firewall on PC, full access allowed on ASA, PC-ASA-IPS are on the same subnet/VLAN
    Tried to re-create the IPS certificates, same error.
    On Java properties, Direct Connection option on Network configuration is selected.
    Any idea what's wrong or what I can try to get IME working?
    Thanks

    In most cases I have encountered exhibiting this behavior, IME is being affected (denied/blocked/conflicting/stopped/etc.) by a HIPS software product installed on the system. If you are able to identify such a product, then try temporarily disabling/removing it and testing again. Some antivirus products can cause this type of behavior as well (including some level of basic HIPS functionality), so you may find that to be the culprit.
    If you are unable to identify the cause, test on a clean OS install (not an existing pre-made image or IT-created image that includes modifications/domain membership/packages/etc.); a completely clean OS install with IME 7.1.1.

  • Can not add new program unit in form

    We have a form developed using developer 6i in which we can not add new program units. If new program unit is added and form is saved and closed then after opening the form again, newly added program unit can not be seen in object navigator as well as it can not be found using search. Such form fails to compile as the calls for new program unit exists but the program unit is lost. The problem persists even if another copy of form is made using Save As option.
    What could be the reason of this problem?
    Thanks

    Hmmm... I have never had the problem. Two forms I have been working on lately are 1808 KB and 1424 KB. This is their compiled-and-saved size. Their "cleaned up" size is 792 KB and 604 KB.
    <p>Do you know about the semicolon - semicolon replacement trick for reducing fmb size? Read this thread:
    <br>    Re: FMB size shrinks dramatically
    <br>And a related thread:
        Re: Why does this happen - find ';', replace with ';'?
    <p>I sure wish Forms had a Preferences setting labelled:     Remove compiled code when saving.

  • Can not add more contacts on address book

    Hello
    i have a blackberry curve 8520.
    at the momment i have 288 contacts but i can not add more. I go to menu, address book, new contact, the window give me the options, i add the information (name, phone, email, etc) and when i want to save the contact it do not save
    i tried to reboot removing the battery for a minute and restart but still with the same problem.
    Also i figured out that when y sync my bb with the desktop manager, the address book is not sync it says (Adress book not installed) that is why i can not swipe the contacts to reinstall the info because i have no back up of the address book
    Please i need some help with this issues
    thanks
    Solved!
    Go to Solution.

    While there is no hard limit on how many contacts you can have in your device, there is a soft limit in that you can only have as many as your device memory can handle. Check your available memory to see if you have any remaining space. If not, then consider cleaning out/uninstalling some things you do not need in order to increase available memory for more contacts.
    Disclaimer: I'm just a regular user like the rest of you. I have spent a lot of time learning the limitations of the Blackberries to know how to fix most problems. If I have suggested a fix, please give a kudo and mark as a solution!

  • Can not add function to pages-document created with Applescript

    If I create new document using the GUI (New document) I can place the cursor within any table-cell, type "=" (equal sign) and f.e. "2+2" which will result in a cell showing a "4".
    If I create a document with Applescript, I can not add new functions (neither by typing = nor by using Insert >> Function (may be different, I have German version here). Already existing functions (which already were in the template) can still be used and work as expected but can not be altered.
    Any idea?
    I use Pages '08, Version 3.03
    Code I used to create the document:
    tell application "Pages"
    launch
    make new document at front with properties {template name:templateName}
    # Angebotsnummer ins Dokument schreiben
    tell body text of front document
    make new paragraph at after paragraph 1 with data angebotsNr
    set paragraph style of paragraph 2 to "Überschrift"
    end tell
    # Datei abspeichern
    set dateiName to missing value
    repeat until dateiName is not equal to missing value
    set dateiName to text returned of (display dialog "Datei Name:" default answer angebotsNr & "_" & kundenName) as text
    end repeat
    save front document in angebotsOrdner & dateiName
    end tell

    I apologize but the given script can't run.
    The variable templateName is undefined.
    The variable angebotsNr is undefined too.
    About the described behavior, it's a bug which I never discover before.
    It's always striking in Pages '09.
    Here is the report which I filed :
    Bug ID# 8704270
    Summary:
    +Odd behavior of tables in Pages documents created by a script+
    +Steps to Reproduce:+
    +Run this huge script+
    +tell application "Pages"+
    +make new document at front with properties {template name:"Blank"} (* "Vierge" on French systems *)+
    +end tell+
    +Insert a table+
    +try to insert a formula+
    +Expected Results:+
    +I assumed that I will get the formula editor which I get when the document is created by hand+
    +Actual Results:+
    +There is no way to get the editor, no way to insert the equal character.+
    +This odd behavior strike in all versions of Pages '09 and Pages '08+
    Regression:
    +None to my knowledge+
    Yvan KOENIG (VALLAURIS, France) dimanche 28 novembre 2010 11:30:29

Maybe you are looking for