Does Java support mutliple sql statements in one call?

statment.executeUpdate("DROP DATABASE IF EXISTS diy55;CREATE DATABASE IF NOT EXISTS diy55 DEFAULT CHARACTER SET utf8;GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX,USAGE on diy55.* TO 'diy55'@'localhost' identified by 'diy55';FLUSH PRIVILEGES;");Java seemes doesn't support multiple sql statements in one call, just like PHP mysql_query(), is it?

Then just extend the java.sql.Statement to your own Statement class and write logic which splits the given query at the right places and executes them one by one.
That the mysql_query() already has it built-in wouldn't say that it isn't possible in Java. Comparing with PHP is a bit pointless, it is a completely different language.

Similar Messages

  • Validate form entries: does java support regular expressions?

    i want to validate form entries, does java support regular express like javascript?

    Just recently in 1.4 regex was finally introduced :)
    Take a look at http://developer.java.sun.com/developer/technicalArticles/releases/1.4regex/

  • How does java support the concept of destructor?

    How does java support the concept of destructor?

    @KunalSurana: before you flood the forum with basic questions, do us a favour and read.
    [Sun's basic Java tutorial|http://java.sun.com/docs/books/tutorial/]
    [Sun's New To Java Center|http://java.sun.com/learning/new2java/index.html]
    Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    jGuru
    A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch
    To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    [Yawmarks List|http://forums.devshed.com/java-help-9/resources-for-learning-java-249225.html]
    [The Java Developers Almanac|http://www.amazon.com/exec/obidos/tg/detail/-/0201752808?v=glance]
    [http://javaalmanac.com|http://javaalmanac.com]
    Bruce Eckel's [Thinking in Java(Available online.)|http://mindview.net/Books/DownloadSites]
    Joshua Bloch's [Effective Java|http://www.amazon.co.uk/exec/obidos/Author=Bloch,%20Josh]
    Bert Bates and Kathy Sierra's [Head First Java|http://www.amazon.com/exec/obidos/tg/detail/-/0596004656?v=glance ]
    James Gosling's [The Java Programming Language|http://www.bookpool.com/sm/0321349806]
    Gosling is the creator of Java. It doesn't get much more authoritative than this.
    Joshua Bloch and Neal Gafter [Java Puzzlers.|http://www.javapuzzlers.com/]

  • Multiple Oracle SQL statements in one Add Command

    I am creating a report that needs a bunch of processing(SQL DDL statements) before the final select statement is generated for the report.
    I am connecting to Oracle database however Crystal Report only allows me to give one SQL statement in one Add Command.
    Is there a way to give multiple statements in one "Add Command" for the report ?
    Thanks.

    you can add more than one "Add Command" in the same report, and you can also treat them as views or table, so you can link them to each others and so on
    good luck

  • Does Java support Arabic?

    Hi,
    I am in the process of establishing a financial web application. The application needs to be bilingual, i.e English and Arabic. My Question is: Does Java support Arabic? and which DB can i use with it to facilitate my need?
    Thanks,
    Maha

    I18N web application is an application that can deliver the content according to the locale of the browser.We can build these applications easily by using the tags available as part of JSTL's.
    Check whether Arabic language is supported by java or not.
    request.getLocale() returns java.util.locale object.
    This object contains the details of language code & country code.
    Try out
    Kalpana

  • Does Java Support Signing

    Hello All:
    I want to develop a application which would sign the file that need to be passed through unsecure channel.
    Does Java support the same.
    Regards
    Ritesh

    Dear Sir:
    Thanks for the mail.Well last time I did send you a source code of the Encryption/Decryption of a text file.I want to store the file type of the file in a appropriate way instead of using Encrypting the extension.
    And after the encryption ,I want to modify the application to have the content of the complete file to signed.I would request you to advice me whether the complete file content is signed or just the generated key for encryption.
    Let me hear from you.
    regards
    Ritesh

  • Need help on how to code this SQL statement! (one key has leading zeros)

    Good day, everyone!
    First of all, I apologize if this isn't the best forum.  I thought of putting it in the SAP Oracle database forum, but the messages there seemed to be geared outside of ABAP SELECTs and programming.  Here's my question:
    I would like to join the tables FMIFIIT and AUFK.  The INNER JOIN will be done between FMIFIIT's MEASURE (Funded Program) field, which is char(24), and AUFK's AUFNR (Order Number) field, which is char(12).
    The problem I'm having is this:  All of the values in AUFNR are preceeded by two zeros.  For example, if I have a MEASURE value of '5200000017', the corresponding value in AUFNR is '005200000017'.  Because I have my SQL statement coded to just match the two fields, I obviously get no records returned because, I assume, of those leading zeros.
    Unfortunately, I don't have a lot of experience coding SQL, so I'm not sure how to resolve this.
    Please help!  As always, I will award points to ALL helpful responses!
    Thanks!!
    Dave

    >
    Dave Packard wrote:
    > Good day, everyone!
    > I would like to join the tables FMIFIIT and AUFK.  The INNER JOIN will be done between FMIFIIT's MEASURE (Funded Program) field, which is char(24), and AUFK's AUFNR (Order Number) field, which is char(12).
    >
    > The problem I'm having is this:  All of the values in AUFNR are preceeded by two zeros.  For example, if I have a MEASURE value of '5200000017', the corresponding value in AUFNR is '005200000017'.  Because I have my SQL statement coded to just match the two fields, I obviously get no records returned because, I assume, of those leading zeros.
    > Dave
    You can't do a join like this in SAP's open SQL.  You could do it in real SQL ie EXEC.... ENDEXEC by using SUSBTR to strip off the leading zeros from AUFNR but this would not be a good idea because a)  modifying a column in the WHERE clause will stop any index on that column being used and b) using real SQL rather than open SQL is really not something that should be encouraged for database portability reasons etc. 
    Forget about a database join and do it in two stages; get your AUFK data into an itab, strip off the leading zeros, and then use FAE to get the FMIFIIT data (or do it the other way round). 
    I do hope you've got an index on your FMIFIIT MEASURE field (we don't have one here); otherwise your SELECT could be slow if the table holds a lot of data.

  • What does || do in a SQL statement after a where with a like?

    We have a packaged application that outputs a SQL statement with the || operator in a where clause along with a LIKE. I have never seen it before and expected it to be a syntax error. I do not see any examples of this syntax in sources such as Morgan's Library.
    For example purposes, observe in the 10g Express Edition currently up for download. Observe that the SQL statement "compiles" when the || operator is used before a like statement, but does not "compile" when used on its own - it gives the error I expected that || is not a relational operator. What does this syntax do?
    For orignal context, the relevant portion of the where clause is:
    T1.QUOTE_NUM || :3 || T1.REV_NUM LIKE :4but the below does so just off of what is available in any instance - much easier to reproduce.
      1  select * from v$sqltext
      2* where (hash_value || 3657695316 || sql_text like 'L%')
    SQL> /
    no rows selected
    SQL> edit
    Wrote file afiedt.buf
      1  select * from v$sqltext
      2* where (hash_value || 3657695316)
    SQL> /
    where (hash_value || 3657695316)
    ERROR at line 2:
    ORA-00920: invalid relational operator
    [pre]
    Thanks for your attention and advice.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    I may have answered my own question. It appears that you can use the || to concatenate strings for comparison with a relational operator as in the example below. I've just never seen this before. Can anyone confirm this is what it really does?
    SQL> select count(*) from dual;
      COUNT(*)
             1
    SQL> select count(*) from dual
      2  where '123' = '123';
      COUNT(*)
             1
    SQL> edit
    Wrote file afiedt.buf
      1  select count(*) from dual
      2* where '123' = '124'
    SQL> /
      COUNT(*)
             0
    SQL> edit
    Wrote file afiedt.buf
      1  select count(*) from dual
      2* where '1' || '23' = '123'
    SQL> /
      COUNT(*)
             1
    SQL> edit
    Wrote file afiedt.buf
      1  select count(*) from dual
      2* where '1' || '23' = '124'
    SQL> /
      COUNT(*)
             0

  • Java hibernate on sql statement

    Hi,
    Does anyone know how to execute a plain sql statement using hibernate? In otherwords, I would like to pass in a sql string, and use a hibernate command ( api ) to execute that sql string.
    Thanks a lot.
    cc

    I would like to query all the record form a view, say, allRecord. Here is my mapping file:
    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
    <hibernate-mapping >
    <sql-query name="mySqlQuery">
    <return alias="yr" class="com.org.forms.AllRecordForm"/>
    SELECT *
    FROM AllRecord
    </sql-query></hibernate-mapping>
    Where AllRecordForm is the form for the view AllRecord in the database. Can you tell me where I did wrong? I got Unknown entity: com.org.forms.AllRecordForm error.
    thanks again.

  • Does BOBJ support OR select statement against SAP BW

    Hello,
    We are looking at BOBJ for reporting against SAP BW, and I was wondering if BOBJ supports select OR statements and select AND statements in the same report.
    For example.
    We have three select parameters:
    Company Code
    Document Type
    Vendor
    The business would like to run the following select statements:
    Company Code = 1010 AND
    Document Type = WE OR
    Vendor = 123123
    or from the same query, run the report this way:
    Company Code = 1010 AND
    Document Type = WE AND
    Vendor = 123123
    Is this possible? If yes, what options do we have.

    Hi Bill,
    there are several options to achieve this:
    In the BI Query you have a parameter type that is called "selection option" which allows the end-user to create very complex selection.
    In Crystal Reports you can create your own filter / parameters but you would have to pay attention to make sure that the parameters are being send down to the server.
    in Web Intelligence / a Universe you could do the same like in CR.
    Ingo

  • HELP: Bind Variable does't work in SQL statement

    I am trying to connect a text item bind variable into the where
    clause of an SQL statement. Specifically into an INSERT
    statement and SELECT statement. It gives me an message box
    error, saying it is unable to insert. There is no Oracle error
    number associated with it. Is this a bug? Has this happened to
    anyone else. PLEASE HELP! URGENT!
    null

    I assume this is a forms problem. You need to check out the
    dbms_error_code and dbms_error_text to get your oracle error.
    You can trap and report these types of errors using an on-error
    trigger. Also, if you are using the default menu then check
    out help -> display error immediately after the form reports
    unable to insert ...... This should give you enough information
    to solve your problem, or at least point you in the right
    direction.
    Daniel Jensen (guest) wrote:
    : I am trying to connect a text item bind variable into the where
    : clause of an SQL statement. Specifically into an INSERT
    : statement and SELECT statement. It gives me an message box
    : error, saying it is unable to insert. There is no Oracle error
    : number associated with it. Is this a bug? Has this happened to
    : anyone else. PLEASE HELP! URGENT!
    null

  • SQLEXEC not able to filter extract on sql statement or function call.

    hi all,
    i'm trying to do some basic extract filtering using a stored function and am not having much success.
    i started off using a procedure call but have been unsuccessful getting that working, i've simplified
    it to use a sql statement calling a function for a value to filter on, but cannot even get that to work.
    i've read through the documentation and i cannot figure out what is going wrong.
    any help would be much appreciated.
    thx,
    daniel
    function code is very simple, just trying to get something working.
    FUNCTION f_lookup_offer_id(v_offer_id IN offer.offer_id%TYPE)
    RETURN company.name%TYPE IS
    lv_company_name company.name%TYPE;
    BEGIN
    SELECT c.name
    INTO lv_company_name
    FROM orders a, offer b, company c
    WHERE a.offer_id = b.offer_id
    AND b.company_id = c.company_id
    AND a.order_id = v_order_id;
    RETURN lv_company_name;
    END f_lookup_offer_id ;
    Oracle GoldenGate Command Interpreter for Oracle
    Version 11.1.1.0.0 Build 078
    Solaris, sparc, 64bit (optimized), Oracle 10 on Jul 28 2010 13:26:39
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    EXTRACT EATUOP1
    INCLUDE ./dirprm/GGS_LOGIN.inc
    EXTTRAIL ./dirdat/up
    DISCARDFILE ./dirout/eatuop1.dsc, append , MEGABYTES 50
    DISCARDROLLOVER ON SUNDAY AT 06:00
    -- Database and DDL Options
    -- Added to avoid errors when setting unused columns
    DBOPTIONS ALLOWUNUSEDCOLUMN
    -- Get full row for deletes
    NOCOMPRESSDELETES
    -- Get updates before
    GETUPDATEBEFORES
    -- If commit SCN that is not greater than the highest SCN already processed error
    THREADOPTIONS MAXCOMMITPROPAGATIONDELAY 15000 IOLATENCY 6000
    -- Retains original timestamp. Currently using GMT
    NOTCPSOURCETIMER
    --TABLE DEFS
    TABLE master.OFFER,
    SQLEXEC ( ID ck_offer,
    QUERY " select master.f_lookup_offer_id(:off_id) is_company from dual ",
    PARAMS (off_id = offer_id),
    BEFOREFILTER),
    FILTER (@GETVAL (ck_offer.is_company = "Google, Inc."));
    does not give any errors, but also does not capture any data, it's filtering everything out and trail files are empty, minus a header.
    thoughts or help?
    2012-04-04 22:17:36 INFO OGG-00993 Oracle GoldenGate Capture for Oracle, eatuop1.prm: EXTRACT EATUOP1 started.
    2012-04-04 22:17:36 INFO OGG-01055 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Recovery initialization completed for target file ./dirdat/up000022, at RBA 978.
    2012-04-04 22:17:36 INFO OGG-01478 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Output file ./dirdat/up is using format RELEASE 10.4/11.1.
    2012-04-04 22:17:36 INFO OGG-01026 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Rolling over remote file ./dirdat/up000022.
    2012-04-04 22:17:36 INFO OGG-01053 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Recovery completed for target file ./dirdat/up000023, at RBA 978.
    2012-04-04 22:17:36 INFO OGG-01057 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Recovery completed for all targets.
    2012-04-04 22:17:36 INFO OGG-01517 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Position of first record processed Sequence 13469, RBA 21894160, SCN 1789.722275534, Apr 4, 2012 10:12:40 PM.
    -rw-rw-rw- 1 svc_ggs 502 978 Apr 4 22:17 up000023

    got it working, this seems to be about as simple as i could formulate it. thanks for pointing me in the right direction.
    TABLE GGS_TEST_EXT, &
    SQLEXEC ( ID co_count, &
    QUERY " select f_lookup_company_name(:P1) x from dual ", &
    PARAMS ( P1 = company_id), BEFOREFILTER), &
    FILTER ( @GETVAL (co_count.x = 0) );
    then i have a function that returns 1 or 0, depending on the company id passed in.
    thx,
    daniel

  • Buffer size for SQL statement using JDBC calls

    I need to find out the buffer size for SQL statements in jave/JDBC because I need to insert or update a field that could be up to 4KB in size.

    I'm not sure that I follow the question; I'm not sure which buffer size you're referring to.
    If you have a field that can store up to 4k worth of data, you would create a VARCHAR2(4000) column in the Oracle database (assuming it is character data) or a BLOB column (if the data is binary). Either of those two fields can be populated from JDBC.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Does Java support Digital UNIX?

    Is there a port of the Java SDK to Digital UNIX 4.0? I haven't been able to find the binaries anywhere on Sun's site. Does Sun's 'platform independant' offering only support Solaris, Linux, and Windows??

    Yes, that's correct. But Sun is not the only one writing SDKs. There are Java implementations for several other systems made by other organizations (such as IBM). And 30 seconds with http://www.google.com led me to this link:
    http://www.tru64unix.compaq.com/docs/base_doc/DOCUMENTATION/V40D_HTML/SUPPDOCS/JAVAPAGE.HTM

  • Multiple SQL statement in one step of procedure

    Hi,
    is it possible to run more than one sql command in only one step of a procedure.
    I need to run a script which insert about 2-300 records and i don't want to create 2-300 step.. any suggestions ?
    i tried :
    insert into myTable (myCol, myCol2) values('value1','value2');
    insert into myTable (myCol, myCol2) values('value2','value2');
    insert into myTable (myCol, myCol2) values('value3','value2');
    but it doesn't work!

    Hi,
    Why don't you try to write all your data:
    value1;value2 etc... in a file and create an interface that load this data to your table?
    Any way if you are in Oracle database try the begin end block as it said.
    or write a jython script to do the job.

Maybe you are looking for