Determining the "type" of a SQL statement

I'm using the Oracle thin driver with my JDBC program.
I want to be able to accept a String containing a SQL statement from the user and execute it. If it's a select statement then present the rows returned in a JTable, otherwise retrieve the return value for the command (eg INSERT, DELETE, etc).
Is there any "readymade" method in JDBC or Oracle driver to determine the type of a SQL statement in this sense. Or do I have to parse it myself? (Imagine having to write code to strip comments out etc!)

There is no "readymade" method. But an easy way to check will be to check the first 6 charchters of the string.
You could use
newString = SQL.substring(0, 5); to obtain the first 6 characters.
if the characters are "select"
//do select things
else
// do insert/delete whatever things

Similar Messages

  • How can I determine the type of video out connector I need?

    Howdy,
    I have a white macbook purchased Jun/2008. I want to connect to a TV but don't know what adapter I need. How can I determine the type of video out jack my macbook has?
    System Profiler says the model identifier is "MacBook 4,1". Under Graphics/Displays the only thing it says about the "Display Connector" is that no display is connected. Too bad it doesn't tell me what type of connector it is. If I knew the name of the connector I'd probably be home free. But it seems like every macbook model has a different video connector (since the state of the art has advanced over the years) and I haven't been able to keep up with the names.
    Now, I have a 6" long adapter that will convert this connector to VGA. And searching the Apple store for VGA adapters, the existence of mine says my connector is might be one of "Mini DisplayPort", "Apple Mini DVI", "Apple DVI", or "Apple Micro-DVI". But then there is also the connector at
    http://store.apple.com/us/product/M8639G/A?mco=MTY3ODQ5OTY
    and that looks like the one I have. But unlike the other adapters, this one is just called a "VGA Display Adapter". Does the connector have a name? How can I find adapters that have that same connector?
    I know I could use the adapter I have, plus a VGA to VGA cable, to hook up to a TV. But the quality of the VGA signal is poor in the digital world. My goal is to hook up to the TV via HDMI. Is this even possible? By which I mean, will my macbook generate the signals necessary to be able to be converted to HDMI?
    Thanks for any help,
    Zebulon T

    Thanks, Ded,
    You're right, the cable that I have won't work. I't from my previous, 2004 iBook. This is pretty embarrassing... I looked at the cable but didn't bother to try plugging it in.
    Looking at the close-up picture of the Mini-DVI to VGA adapter, that does look like the right connector. So I have Mini-DVI, and the other apter you pointed to can convert this to DVI. I'll take a look to see what makes the most sense, connector wise, downstream from that.
    Thanks very much.
    Zeb T

  • How to determine the type of an existing iView

    Hi,
    While creating an iView using wizard there is a big list of type of iViews. But after creation of iView, how do I determine the type of iView. Which attribute or property of iView holds this information?
    -Lave Kulshreshtha

    You can copy and paste the existing Iview changing the name and ID if u want to replicate the same.
    Also, when you create a new iView from a template, you get a list of them e.g SAP BSP iView etc.
    Now what you see in the code link is much similar to what you see as a list of templates when u create iViews. So its pretty simple.
    I hope this helped you.

  • How to export the result from executing sql statement to excel file ?

    HI all,
    Great with Oracle SQL Developer, but I have have a trouble as follwing :
    I want to export the result from executing sql statement to excel file . I do easily like that in TOAD ,
    anyone can help me to do that ? Thanks so much
    Sigmasvn

    Hello Sue,
    I just tried to export to excel with the esdev extension and got java.lang.NumberFormatException. I found the workaround at Re: Windows Multi-language env, - how do I set English for application lang?
    open the file sqldeveloper\jdev\bin\sqldeveloper.conf and add the following two lines:
    AddVMOption -Duser.language=en
    AddVMOption -Duser.country=USyet now my date formats in excel are 'american-style' instead of german. For example 01-DEC-01 so excel does not recognize it as date and therefore I can not simply change the format.
    When export to excel will be native to 1.1 perhaps someone can have a look at this 'feature'
    Regards
    Marcus

  • Can the format of a SQL Statement modify the execution time of an SQL ....

    Can the format of a SQL Statement modify the execution time of an SQL statement?
    Thanks in advance

    It depends on:
    1) What oracle version are you using
    2) What do you mean for "format"
    For example: if you're on Oracle9i and changing format means changing the order of the tables in the FROM clause and you're using Rule Based Optimizer then the execution plan and the execution time can be very different...
    Max
    [My Italian Oracle blog|http://oracleitalia.wordpress.com/2009/12/29/estrarre-i-dati-in-formato-xml-da-sql/]

  • Determining the type of a field-symbol

    Hi!
    I want to create a logical expression that determines the type of field-symbol that was passed in to a function.
    i want to do something like this:
    IF imported_fieldsymbol IS OF TYPE some_type
    ENDIF
    how do you create such an expression in ABAP?
    regards

    Hi,
      You can use the RTTS - Run Time Type Service.
      Try the sample code
    TYPES my_type TYPE i.
    DATA: my_data   TYPE my_type,
          descr_ref TYPE ref to cl_abap_typedescr.
    START-OF-SELECTION.
      descr_ref = cl_abap_typedescr=>describe_by_data( my_data ).
    The hierarchy of RTTS classes are as follows,
    CL_ABAP_TYPEDESCR
      |
      |--CL_ABAP_DATADESCR
      |   |
      |   |-- CL_ABAP_ELEMDESCR
      |   |--CL_ABAP_REFDESCR
      |   |--CL_ABAP_COMPLEXDESCR
      |       |
      |       |--CL_ABAP_STRUCTDESCR
      |       |--CL_ABAP_TABLEDESCR
      |
      |--CL_ABAP_OBJECTDESCR
         |
         |--CL_ABAP_CLASSDESCR
         |--CL_ABAP_INTFDESCR
    Regards,
    Mustajab

  • Check the validity of a SQL statement before execution

    Hi everyone,
    In an applet I have created, I am allowing the user to create a SQL statement which will be sent to a servlet that in turn issues the JDBC request for the SQL statement. My concern is that since my GUI lets the user create more or less any kind of SQL statement (including an illegal one) I need to verify if the user has created the correct SQL. How can this be achieved?
    To recapitulate and summarize, I need to know how I can check the validity of a SQL statement without actually executing it and handling the SQLException. FYI, I am using the mm-mysql driver.
    Thanks,
    Alan

    jschell is correct. Unless you're writing something like an ISQL tool you want to be very careful doing this.
    Having said that Mimer SQL have SQL validators that may do what you want http://developer.mimer.com/validator/index.htm
    They've also got the SQL Validator running as a web service that you can use. Theres example code here showing how to use it.
    http://sqlvalidator.mimer.com/index.html
    At the risk of being accused of selfpromotion you can check out the SQL Validator plugin for SQuirreL SQL CLient. This is a fully functional example of using the Mimer SQL Validation web service. http://squirrel-sql.sourceforge.net/
    Col

  • Determine the type of the caught exception

    Hi!
    Here is my problem :
    I'm using a web service and the method I call throws different types of Exception (RemoteException, ServiceException, etc...)
    And, the reaction to the caught exception depends on its type, that's why I need to determine what type of exception i've caught. I know that with C# I use the boolean function is :
    if (exception is TypeOfException1)
        // associated reaction
    else if(exception is TypeOfException2)
       // associated reaction
    }Is there any method or any other way in Java to do that?
    Thanks a lot,
    Gan�che.

    >
    Here is my problem :
    I'm using a web service and the method I call throws different types of Exception (RemoteException, ServiceException, etc...)
    And, the reaction to the caught exception depends on its type, that's why I need to determine what type of exception i've caught. >
    try {
      // stuff that may cause exceptions..
    } catch(RemoteException re) {
      // deal with this re
    } catch(ServiceException se) {
      // deal with this se
    } catch (Throwable didNotExpectThis) {
      // exceptional!
      didNotExpectThis.printStackTrace();
    }

  • How to determine the type of the jobject... similar to instanceof

    hi,
    I would like to know how to determine the jobject reference of an instance is of which class.
    this is something similar to instanceof we use in java.
    is there any thing like 'instanceof' in JNI. if there how to use it?
    i got this as objective question for which answers were(i do not remember exactly)
    1.instanceof
    2.assignedto
    i could nt het much help in googling.
    thanks in advance

    Hi
    The JNI provides a native version to the java instanceof operator, this function takes two arguments
    an object refrence and a class refrence and reports JNI_TRUE.
    jclass myclass = env->FindClass("your class name");
    if(env->IsInstanceOf(obj,myclass) == JNI_TRUE)
    // obj is of type myclass
    }Regards
    pradish

  • How to determine the types of interactive form fields

    Hello:
    I have written a utility that traverses through the objects in a PDF file, and finds the ones of Type "Annot", Subtype "Widget". I need to go one step down the hierarchy and determine which kind of widget (text, radio button, check mark, press button) is the one under scrutiny.
    I have looked at the innards of PDF files, and found that the widgets of type "text" are internally identified by the FT=Tx dictionary entry. So far, so good.
    Here is where the beauty and consistency stops. It turns out that all the other (non-text) types are ambiguously identified by FT=Btn dictionary entry.
    So: Every field which is not text, is a button.
    Where should I look?
    TIA,
    -RFH

    Digging a little deeper, I found that the 4 types of fields (as generated by default) have different keys, as follows:
    Text: [F, FT, MK, P, Rect, Subtype, T, Type]
    Check Box: [AP, AS, F, FT, MK, P, Rect, Subtype, T, Type]
    Radio Button: [AP, AS, BS, F, FT, Ff, MK, P, Rect, Subtype, T, Type]
    Button: [AP, DA, F, FT, Ff, MK, P, Rect, Subtype, T, Type]
    Is that the correct approach to determine the kind of fields, by querying for the keys, which somehow instantiate a fingerprint?
    TIA,
    -RFH

  • Trace is still getting generated even after disabling the profile option Initialization SQL Statement - Custom

    Hi All,
    we have a problem with profile option "Initialization SQL Statement - Custom". we have set this at user level. after some time, we have cleared the profile option value for this user.
    But we can still see the generated trace files are getting updated. we did checked this trc files from path returned from below query.
    select name, value
    from   v$parameter
    where  name like 'user_dump_dest';
    Please help us on how to resolve this issue. we are using Oracle Apps R 12.1.2 version.
    Thanks in advance
    Raghava

    Before logging out we suspect that he closed the browser instead of logout link.
    What if you make the user logout, can you reproduce the issue then?
    We have verified the profile options for this user and found that value is cleared for profile Initialization SQL Statement - Custom.
    How do you know that the files were generated for this user and because of this profile option? Have you verified profile options for all users at all level?
    Thanks,
    Hussein

  • Configuring the appbuilder chart using SQL Statements

    Hi all!
    I am able to create a chart using .mameta
    My Chart is able to read in data and display on a chart successfully.
    What i could not achieve was that the chart doesn't read and display the numbers correctly as shown below.
    It read by ID instead of TOTAL COUNT
    Does anyone knows how to display the count correctly?
    Your replies is much appreciated.

    Hi Satish,
    Modularity per se, i.e. using a function implies a new database object, source control et. al. which is an overhead.
    If we can use an sql statement and handle it in the control file itself, then any future enhancements/bug fixing would involve only modification to the control file, i.e. patching would be easier in this case.
    Thanks for the reply!!!
    Have a nice day!!!

  • Determine the type of video card

    Hi
    How to determine what type of video card I have with command line utilities(not scanpci)?
    SuperProbe, lshw no works on Solaris 10.
    Thanks

    You can try prtconf(1M) . But this will only provide the PCI IDs.

  • Determining the type of sqlexception

    Is is possible to know the type of sql excpetion that occured? For instance if an sqlexception occured I need to know if the error is due to a non-existent table field or a non existent table.
    Basically I need to give the user a more specific desctiption of the error that occured. I can't just say "database error".
    thanks

    put it on a string like
    String ret="";
    try{
    }catch(SQLException sqle){
    ret = sqle.getMessage();
    return ret;

  • Determine the type of connection & set webcam width/height

    Hi, two quick questions:
    1. Is there a way in ActionScript to determine what type of connection is being used (e.g. P2P or FMS)?
    2. Is there a way to set the width/height of the webcam picture? I currently extend the WebcamPublisher class to access the _camera instance and use the Camera.setMode() method, but it looks like that doesn't have any effect whatsoever.
    Thanks in advance,
    Michiel
    PS: I'm aware of the captureWidthHeightFactor method, but I really don't like that approach, as it's not really clear what dimensions are being used for the video. I would like to set the dimensions myself, like when using the Camera.setMode() method.

    Hironmay wrote:
    For you height/width part, you can use resolutionFactor API in webcamPublisher as captureWidthHeight API is deprecated. The default width and height gets multiplied.
    Ok, I'm using resolutionFactor now, but I'm not sure what the difference is. captureWidthHeightFactor is not really documented (it's there, but pretty unexplained), but the resolutionFactor uses multiples of the default width/height. I assume it does the exact same thing? (By the way: the resolutionFactor is not documenten on livedocs, only in the local documentation received as part of the zipped SDK.)
    And still if you want to set your own native width/height , since you are already subclassing WebcamPublisher, just subclass the function createMyStream and add your native width and height. See that function in the player 9 source code of WebcamPublisher provided.
    I'll look into that, for now resolutionFactor will have to do. (For testing purposes all video parameters have to be adjustable on the fly, and I unfortunately am already very short on time.)
    One thing I forgot to mention in last mail, you can only have P2P with player 10 and you need to use player 10 swc for any verification of P2P. Player 9 will be always FMS.
    You may have just saved my life! I was indeed using the player 9 swc, and tried the isP2P property, but didn't get it to work. And since it's not documented I labeled this as "deprecated" and dropped it. Great to see that it really is in there.
    Also, the difference between the player 9 and player 10 swc you just explained answers another question I had (but totally forgot about). When connecting, the console always showed:
    #FMSConnector# Wed Jan 6 10:52:11 GMT+0100 2010 is using RTMPS? true
    This gave me the idea that the P2P service was unavailable. I'm glad to see that this isn't the case.
    Thanks for your rapid replies everyone, I really appreciate it!
    Michiel

Maybe you are looking for

  • Single Sign On and Command line

    Hi! We have application without any logon form which executed from command line by BAT file: app.exe Username Password par1 par2 ... where par1, par2... is parameters of application So question is: can Oracle Single Sign On set user credentials to th

  • How to register the an SAP system in SAP Marketplace?

    Hi Experts, I have installed a new sap system. How do I register that in SAP Marketplace? I followed the OSS note 94998. But couldn't get through. I went ot the following path for registering my system: Data Administration >> System Data >> Create Ne

  • Connect 2 external drives to 1 firewire port?

    MacBook Pro 5 4 Mid-2009 15" has 1 firewire port 1 USB 2.0 port with 2 more USB 2.0 ports on an external monitor I've been running Time Machine on a 500 GB LaCie d2 quadra external drive and need to upgrade, probably to a 3 TB drive. To transfer my b

  • How to create a hyperlink when exporting .pdf?

    Hi guys, I've been doing quite a bit of research on how to make an object into a hyperlink when exporting my .ai as .pdf. So far I've come across guides that show the method of using Object > Slice and the Attributes' Image Map, but none of them seem

  • Aspect ratio correction

    Hello My videos are encoded with a resolution of 640x480, but the aspect ratio must be 16:9, so I need to scale my videos to 848x480. This is my code: var ratioCorrection:LayoutMetadata = new LayoutMetadata(); ratioCorrection.width = 848; ratioCorrec