Issues writing Applescript loop...

Hi,
I am new to using AppleScript and was googling how to use Applescript to open a Terminal session and connect to a remote box using SSH.
This was successful in a single instance, using the script:
tell application "Terminal"
  activate
  do script "ssh [email protected]"
  -- // write some linux commands to remote server
end tell
Then saving it as an application.
As this now works, the issue I have is that I have a list of box's that I need to connect to on a regular basis (i've just moved from a Windows machine where I used putty) and need to create Applescripts, for each one.
I am having trouble in finding out how to use this list (currently a numbers spreadsheet) to create some kind of loop, to create individual files, for each one.
I was thinking about converting it to a csv file and the creating a script that uses the column headers:
IP address
Number
Name
Location
Opens script editor, enters the same script as before, replaces the IP address, saves the script, using the naming convention Number-Name and then putting them into subfolders for each location. However as I said earlier, as I'm new to scripting in AppleScript, I'm finding it hard to trall through all the tutorials and forums for assistance.
Can anyone offer any advice?

Hi,
I am new to using AppleScript and was googling how to use Applescript to open a Terminal session and connect to a remote box using SSH.
This was successful in a single instance, using the script:
tell application "Terminal"
  activate
  do script "ssh [email protected]"
  -- // write some linux commands to remote server
end tell
Then saving it as an application.
As this now works, the issue I have is that I have a list of box's that I need to connect to on a regular basis (i've just moved from a Windows machine where I used putty) and need to create Applescripts, for each one.
I am having trouble in finding out how to use this list (currently a numbers spreadsheet) to create some kind of loop, to create individual files, for each one.
I was thinking about converting it to a csv file and the creating a script that uses the column headers:
IP address
Number
Name
Location
Opens script editor, enters the same script as before, replaces the IP address, saves the script, using the naming convention Number-Name and then putting them into subfolders for each location. However as I said earlier, as I'm new to scripting in AppleScript, I'm finding it hard to trall through all the tutorials and forums for assistance.
Can anyone offer any advice?

Similar Messages

  • I am having an issue writing texts with Siri on iPhone 5 iOS 6.  When I do it just talking to the phone it works fine. However if I speak through the ear pod headphones or Bluetooth headset it only writes about 5 works before trying to send.

    I am having an issue writing texts with Siri on iPhone 5 iOS 6.  When I do it just talking to the phone it works fine. However if I speak through the ear pod headphones or Bluetooth headset it only writes about 5 works before trying to send.
    Does anyone know why this might be?

        Hello APVzW, we absolutely want the best path to resolution. My apologies for multiple attempts of replacing the device. We'd like to verify the order information and see if we can locate the tracking number. Please send a direct message with the order number so we can dive deeper. Here's steps to send a direct message: http://vz.to/1b8XnPy We look forward to hearing from you soon.
    WiltonA_VZW
    VZW Support
    Follow us on twitter @VZWSupport

  • Re indexing issues in Apple Loop Browser (LP 9.0.2 / OSX 10.6.1 / Digi 002r

    I'm trying to re index my loop browser in LP9 / OSX10.6.1
    Are you having the same problem?
    After trashing the 'Apple Loop Index', I pull in a folder from an external drive and notice that previous folders added to my browser have gone, including Jam Packs.
    Also, I can't find the 're-index' option within the loop browser search option (right click brings down a list but the re-index option isn't there)
    Interested to see whet you find.

    Yep, I also had issues, where indexing the LP8 way (dragging folders with loops from the Finder onto the Logic loop browser) just bluffed to work (I dropped the folder on the LB, a progress window appeared, things apparently got done, but then nothing, no new entries in the Loop Browser.
    So it seems that it is a L9 problem, since our Macs' are different in every aspect (Me: PPC- you: Intel, me: Leopard- you: Snow Leopard).
    I finally decided to put all my loops in their default install locations and reindex them from there:
    *Library/Audio/Apple Loops/Apple:*
    Jam Pack 4 - Symphony Orchestra
    Jam Pack Voices
    Jam Pack World Music
    *Library/Audio/Apple Loops/iLife Sound Effects:*
    (13 folders)
    *Library/Audio/Apple Loops/User Loops:*
    (some folders with my own and 3rd party Loops)
    *Library/Application Support/Garageband/Apple Loops:*
    Apple Loops for Garageband
    Jam Pack 3- Rythm Section
    for thorough reindexing, here are the steps:
    1. Quit Logic and/or any other app that uses Apple Loops.
    2. Go to all the locations I pointed out and trash all the index files from the *Apple Loops Index* folders. Also check the same locations in your Users/'you'/Library folder.
    3. Start Logic with a new empty project, open the loop browser window by hitting the o key. Now drag the folders mentioned above in bold onto your loop browser. Logic should now index them correctly, including the foldermenu !http://farm3.static.flickr.com/2743/4085966954bf4fc039d7o.png! in the loop browser.
    regards, Erik.

  • Issue with FOR loop in Nested BEGIN and END terminals

    Hi All,
    I am trying to fetch row by row using FOR loop on CURSOR.An i am getting Error attached screen shot:
    Below is the logic:
    Create Procedure TEST1() LANGUAGE SQLSCRIPT AS
    BEGIN
    AN01 = Select * from AN.View;
    AN02 = SELECT DISTINCT F1,F2,F3 from :AN01 GROUP BY F1,F2,F3;
    BEGIN
    DECLARE CURSOR ITEM_RULE FOR select F1,F2,F3 from :AN02;
    FOR V_ITEM_RULE AS ITEM_RULE DO
    SELECT * from TABLE1 where F1 = V_ITEM_RULE.F1;
    END FOR;
    END;
    END;
    Here i an getting data from AN01..Then finding the Distinct in AN02.
    On AN02 i am applying CURSOR...and for each row i wanted to find an entry in TABLE1 and do a calculation further.
    -- But when i am using a FOR loop in the Nested BEGIN i am getting below Error.
    -- I tried to Activate successful without FOR Loop.
    Any Suggestion on the above issue.
    Thanks
    kalyan

    Hi Kalyan,
    Your procedure is incomplete.
    Why are you looping to make a select that you do not use? What is the target for ITEM_RULE_GDS selection?
    Also, like it is currently exposed a JOIN is highly recommended.
    Are you just playing around with procedure or you really have a scope to do ?
    Regards, Fernando Da Rós

  • Want help in writing a loop count in BI publisher

    I have a table in bi publisher report template and the table rows are generated over a loop of some repeated tags in xml(for-each: <tag> syntax). The requirement is to have the row number 1,2,3... displayed in each row. what is the syntax for it
    I want the detail syntax of writing something similar below:
    <?counter=0?>
    <?for-each:Values?>
    <?counter=counter+1?>
    <?counter?>
    <?end-for-each?>
    Edited by: 936561 on Jun 14, 2012 3:37 AM

    Hello SA,
        I think that it should be:
    Tcode PE02 style
    HRS=D0903
    HRS?M0903
        >
         D0903 is greater (a)
        <
         M0903 is greater (b)    
         They are equal
    In adittion you have to watch out if that will be placed before or after CUMBT, because function CUMBT will cumulate D0903 into M0903
    is that what you were asking?
    Regards,
    Christian.

  • Issues writing varying sample rates to a continuous TDMS

    Hi All,
    I have a VI that uses DAQ.mx to aquire data where I can dynamically change the sampling rate without stopping the program and restarting it.  The aquired data goes to to a queue and then gets written to a TDMS file in a separate VI.  I know the aquisition part of the routine is properly changing the sampling rate, but when I view the TDMS files all of the data has been changed to one sampling rate for the entire file.  Does anyone know what may be causing this and how I might fix it?
    Thanks in advance!

    "How are you changing the sampling rate without stopping the program and restarting it?"
    I have tried changing the sampling rate two ways to see how they differed with system resource load.  Both still leave me with the same TDMS file issue.  
    1) there is a case structure in the aquisition loop and a "low speed"/"high speed" switch.  There is also an "equal to" comparison coming off  and the switch's value from the last loop via shift register.  If I flip the switch true case stops the device, changes the sampling rate through a datamx task property node to high speed or low speed (depending on the boolean, a second case structure inside the first), then starts the tast again at the new rate.  The case then is false until the switch is flipped again.
    2) the loop always samples at high speed and downsamples the waveforms when "low speed" is clicked.
    What sampling rate are you coming from and going to? 
    High Speed = 50kS/second
    Low Speed = 10kS/second

  • Avoiding performance issue due to loop within loop on internal tables

    Hi Experts,
                    I have a requirement where in i want to check whether each of the programs stored in one internal table are called from any of the programs stored in another internal table. In this case i am looping on two internal tables (Loop within a loop) which is causing a major performance issue. Program is running very very slow.
    Can any one advise how to resolve this performance issue so that program runs faster.
    Thanks in advance.
    Regards,
    Chetan.

    Forget the parallel cursur stuff, it is much to complicated for general usage and helps nearly nothing. I will publish a blog in the next days where this is shown in detail.
    Loop on loop is no problem if the inner table is a hashed or sorted table.
    If it must be a standard table, then you must make a bit more effort and faciliate a binary search (read binary search / loop from index exit)
    see here the exact coding Measurements on internal tables: Reads and Loops:
    /people/siegfried.boes/blog/2007/09/12/runtimes-of-reads-and-loops-on-internal-tables
    And don't forget, the other table must not be sorted, the loop reaches anyway every line. The parallel cursor requires both tables to be sorted. The additional sort
    consumes nearly the whole advantage of the parallel cursor compared to the simple but good loop in loop solutions.
    Siegfried

  • Writing applescripts in Windows XP that are executable in OS X

    Hi. I'm working on some software that involves generating scripts on Windows XP for OS X to run.
    Is it possible to create applescript files in Windows XP, and to have them be executable in OS X straight from Windows?
    By executable, I mean that the user can just double-click on the file icon, and have the script run.
    Thanks for any help.
    -Bassam
    Macbook Pro Mac OS X (10.4.6) Recently switched from Windows XP
    Macbook Pro   Mac OS X (10.4.6)   Recently switched from Windows XP

    The thing is that this script will be going out to
    machines that I don't have control over, so I would
    want the script files to be double-clickable as
    delivered, and not require any changing of the
    default handling program.
    I don't think this would normally be an issue. But since it happened to you I understand your concern. Maybe distributing a .command file is not the best solution for your environment.
    Are .command files always associated with the
    Terminal by default?
    As far as I know, yes, .command files are associated with Terminal by default. I'm not sure how your's may have gotten changed. I tried selecting a .command file in Finder and then both "File -> Open with... -> TextEdit" and <Control>-Click -> Open with... TextEdit. In both instances the file opened with TextEdit but it did not change the association to Terminal. Double-clicking the file after editing in TextEdit still launched Terminal.
    On the other hand if you did a Get Info and changed the "Open with:" pop-up then it will change the association for future accesses to the file.
    Steve

  • Applescript looping and error messages

    Evening All,
    I have an applescript (it was an automater script that was then automagically converted to applescript) that does what it is suppose to do except for two small niggles.
    I'm not a programmer at all (the last programming was C# MANY years ago!
    Here is the script:
    -- Click the “In Tray” URL.
    set uiScript to "click static text 1 of UI Element \"In Tray\" of group 23 of UI Element 1 of scroll area 1 of group 3 of window \"OrderWork: Service Partner Work Order Listing\" of application process \"Safari\""
    my doWithTimeout(uiScript)
    -- Click the text “20110403918”
    set uiScript to "click static text 1 of UI Element 1 of row 2 of table 1 of UI Element 1 of scroll area 1 of group 3 of window \"OrderWork: Service Partner Work Order Listing\" of application process \"Safari\""
    my doWithTimeout(uiScript)
    -- Click the text “  Accept”
    set uiScript to "click static text 1 of group 1 of UI Element 58 of UI Element 1 of scroll area 1 of group 3 of window \"OrderWork: Service Partner Work Order Detail\" of application process \"Safari\""
    my doWithTimeout(uiScript)
    -- Click the “ Accept” URL.
    set uiScript to "click static text 1 of UI Element \" Accept\" of group 70 of UI Element 1 of scroll area 1 of group 3 of window \"OrderWork: Work Order Accept\" of application process \"Safari\""
    my doWithTimeout(uiScript)
    -- Click the text “  Finish”
    set uiScript to "click static text 1 of group 1 of UI Element 62 of UI Element 1 of scroll area 1 of group 3 of window \"OrderWork: Work Order Accept\" of application process \"Safari\""
    my doWithTimeout(uiScript)
    -- Main calling script
    on doWithTimeout(uiScript)
              set endDate to (current date) + 2 -- 2 second timeout value
              repeat
                        try
                                  run script "tell application \"System Events\"
    " & uiScript & "
    end tell"
                                  exit repeat
                        on error errorMessage
                                  if ((current date) > endDate) then
                                            error "Can not " & uiScript
                                  end if
                        end try
              end repeat
    end doWithTimeout
    As you can see it is 5 subroutines that are called by the main calling script. What I need help with is...
    1. If a routine faults then an error message is raised and execution stops. If I remove the following lines then it simply hangs as it doesn't know what to do. How can I get it to continue to run after an error condition?
    if ((current date) > endDate) then
      error "Can not " & uiScript
      end if
    2. How can I get the whole thing to continually loop ad infinitum?

    If done that but now I get a syntax error when compiling.
    "Expected "end" but found "on"
    repeat
    -- Click the “In Tray” URL.
    set uiScript to "click static text 1 of UI Element \"In Tray\" of group 23 of UI Element 1 of scroll area 1 of group 3 of window \"OrderWork: Service Partner Work Order Listing\" of application process \"Safari\""
    my doWithTimeout(uiScript)
    -- Click the text “20110403918”
    set uiScript to "click static text 1 of UI Element 1 of row 2 of table 1 of UI Element 1 of scroll area 1 of group 3 of window \"OrderWork: Service Partner Work Order Listing\" of application process \"Safari\""
    my doWithTimeout(uiScript)
    -- Click the text “  Accept”
    set uiScript to "click static text 1 of group 1 of UI Element 58 of UI Element 1 of scroll area 1 of group 3 of window \"OrderWork: Service Partner Work Order Detail\" of application process \"Safari\""
    my doWithTimeout(uiScript)
    -- Click the “ Accept” URL.
    set uiScript to "click static text 1 of UI Element \" Accept\" of group 70 of UI Element 1 of scroll area 1 of group 3 of window \"OrderWork: Work Order Accept\" of application process \"Safari\""
    my doWithTimeout(uiScript)
    -- Click the text “  Finish”
    set uiScript to "click static text 1 of group 1 of UI Element 62 of UI Element 1 of scroll area 1 of group 3 of window \"OrderWork: Work Order Accept\" of application process \"Safari\""
    my doWithTimeout(uiScript)
    -- Main calling script
    on doWithTimeout(uiScript)
              set endDate to (current date) + 2 -- 2 second timeout value
              repeat
                        try
                                  run script "tell application \"System Events\"
    " & uiScript & "
    end tell"
                                  exit repeat
                        on error errorMessage
                                  if ((current date) > endDate) then
                                            exit repeat
                                  end if
                        end try
              end repeat
    end doWithTimeout
    end repeat

  • Issues writing to file with Jython

    Hi all,
    I want to write into a file the message of the previous step.
    We have created a procedure but we get this error below.
    How could we manage the <%=odiRef.getPrevStepLog("MESSAGE")%> in order to be written into the file?
    I guess we would have to replace but don't know what
    org.apache.bsf.BSFException: exception from Jython:
    Traceback (innermost last):
    (no code object) at line 0
    SyntaxError: ('Lexical error at line 6, column 123. Encountered: "\\n" (10), after : ""', ('<string>', 6, 123, "strMessage = '3290 : 42000 : java.sql.SQLException: ORA-03290: Invalid truncate command - missing CLUSTER or TABLE keyword"))
         at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
         at com.sunopsis.dwg.codeinterpretor.k.a(k.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlS.treatTaskTrt(SnpSessTaskSqlS.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.h.y(h.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Unknown Source)
    The description of the error is:
    3290 : 42000 : java.sql.SQLException: ORA-03290: Invalid truncate command - missing CLUSTER or TABLE keyword
    java.sql.SQLException: ORA-03290: Invalid truncate command - missing CLUSTER or TABLE keyword
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:633)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1086)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2984)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3057)
         at com.sunopsis.sql.SnpsQuery.executeUpdate(SnpsQuery.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execStdOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlS.treatTaskTrt(SnpSessTaskSqlS.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.h.y(h.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Unknown Source)
    Thanks

    There is nothing to gain in not putting the throws IOException in the write method, since the exception object will have the information about the actual problem.
    Is this a typo for the this post?                 this.roomsInList.add(huone); should be room nes pas.
    What exception is actually thrown? To find out useSystem.out.println("Exception: " + ioe);Then wonder why you have the AppartmentFileHandler implement Serializable when you are not writing that object to the file.

  • NIO issue - writing to sockets from 2 threads

    Hi All,
    I have some questions regarding a NIO-server i'm developing. I have read many posts relating this issue, but still...
    I have one thread that does the Selector.select() and read & write to the sockets
    I have another thread that uses the same Selector and changes the interestOp to OP_WRITE (then wakes up the Selector).
    I have a Connection (attachment) that i use to hold the inputBuffer and outputBuffer to handle remainings.
    I've read a post in which some ppl wrote the stages of using th OP_WRITE and it was suggested that only when i wanna write i'll add the OP_WRITE and exclude it in the isWritable() - so i'm doing that.
    My questions are:
    1. Is it safe to change the interestOp on a key from another thread?
    2. What happens if the select() is in process?
    3. Are there any other problems with my implementation?
    4. What other way i have to write to a socket from 2 different threads (withough putting a lock on the socket)?
    Thanks.

    Reset your thinking a bit. You should only register for OP_WRITE when you have just executed a 'short write', i.e. a return value > 0 but < the length you asked to write, and you should deregister OP_WRITE any time you execute a 'complete write', i.e. a write which writes everything you asked for. At all other times you should just write and handle your own syncrhonization. The reason is that socket channels are almost always writable except under the condition described so you will just be returning early from select() for nothing.

  • Sorting issue in inner loop not working

    Here is a small example to get a better understanding of the issue we are facing.
    Following is the XML Structure.
    <G_MAIN>
    <CP_ACCT>40010.0</CP_ACCT>
    <G_BATCH>
    <JRNL_EFFECTIVE_DATE>09/01/12</JRNL_EFFECTIVE_DATE>
    <JRNL_EFFECTIVE_DATE>09/03/12</JRNL_EFFECTIVE_DATE>
    </G_BATCH>
    </G_MAIN>
    <G_MAIN>
    <CP_ACCT>40010.0</CP_ACCT>
    <G_BATCH>
    <JRNL_EFFECTIVE_DATE>09/01/12</JRNL_EFFECTIVE_DATE>
    <JRNL_EFFECTIVE_DATE>09/04/12</JRNL_EFFECTIVE_DATE>
    <JRNL_EFFECTIVE_DATE>09/02/12</JRNL_EFFECTIVE_DATE>
    </G_BATCH>
    </G_MAIN>
    We have two G_MAIN groups in the above example.
    Since we need to group based on CP_ACCT value, we have written code on the RTF to achieve this.
    So ideally, data under both the G_BATCH groups (total of 5records) has to be sorted.
    But when sorting, it is sorting each of the G_BATCH groups and printing them.
    As a result of this, this is how the output is shown.
    09/01/12
    09/03/12
    09/01/12
    09/02/12
    09/04/12
    Edited by: user12258588 on Sep 24, 2012 11:34 AM

    Hi,
        In the code lines clear the work areas before evry read statement and and check for sy-subrc after evry read statement.
    and populate ur work areas in to the text that need to be displayed.
    Regards,
    Vijaya Lakshmi.T

  • Servlet with Issues writing to MySQL Database using JNDI

    I'm hung on one servlet for my site. It compiles fine, and is accessed fine by the JSP, but doesn't do as I intended: write my blog entries to the MySQL database!
    As mentioned in the title, I'm using JNDI for connection pooling, via META-INF/context.xml.
    I'm also using JDBC Realm with a form, and that's working just fine, so I'm sure my issue isn't context.xml, as it seems to be overriding Tomcat's context file just fine, at least for authentication.
    Below is the code from the servlet, to include the annotations:
    package projectEgress.web.blog;
    import java.io.*;
    import java.text.*;
    import java.sql.*;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.sql.*;
    public final class blogInput {
         /* bean properties */
        private String blogHeader;
        private String blogSubheader;
        private String blogBody;
        private String externalLinks;
        Connection conn;
        Statement stmt;
            /* getters & setters */
            public String getBlogHeader() {
                return blogHeader;
            public void setBlogHeader(String blogHeader) {
                this.blogHeader = blogHeader;
            public String getBlogSubheader() {
                return blogSubheader;
            public void setBlogSubheader(String blogSubheader) {
                this.blogSubheader = blogSubheader;
            public String getBlogBody() {
                return blogBody;
            public void setBlogBody(String blogBody) {
                this.blogBody = blogBody;
            public String getExternalLinks() {
                return externalLinks;
            public void setExternalLinks(String externalLinks) {
                this.externalLinks = externalLinks;
            /* like it says, a void which writes to the database */
            public void writeToDatabase() {
                /* create the query string to fill the table */
                String query = "insert into blogEntry (blogHeader, blogSubheader, blogBody, externalLinks) values (\"" + this.blogHeader + "\", \"" + this.blogSubheader + "\", \"" + this.blogBody + "\", \""  + this.externalLinks + "\")";
                try {
                    /*establish the datasource and make the connection */
                    Context ctxt =  new InitialContext();
                    DataSource dsrc = (DataSource)ctxt.lookup("java:comp/env/jdbc/projectEgress");
                    conn = dsrc.getConnection();
                    stmt = conn.createStatement();
                    /* Add data to table 'blogEntry' in our database */
                    int input = stmt.executeUpdate(query);
                    /* close the connections */
                    stmt.close();
                    conn.close();
                    /* check for exceptions, ensure connections are closed */
                    } catch (SQLException sqlx) {
                        sqlx.printStackTrace();
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    } finally {
                        if (stmt != null) {
                            try {
                                stmt.close();
                        } catch (SQLException sqlx) {}
                        if (conn != null) {
                            try {
                                conn.close();
                        } catch (SQLException sqlx) {}
            Here are the settings I have in META-INF/context.xml (sans Realm stuff, which works):
    <Context debug="1" reloadable="true">
        <Resource name="jdbc/projectEgress"
            auth="Container"
            type="javax.sql.DataSource"
            username="********"
            password="********"
            driverClassName="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost:3306/projectEgress?autoReconnect=true"
            validationQuery="select 1"
            maxActive="15"
            maxIdle="8"
            removeAbandoned="true"
            removeAbandonedTimeout="120" />
        <WatchedResource>WEB-INF/web.xml</WatchedResource>
        <WatchedResource>META-INF/context.xml</WatchedResource>
    </Context>And, finally, the code I'm using in the JSP which calls the method (the form action is directed to this file's URL):
        <jsp:useBean id="blogInput" class="projectEgress.web.blog.blogInput">
        <jsp:setProperty name="blogInput" property="*" />
            <jsp:scriptlet>blogInput.writeToDatabase();</jsp:scriptlet>
        </jsp:useBean>
        -YES, I know I'm using a scriptlet in a JSP... I really don't want to create a custom tag to call the method, at least not until I'm far along enough in the project to justify creating a library... let's make it all work, first! :o)
    FINALLY, the form:
    <form action="/projectEgress/area51/blogInput" method="post" id="adminForm" enctype="application/x-www-form-urlencoded">
         <div>
            <span class="inputheader">Blog Header</span><br />
          <input type="text" name="blogHeader" size="35" class="form" /><br />
            <span class="inputheader">Blog SubHeader</span><br />
          <input type="text" name="blogSubheader" size="45" class="form" /><br />
            <span class="inputheader">Blog Body</span><br />
          <textarea class="content" name="blogBody" rows="9" cols="60"></textarea><br />
            <span class="inputheader">External Links</span><br />
          <input type="text" name="externalLinks" size="45" class="form" /><br />
          <input type="submit" value="Post!" class="submit" />
         </div>
        </form>As far as I can tell, it should work, and it doesn't throw any errors (in fact it shows the success message rather than the configured error page), but when I check the blogEntry table from the MySQL prompt, it responds with "Empty set".
    I've double checked to ensure that the table columns are present in MySQL and all the naming conventions line up and they do, so I figure it's my servlet that's broken.
    Advice? Ideas?
    Thanks in advance.
    Edited by: -Antonio on Apr 25, 2008 8:03 PM with additional info

    Okay, I changed a few things in the servlet code.
    For one, I'm trying a PreparedStatement in place of Statement. Don't ask me what made me think it would work any better, it just stores the sql query in cache, but I thought I'd just try something else.
    One thing this is allowing me to do is make the connection and statement (now PreparedStatement pStmt) objects local variables. It wouldn't allow me to do so before without giving me compile errors.
    package projectEgress.web.blog;
    import java.io.*;
    import java.text.*;
    import java.sql.*;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.sql.*;
    public final class blogInput {
         /* bean properties */
        private String blogHeader;
        private String blogSubheader;
        private String blogBody;
        private String externalLinks;
            /* getters & setters */
            public String getBlogHeader() {
                return blogHeader;
            public void setBlogHeader(String blogHeader) {
                this.blogHeader = blogHeader;
            public String getBlogSubheader() {
                return blogSubheader;
            public void setBlogSubheader(String blogSubheader) {
                this.blogSubheader = blogSubheader;
            public String getBlogBody() {
                return blogBody;
            public void setBlogBody(String blogBody) {
                this.blogBody = blogBody;
            public String getExternalLinks() {
                return externalLinks;
            public void setExternalLinks(String externalLinks) {
                this.externalLinks = externalLinks;
            /* like it says, a void which writes to the database */
            public synchronized void writeToDatabase() {
                Connection conn = null;
                PreparedStatement pStmt = null;
                /* create the query string to fill the table */
                String Query = "INSERT INTO blogEntry (blogHeader, blogSubheader, blogBody, externalLinks) VALUES (\"" + this.blogHeader + "\", \"" + this.blogSubheader + "\", \"" + this.blogBody + "\", \""  + this.externalLinks + "\")";
                try {
                    /*establish the datasource and make the connection */
                    Context ctxt =  new InitialContext();
                    DataSource dsrc = (DataSource)ctxt.lookup("java:comp/env/jdbc/projectEgress");
                    conn = dsrc.getConnection();
                    pStmt = conn.prepareStatement(Query);
                    /* Add data to table 'blogEntry' in our database */
                    pStmt.executeUpdate();
                    pStmt.clearParameters();
                    /* close the connections */
                    pStmt.close();
                    conn.close();
                    /* check for exceptions, ensure connections are closed */
                    } catch (SQLException sqlx) {
                        sqlx.printStackTrace();
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    } finally {
                        if (pStmt != null) {
                            try {
                                pStmt.close();
                        } catch (SQLException sqlx) {}
                        if (conn != null) {
                            try {
                                conn.close();
                        } catch (SQLException sqlx) {}
    }Someone out there has to have a thought on this.
    Even if it's just something they think probably won't work, so long as it gives me another angle to see this from.

  • Performance Issue of the loop

    I have an ITAB which contains PO header details and another ITAB which has PO Item details. Now  I need to to take this info. in a single ITAB and send it to some FM. Which will be the best  way to do this ?
    When I do,
    Loop at it_header into wa_header.
    wa_new-BUKRS = wa_heaeder-bukrs.
    wa_new-LIFNR = wa_heaeder-LIFNR.
    wa_new-BSTYP = wa_heaeder-BSTYP.
    wa_new-BSAKZ = wa_heaeder-BSAKZ.
    Loop at it_item into wa_item where ebeln = wa_header-ebeln.
    wa_new-werks = wa_item-werks.
    wa_new-MATNR = wa_item-MATNR.
    wa_new-AEDAT = wa_item-AEDAT.
    wa_new-MENGE = wa_item-MENGE.
    wa_new-MEINS = wa_item-MEINS.
    wa_new-IDNLF = wa_item-IDNLF.
    append wa_new to it_new.
    appended = 'X'.
    endloop.
    if appended ne 'X'.
    append wa_new to it_new.
    endif.
    clear wa_new.
    Endloop.
    This code consumes a lot of time since I have a huge amount of data.Could you please suggest  some other method?

    Hi,
    You haven't explained how you are getting the data in the tables.If you only are selecting it , may be you can select the data at a time by using a join into the itab it_new directly.
    If you are getting this data from somewhere else , we cant do anything on the select. In that case you can try using the parallel cursor method.
    Before using this technique , you have to make sure that it_item is a sub table of it_header. That means, all the EBELN's in it_item should be there in it_header  also. Since this is a PO info., I assume that the condition is satisfied.
    Then try this code instead of your Loop.
    Sort it_header by ebeln.
    sort it_item by ebeln.
    LOOP AT IT_HEADER INTO WA_HEADER.
    wa_new-BUKRS = wa_heaeder-bukrs.
    wa_new-LIFNR = wa_heaeder-LIFNR.
    wa_new-BSTYP = wa_heaeder-BSTYP.
    wa_new-BSAKZ = wa_heaeder-BSAKZ.
    LOOP AT IT_ITEM INTO WA_ITEM FROM INDEX.
    IF WA_ITEM-EBELN NE WA_HEADER-EBELN.
    INDEX = SY_TABIX.
    EXIT.     
    ENDIF.
    wa_new-werks = wa_item-werks.
    wa_new-MATNR = wa_item-MATNR.
    wa_new-AEDAT = wa_item-AEDAT.
    wa_new-MENGE = wa_item-MENGE.
    wa_new-MEINS = wa_item-MEINS.
    wa_new-IDNLF = wa_item-IDNLF.
    append wa_new to it_new.
    appended = 'X'.
    ENDLOOP.
    if appended ne 'X'.
    append wa_new to it_new.
    endif.
    ENDLOOP.
    Try this code instead..
    If you get any improvement, pls reward with points....

  • "Up Next" issues in Applescript.

    I have an applescript to play a "playlist"  The script hangs waiting for user input if there is anything on my "up next" list.  How can I clear the "up next" list in an applescript??

    I had this same problem with a script of mine that I use as an alarm. I've fixed it now so maybe you can work out what you need to do from my code:
    set volume output volume 25
    tell application "iTunes"
         launch
         set sound volume to 100
         set the_playlist to user playlist "Alarm"
         set view of front window to the_playlist
         activate
         ignoring application responses
              play the_playlist
              tell application "System Events" to keystroke return
         end ignoring
    end tell

Maybe you are looking for

  • Time Machine backup on Time Capsule - lost

    Hi, I changed the password on my 1 TB Time Capsule, as well as the WPA personal password. I then realized later on that Time Machine no longer connected to the MacBook Pro backup on my TC. I saw a support article about changing the password in Keycha

  • IPhoto 08 gives spinning ball for 2 minutes at launch.

    iPhoto '08 is having trouble starting up on my iMac. When I click the iPhoto icon in my dock, it bounces once and opens the program. All my photos appear. But before I can do anything, the beachball starts spinning. iPhoto locks up and the ball spins

  • Not merging the XML files  in single file using BPM file to file  payload

    Dear All, i am working on BPM N:1 Scenario my design and config looks correct . it is picking the file and appending into my defined  "ContainerList" but in receiver side .i mean Inbound side it is putting the data of one one file with the contents o

  • Expose a BizTalk AS2 internal Endpoint using an Azure bus relay

    Is it possible to set up BizTalk server 2013 on premise behind a firewall with an AS2 endpoint, and use Azure bus relay to externally expose the (internal) AS2 endpoint to the cloud.  This way we don't have to create a DMZ or open anything on our fir

  • Side effects of SP 18

    Hi all, Does anyone know what are the side effects with support package 18 for BI 7.00 Thanks, Joseph M