PreparedStatement: pure interest

Hi
Latelly I was making some investigations... When writing queries I always use PreparedStatement class to arm ones, because I know it's more secure, and it's an effective protection against SQL injection. Therefore I was wondering how the "final" query looks like in the moment of execution.
The most simple answer maybe would be that the setString() function for ex. for the case:
SELECT * FROM TABLE WHERE USER=?
stmt.setString(1, user)
user = " ' or 1=1 -- " //or something like that, SQL injection is SQL injection =)
would convert its parameter using escape to:
" \' or 1=1 \-- " - or something like that. But it looks too simple to me, so here lies my doubt.
I suppose I'd be happy just taking a look at the soursce code of the PreparedStatement.setString() function for ex., or the final query itself.
I looked for various sourcecodes in the network and didn't find any. Maybe that's a little bit lamish but if it is here somewhere it's pretty hidden from users.

Why don't you take a look at this:
http://www.javaworld.com/javaworld/jw-01-2002/jw-0125-overpower.html
Awesome, that's exactly what I needed. Thanks a lot to all. =)
2StuDerby: mmm, right now I'm writing for Oracle mostly and things are not so differenet there from MySQL. I have done many tests, trying things from SQL injection (with/without) proxy to bruteforsing the fields. PreparedSatetment rulez.

Similar Messages

  • PreparedStatement.setTimestamp does not allo use of DATE index..

    (...although they' re not suposed be related)
    Hi;
    I use Oracle 10g with Java JDBC driver ojdbc14.jar and I have a PreparedStatement on which among other "bind" JDBC parameters I have a java.util.Date. The ORM that we use (Hibernate 2.0.3) passes this Date instance as a java.sql.Timestamp binding it with setTimestamp on the PreparedStatement.
    Interestingly enaugh, this way of binding the value does not make the database use the date column index, although the explain available from TOAD / Session browse, for instance, tells me the planner first demands an index scan there (it is possible i think that explain only operates on prepared SQL alone, disregarding value initial types and values). Doing a preparedStatement.setDate(value) instead, passing a java.sql.Date, uses the index and probably fully respects the Explain Plan that I have seen.
    I assure you I have done many tests, with exact same query, parameter types and values, session origination and environment and changing one thing at a time. The only thing that being changed enables the query to make use of the DATE column index and return under a second, compared to tens of seconds of full table scan with expensive function calls, is to replace the preparedStatement.setTimestamp with setDate.
    This can only be a JDBC bug, as far as I can tell. Do you know of this problem? What may be the cause?
    As a note, since I need to continue to use that version of Hibernate on that spot, I momentarily worked around this apparent bug by modifying the SQL WHERE clause in order to provide the DATE value as to_date function output from a String bind, so doing date_col = to_date('YYYY-MM-DD', :value) instead of date_col = :value. Works fain, but just a work around.
    Looking forward for your answer and suggestions,
    Nicu Marasoiu

    A few remarks:
    - Toad explain plans can be frought by implicit data type conversions.
    Generally speaking everything is treated as a varchar2.
    - You would need to show the plan from v$sql_plan.
    - It would be a JDBC bug if you can show 'correct' behavior from sql*plus, making sure you actually do use bind variables of the correct type (so VARIABLE foo date prior to running the SQL, the SELECT referencing :foo)
    - In the past I have observed strange CBO behavior because the date wasn't a complete date (ie time was missing). This can be rectified by function based indexes.
    - You probably can enable event 10053 in your JDBC session, or event 10046 level 12
    Sybrand Bakker
    Senior Oracle DBA

  • Help needed in GarbageCollection,not running as expectd CMSInitiatingOccupa

    We are using weblogic 9.22 and Java 5 with below server parameters
    SERVER_JAVA_OPTIONS="-Dweblogic.Debug=weblogic.JTAJDBC,weblogic.JTA2PC,weblogic.JTAXA,weblogicJTAResourceHealth -Dweblogic.Debug=weblogic.ejb20.cmp.rdbms.verbose,weblogic.ejb20.cml.rdbms.debug -Ddebug.methodNames=true -Ddebug.lineNumber=true"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -Dweblogic.webservice.client.ssl.trustedcertfile=${SERVER_WEBLOGIC_HOME}/server/lib/trusted.crt"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -Djava.protocol.handler.pkgs=weblogic.webservice.client"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -Dweblogic.webservice.client.ssl.strictcertchecking=false"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -Dweblogic.security.SSL.enforceConstraints=false"
    #SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -Djavax.net.ssl.trustStore=/apps/opt/weblogic/config/cabpool/some_keystore"
    #SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -Dssl.debug=true"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -Dweblogic.webservice.verbose=false"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -XX:+UseConcMarkSweepGC"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -XX:+UseParNewGC"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -XX:+CMSParallelRemarkEnabled"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -XX:CMSInitiatingOccupancyFraction=60"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -XX:+UseCMSInitiatingOccupancyOnly"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -XX:ParallelGCThreads=8"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -XX:PermSize=512m"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -XX:MaxPermSize=512m -d64 -Xss512k"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -XX:NewSize=192m"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -XX:MaxNewSize=192m"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -XX:+PrintGCDetails"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -XX:+PrintGCTimeStamps"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -Dcom.sun.management.jmxremote.port=8885"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -Dcom.sun.management.jmxremote.ssl=false"
    SERVER_JAVA_OPTIONS="${SERVER_JAVA_OPTIONS} -Dcom.sun.management.jmxremote.authenticate=false"
    Heap Size is 4GB
    According to CMSInitiatingOccupancyFraction=60 , GC should work when reaching 60% of the memory. But that's not happening instead memory consumption goes above 4GB then GC works and memory comes down to 500MB ,during this our GUI screen hangs for few seconds.
    Could somebody please help me in this ?

    I'm not as familiar with tuning the hotspot VM as i would like to be so the following may well be things you have already tried. If i had an extract from the GC logs that would probably help me visualize what is happening under the covers.
    With CMSInitiatingOccupancyFraction=60, a Major GC will kick in when more than 60% of the tenured generation size is in use. Based on your description that appears to be the case here, if you set this to the default (92% iirc) does this help any with the pause or is it basically the same?
    You may want to take a look at http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html (the "Starting a Concurrent Collection Cycle" section).
    This could be one of those cases where the heap is just too big (probably not if you have 8 cores working through it) or it could be that you have in-flight threads that need to be brought to a safe point prior to processing and your CPU is pinned (what was CPU looking like before/during/after the GC cycle?) see:- http://mail.openjdk.java.net/pipermail/hotspot-gc-use/2011-August/000915.html
    It might be worth investigating the use of UseCMSInitiatingOccupancyOnly (consider not using it see if that helps) http://docs.oracle.com/cd/E19543-01/820-2962/Performance_Tuning.html#wp1265817
    Out of pure interest (for background) what is it you are doing in your GUI that is so memory intensive?

  • Xfce without xorg?

    Hi guys
    A couple of times I read, that xfce can be run without X, but simply on a framebuffer (maybe even without? but I want my widescreen resolution, which I get with radeonfb, that's no problem). But there was never an explanation, howto or link to a way how to make this possible. The ${search eingine} doesn't want to give me any kind of information. But I really would love to just see it I'm not quite sure, if it is usable or stable or whatever, but I just want to see it.
    So, does anybody know, how to do this or does anybody have a link to a howto, which I might have missed on my research?
    Thanx for any idea!
    Army

    It's not like I really want use it for every day's work, this is pure interest If I really wanted pure minimalism, I wouldn't use XFCE
    edit: I was rethinking about this and did some research with this new keyword gtkfb and seems like these messages of people running XFCE on framebuffer are really old, so this might have been the way, but nowadays it's no longer possible with gtk2.
    But if there's somebody out there with an idea of another method or so, feel free to tell me
    Last edited by Army (2008-11-14 13:05:20)

  • Calling java method from outside of JNIExport Function

    Is it possible? From pure interest I created a dll which creates a c++ win32 API window. However i've ran into a problem, some code:
    C implementation.
    #include <jni.h>
    #include "HelloWorld.h"
    #include <stdio.h>
    #include <windows.h>
    #define APPNAME "test"
    #define VERSION "1"
    #define AUTHOR  "tester"
    HWND hWindow;     // main window
    HINSTANCE hInstance;
    LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
         switch (message)
              case WM_CREATE:
                   break;
              case WM_DESTROY:
                   printf("Destroying Window...");
                   PostQuitMessage(0);
                   break;
              default:
                   return DefWindowProc(hWnd, message, wParam, lParam);
         return 0;
    JNIEXPORT jstring JNICALL Java_HelloWorld_displayHelloWorld(JNIEnv *env, jobject obj)
             MSG msg;
         //HWND isRunning;
         WNDCLASSEX wcex;
         char class_name[20];
         char window_title[50];
         sprintf(class_name,"%s_win",APPNAME);
         sprintf(window_title,"%s %s by %s",APPNAME,VERSION,AUTHOR);
         //isRunning = FindWindow(class_name,window_title);
         wcex.cbSize = sizeof(WNDCLASSEX);
         wcex.style               = CS_HREDRAW | CS_VREDRAW;
         wcex.lpfnWndProc     = (WNDPROC)WndProc;
         wcex.cbClsExtra          = 0;
         wcex.cbWndExtra          = 0;
         wcex.hInstance          = hInstance;
         wcex.hIcon               = NULL;
         wcex.hCursor          = LoadCursor(NULL,IDC_ARROW);
         wcex.hbrBackground     = (HBRUSH)COLOR_APPWORKSPACE;
         wcex.lpszMenuName     = NULL;
         wcex.lpszClassName     = class_name;
         wcex.hIconSm          = NULL;
         RegisterClassEx(&wcex);
         hWindow = CreateWindowEx(0,class_name, window_title,
                        WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN|WS_CLIPSIBLINGS,
                        CW_USEDEFAULT, CW_USEDEFAULT,
                        CW_USEDEFAULT, CW_USEDEFAULT,
                        NULL, NULL, hInstance, NULL);
         ShowWindow(hWindow,SW_SHOWNORMAL);
         UpdateWindow(hWindow);
         while (GetMessage(&msg, NULL, 0, 0))
              TranslateMessage(&msg);
              DispatchMessage(&msg);
         return msg.wParam;
    }Java Implementation:
    import java.io.*;
    class HelloWorld {
        public native String displayHelloWorld();
        public String destroyWindow()
             return "Destroying Window...";
        static {
            System.loadLibrary("HelloWorldImp");
        public static void main(String[] args) {
            System.out.println("Creating Window...");
            new HelloWorld().displayHelloWorld();
    }Basically I want to call the java function destroyWindow() at case WM_DESTROY: in the LRESULT CALLBACK. I created a global reference and tried calling the function but received a javavm error I believe. Need a little help :)

    Callbacks are not only possible but easy to implement as well.
    Look at this thread I started on the subject (Title is misleading but the content is there)
    http://forum.java.sun.com/thread.jsp?forum=52&thread=151693

  • Set array instance to Interface datatype

    <prelude>This is an odd question with no real significance to me, other than pure interest...</prelude>
    Suppose the following...just for example
    Integer[] arrInteger = new Integer[5];I understand that the following is legal..
    Interface i = arrComp;...provided that the Interface is either Cloneable, or Serializable.
    Why is this legal....Are arrays always serializable as defined in the language spec...
    If arrays are Cloneable, shouldn't they override the method "clone" from the Object class..and how do they do that, there are no classes for arrays....Or maybe they just "do" as a feature of being an array...
    It just seems odd that it is possible to set an array, any array to a Cloneable or Serializable interface.

    I've done what I probably should have done before I posted, I've consulted the Java Language Specification ( http://java.sun.com/docs/books/jls/ )and there I've found my answer..
    From the section Conversion and Promotions....
    Assignment of a value of compile-time reference type S (source) to a variable of compile-time reference type T (target) is checked as follows:
    If S is an array type SC[], that is, any array of components of type SC:
    If T is an interface type, then a compile-time error occurs unless T is
    the type java.io.Serializable or the type Cloneable, the only interfaces implmented by arrays.
    So it looks like arrays implement these interfaces and that is why this assignment is legal. I just didn't realize that.

  • Calculating values from row to row with pure sql?

    Hello,
    I'm searching for a way to calculate values from row to row with pure sql. I need to create an amortisation table. How should it work:
    Known values at start: (they can be derived with an ordinary sql-statement)
    - redemption amount RA
    - number of payment terms NT
    - annuity P (is constant in every month)
    - interest rate IR
    What has to be calculated:
    First row:
    RA1 = RA - P
    Z1 = (RA1 * (IR/100/12))
    T1 = P - Z1
    2nd row
    RA2 = RA1 - T1
    Z2 = (RA2 * (IR/100/12))
    T2 = P - Z2
    and so on until NT has reached.
    It should look like
    NT
    P
    Tn
    Zn
    RAn
    1
    372,17
    262,9
    109,27
    22224,83
    2
    372,17
    264,19
    107,98
    21961,93
    3
    372,17
    265,49
    106,68
    21697,74
    4
    372,17
    266,8
    105,38
    21432,25
    5
    372,17
    268,11
    104,06
    21165,45
    6
    372,17
    269,43
    102,75
    20897,34
    7
    372,17
    270,75
    101,42
    20627,91
    8
    372,17
    272,09
    100,09
    20357,16
    9
    372,17
    273,42
    98,75
    20085,07
    10
    372,17
    274,77
    97,41
    19811,65
    11
    372,17
    276,12
    96,06
    19536,88
    12
    372,17
    277,48
    94,7
    19260,76
    13
    372,17
    278,84
    93,33
    18983,28
    14
    372,17
    280,21
    91,96
    18704,44
    15
    372,17
    281,59
    90,59
    18424,23
    16
    372,17
    282,97
    89,2
    18142,64
    17
    372,17
    284,36
    87,81
    17859,67
    18
    372,17
    285,76
    86,41
    17575,31
    19
    372,17
    287,17
    85,01
    17289,55
    20
    372,17
    288,58
    83,59
    17002,38
    21
    372,17
    290
    82,18
    16713,8
    22
    372,17
    291,42
    80,75
    16423,8
    23
    372,17
    292,86
    79,32
    16132,38
    24
    372,17
    294,3
    77,88
    15839,52
    25
    372,17
    295,74
    76,43
    15545,22
    26
    372,17
    297,2
    74,98
    15249,48
    27
    372,17
    298,66
    73,52
    14952,28
    28
    372,17
    300,13
    72,05
    14653,62
    29
    372,17
    301,6
    70,57
    14353,49
    30
    372,17
    303,09
    69,09
    14051,89
    31
    372,17
    304,58
    67,6
    13748,8
    32
    372,17
    306,07
    66,1
    13444,22
    33
    372,17
    307,58
    64,6
    13138,15
    34
    372,17
    309,09
    63,08
    12830,57
    35
    372,17
    310,61
    61,56
    12521,48
    36
    372,17
    312,14
    60,04
    12210,87
    37
    372,17
    313,67
    58,5
    11898,73
    38
    372,17
    315,21
    56,96
    11585,06
    39
    372,17
    316,76
    55,41
    11269,85
    40
    372,17
    318,32
    53,85
    10953,09
    41
    372,17
    319,89
    52,29
    10634,77
    42
    372,17
    321,46
    50,71
    10314,88
    43
    372,17
    323,04
    49,13
    9993,42
    44
    372,17
    324,63
    47,55
    9670,38
    45
    372,17
    326,22
    45,95
    9345,75
    46
    372,17
    327,83
    44,35
    9019,53
    47
    372,17
    329,44
    42,73
    8691,7
    48
    372,17
    331,06
    41,11
    8362,26
    I would appreciate every help and idea to solve the problem solely with sql.
    Thanks and regards
    Carsten

    It's using Model Clause and / or Recursive With (sometimes maybe both)
    Regards
    Etbin
    with
    rec_proc(nt,i,ra,p,ir,z,t) as
    (select nt,i,ra - p,p,ir,round((ra - p) * 0.01 * ir / 12,2),p - round((ra - p) * 0.01 * ir / 12,2)
       from (select 48 nt,22597 ra,372.17 p,5.9 ir,0 z,0 t,1 i
               from dual
    union all
    select nt,i + 1,ra - t,p,ir,round((ra - t) * 0.01 * ir / 12,2),p - round((ra - t) * 0.01 * ir / 12,2)
       from rec_proc
      where i < nt
    select * from rec_proc
    try to adjust initial values and rounding please
    NT
    I
    RA
    P
    IR
    Z
    T
    48
    1
    22224.83
    372.17
    5.9
    109.27
    262.9
    48
    2
    21961.93
    372.17
    5.9
    107.98
    264.19
    48
    3
    21697.74
    372.17
    5.9
    106.68
    265.49
    48
    4
    21432.25
    372.17
    5.9
    105.38
    266.79
    48
    5
    21165.46
    372.17
    5.9
    104.06
    268.11
    48
    6
    20897.35
    372.17
    5.9
    102.75
    269.42
    48
    7
    20627.93
    372.17
    5.9
    101.42
    270.75
    48
    8
    20357.18
    372.17
    5.9
    100.09
    272.08
    48
    9
    20085.1
    372.17
    5.9
    98.75
    273.42
    48
    10
    19811.68
    372.17
    5.9
    97.41
    274.76
    48
    11
    19536.92
    372.17
    5.9
    96.06
    276.11
    48
    12
    19260.81
    372.17
    5.9
    94.7
    277.47
    48
    13
    18983.34
    372.17
    5.9
    93.33
    278.84
    48
    14
    18704.5
    372.17
    5.9
    91.96
    280.21
    48
    15
    18424.29
    372.17
    5.9
    90.59
    281.58
    48
    16
    18142.71
    372.17
    5.9
    89.2
    282.97
    48
    17
    17859.74
    372.17
    5.9
    87.81
    284.36
    48
    18
    17575.38
    372.17
    5.9
    86.41
    285.76
    48
    19
    17289.62
    372.17
    5.9
    85.01
    287.16
    48
    20
    17002.46
    372.17
    5.9
    83.6
    288.57
    48
    21
    16713.89
    372.17
    5.9
    82.18
    289.99
    48
    22
    16423.9
    372.17
    5.9
    80.75
    291.42
    48
    23
    16132.48
    372.17
    5.9
    79.32
    292.85
    48
    24
    15839.63
    372.17
    5.9
    77.88
    294.29
    48
    25
    15545.34
    372.17
    5.9
    76.43
    295.74
    48
    26
    15249.6
    372.17
    5.9
    74.98
    297.19
    48
    27
    14952.41
    372.17
    5.9
    73.52
    298.65
    48
    28
    14653.76
    372.17
    5.9
    72.05
    300.12
    48
    29
    14353.64
    372.17
    5.9
    70.57
    301.6
    48
    30

  • Slow performance of PreparedStatement

    I am having difficulty with extremely slow performance or a relatively simply Microsoft SQL Server 2000 call from my Java applet. Most of the application runs fine, but there are certain parts that are repeatedly giving me a long delay before completing their execution. The code is as follows:
    // Create the try block for the execution of the SQL code
            try{
                // Create the command to be executed
                String command = new String( "select Description, Enabled " );
                command += "from tLineInfo where( Line = ? )";
                // Create the SQL text to be executed
                PreparedStatement get = _connection.prepareStatement( command );
                get.setInt( 1, lineNo );
                // Execute the SQL command
                ResultSet lineInfo = get.executeQuery();
                // Display the information accordingly
                if( lineInfo.next() ){
                    // Populate the user data fields
                    description.setText( lineInfo.getString( "Description" ) );
                          <! more display code here >
    }   // End of if statment
                else{
                    // Clear the user data fields
                    description.setText( " " );
                           <! more display code here >
                }   // End of else statements
                // Close the result set in preparation for the next query
                lineInfo.close();
            }   // End of try block
            catch( Exception e ){
                // Display a dialog box informing the user of the problem
                Object[] options = { "     OK     " };
                JOptionPane.showOptionDialog( null, e.getMessage(),
                        "Error",
                        JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE,
                        null, options, options[ 0 ] ); 
            }   // End of Exception catch
            // Get the related area information
            populateAreaCombo( lineNo );       
    private void populateAreaCombo( int lineNo ){
            // Format the areaComboBox
             try{
                // Create a command to get the devices from the database
                String command = new String( "select Area, [Name], [Description] " );
                command += "from tAreas where( Line = ? )";
                // Create the SQL statement to grab the information, and
                // populate the search parameter
                PreparedStatement getAreas =
                        _connection.prepareStatement( command );
                getAreas.setInt( 1, lineNo );
                // Execute the command
                ResultSet areas = getAreas.executeQuery();
                // Loop through the result set, and add collect the areas
                Vector< String > controlAreas = new Vector();
                while( areas.next() ){
                    // Add the area to the comboBox
                    controlAreas.add( Integer.toString( areas.getInt( "Area" ) ) +
                            " - " + areas.getString( "Name" ) + ": " +
                            areas.getString( "Description" ) );
                }   // End of while loop
                      <! more display code here >
                    The application always seem to pause at the second PrepraredStatement call:
    PreparedStatement getAreas =
                        _connection.prepareStatement( command );This seems to be a very simple operation, and it is not even the execution of the query where the long delay is realized. Rather, it is in the actual creation of the object prior to the execution.
    The delay is very repeatable at this exact statement each time.
    Additionally, of interest, is that the delay is only realized on computers remotely connected to the database. If I run this code on the localhost, then there is no delay. As soon as I distribute it, then the delay is incurred. That being said, there is not a network related issue that I can identify here. I have even isolated the server to be on the network with just one other PC, and the delay still persisted.
    Does anyone have any ideas?
    Thanks

    I can determine where the delay occurs by adding
    dialog boxes at a bunch of different steps, then
    monitoring them for when they appear; a little
    archaic, of course, but an easy way to find this
    out.You should
    1. Get the start time
    2. Get the current time at each step.
    3. Print the results at the end.
    4. Repeat a number of times to average.
    >
    When you say that I should not mix database code with
    display code... What exactly do you mean? To be
    more precise in my description, I was simply setting
    a bunch of different text fields and/or check boxes,
    etc., based on the result set returned. It was not
    as if I was creating a portion of the GUI there or
    something. I am assuming that is an allowable
    practice...
    You should have a class that does nothing but the database work. That class should be used by other classes (like classes that do GUI.)
    I have made little effort to close my resources, and
    sometimes they are not closed at all. When you say
    "resources", what exactly do you mean by that? Are
    you referring to the result sets, for example? I do
    not know of other resources that need to be closed,
    except for the connection to the DB itself. This, I
    have as persistent throughout the duration of the
    user's session.
    You must close result sets, statements and connections. They must be closed in that order.
    I am not running this code on the Internet, but it
    has been designed to be run on a small corporate
    network ( < 10 users). This is why I opted for the
    applet to run the entire application through instead
    of doing more HTML work.That is ok.

  • STO returns with EWM Error "Posting with reference to pur. order only possi

    Hi Experts,
    We are trying to STO returns GR (161 Movement) with transaction MIGO for a EWM managed plant.
    Plant A is a EWM managed plant and Plant B is IM managed plant.
    We created a stock transfer order with "B" as supplying plant for plant "A" but with "Returns" tick in the item. (Document type UB)
    In the first step, when we try to post 161 movement with MIGO transaction, we are getting the below error
    "Posting with reference to pur. order only possible for integrated whse"
    Message no. L9510
    But the same scenario works between two IM managed plants.
    Can you please help me in resolving the issue
    Gobinathan  G

    Hi All,
    I am interested in the tail end of this process. I have activated DWM. We have received an Idoc confirming the Inbound Delivery for a Purchase Order Receipt.
    The Goods Movement Status of the Inbound delivery has changed to C but there is only a Confirmation of Service in the document flow and the Purchase Order is not receipted.
    I am unable to MIGO the PO manually.
    I guess the Inbound delivery should have posted a receipt on the PO but not sure what is missing?
    Any ideas?
    Thanks
    Lee

  • Weblogic JTA timeout and PreparedStatement cache problem (Closed Statement)

    Hello,
    I am facing up a problem using a Weblogic connection pool with a PreparedStatement.
    Here is the environement :
    - Weblogic application server 10.3
    - JDBC connection pool with Oracle Thin driver (from server library) - all parameters by default i.e. StatementCache size = 10
    - JTA transaction timeout = 30s
    The problem is : if a prepared statement ends because of a JTA timeout, I receive the following stack exception/ stack trace
    java.sql.SQLException: The transaction is no longer active - status: 'Rolling Back. [Reason=weblogic.transaction.internal.TimedOutException: Transaction timed out after 33 seconds
    BEA1-000D8AE7230EFAA3EDC9]'. No further JDBC access is allowed within this transaction.
    at weblogic.jdbc.wrapper.JTSConnection.checkIfRolledBack(JTSConnection.java:178)
    at weblogic.jdbc.wrapper.JTSConnection.checkConnection(JTSConnection.java:188)
    at weblogic.jdbc.wrapper.Connection.preInvocationHandler(Connection.java:92)
    at weblogic.jdbc.wrapper.Connection.clearCachedStatement(Connection.java:814)
    at weblogic.jdbc.wrapper.PreparedStatement.clearCachedStatement(PreparedStatement.java:1357)
    and then, if we try to re-execute immediately the same operation (*same statement* but new request, new thread, new JTA transaction ...) we receive without delay the following exception :
    java.sql.SQLException: Closed Statement
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:403)
    It seems like a bug in the caching mechanism of Weblogic, the 1st stack trace shows method from the statement cache implementation, I presume weblogic is trying the clear the statement from the cache after the iniitial TimedOutException (SQLException), but as the JDBC connection is unusable at this point, the clearing fails and the statement remains in the cache but is physically closed by JDBC.
    1st question, why weblogic does need to call JTSConnection.checkConnection() for clearing a statement from its internal cache, it is a pure java memory operation isnt'it ?
    2nd question : How to solve the problem without setting the StatementCache size to 0 (I tried, it solves the problem)? I don't want to disable completely the Weblogic statement caching, I have a small PreparedStatement called very frequently.
    Thanks for any help

    The main issue is that the transactional context that is supposed to underlay the JDBC code being executed,
    has gone away. Indeed, any DBMS changes that may have been made by your code so far, have been rolled
    back and are gone. Your code should not be trying to continue JDBC as normal, and WebLogic is trying to stop
    you. The control flow should go back up to the location where the transaction was initiated, so as to restart from
    the beginning if that is what is desired, including getting a new JDBC connection and remaking all the statements
    etc.
    HTH,
    Joe
    Edited by: Joe Weinstein on Dec 3, 2010 9:12 AM

  • Rc.d script in AUR for each daemon of interest?

    Hello everyone,
    first let me apologize if this has been asked before, but I couldn't find it with google and the forums search.
    What would you guys (especially the devs) think of creating an additional AUR package for every daemon of interest with an -rcd suffix, that just contains an rc.d script?
    For example:
    cups -> cups-rcd
    openssh -> openssh-rcd
    These could then pull the regular package, so users who prefer the rc.d scripts may use the following command to get the official package and also get rc.d scripts:
    $favoriteAurHelper -S cups-rcd openssh-rcd
    Positive notes:
    - We could use the already existing AUR infrastructure with all its nice features: everyone could submit an rc.d script for their favorite daemon(s), post comments with improvements/suggestions/..,
    - We could use the existing AUR tools to install those packages
    - It would not be necessary to repackage every daemon
    Negative:
    - The AUR would get a lot of new packages all over sudden
    - Arch dev team might not like it (which is totally fine for me)
    - No pure systemd-free Arch Linux system (but who has the time for that anyway?)
    I am not saying that I have the time to get at least one box running without systemd and actually use those rc.d scripts, it's just a question that I have on my mind. And even if no one likes the idea, at least there would be a thread about it and others could read up on it.
    Please do not abuse this thread to share your opinion on init systems and why any of them should be better than the others, do this on your personal blog.
    Last edited by robotanarchy (2013-05-20 23:33:17)

    Trilby wrote:There is no need for dev approval, and asking them to do it is ... I can't find just the right word for this sentence, I don't think it's *bad* per-se, but odd.
    Well I thought it was a good idea to ask/discuss it, because it wouldn't be just a few packages and systemd alternatives seem to be sort of a sensitive topic currently.
    karol wrote:Why not create one package with all the daemons?
    graysky wrote:Why not start a collection of scripts in github like falconindy did for systemd way back when?  One package, many scripts, easy.
    It's easier to keep track of the changes (actually read the new rc.d scripts) and maybe easier to maintain. You could also downgrade/change single rc.d scripts in case one is broken rather than downgrading them all.
    Last edited by robotanarchy (2013-05-21 00:12:34)

  • BCG Brightness Contrast Gamma - Looking for BCG function returning color table / lookup table coded in pure G and applicable to Intensity Graph or Picture Control

    Looking for BCG function returning color table / lookup table coded in
    pure G and applicable to 8-bit Intensity Graph or Picture Control. Do
    not want to use IMAQ Vision is this particular application.  Any
    help is appreciated.
    Sincerely,
    Don

    Take a look at this color model software I put together.  (Don't concern yourself much with the basic programming at this point.). The color component generator subVI is borrowed from a LabVIEW example.
    First look at test_color2.vi.  If you adjust the sliders of the various controls, you will see how it works.  You can see that for pure B&W images, brightness, contrast, and gamma (which I think I have coded correctly) are all fairly straightforward to modify.
    Now look at test_color3.vi.  Here we try to adjust BCG for color images using the color model shown here where current color component clusters are carried into the BCG event cases via shift registers.  You can see that once color is introduced into the image, it becomes difficult to mix the colorizing with the BCG model.  And this is pretty much where I am right now.
    Would be interested in comments / suggestions.
    Sincerely,
    Don
    Attachments:
    test_color2.llb ‏2251 KB

  • Binding multiple values for a clause in a PreparedStatement

    Is there a way to bind multiple values for the same variable?
    Example: select * from catalog where catnum = ?
    and cat_num can be 12340-56, 23451-21 43211-00 etc.
    so the where condition really is:
    catnum in ('12340-56', '23451-21', '43211-00')
    Thanks for a lead!

    I've not been able to do this in a way I'd call clean. You might think you could do something like:// create a PreparedStatment with
    // the following String: select * from catalog where catnum in (?)"
    ps.setString(1, "'12340-56', '23451-21', '43211-00'");But the driver tends to escape the stuff you want to go "straight in" to your where clause. So I end up using Statement and building the SQL manually.
    I'd be interested in anyone else's solution
    Lee

  • Java PreparedStatement error

    I have this statement:
    pstmt.setDouble(2, (double) 9000000000);
    where pstmt is PreparedStatement
    when I compile I got this error:
    SaveFocus2aCommand.java:666: integer number too large: 9000000000
    pstmt.setDouble(2, (double) 9000000000);
    ^
    1 error
    Does any one know what happens and how to solve this problem ? Thanks

    timhuy wrote:
    First, it is not generally considered a good idea to handle money as a double.I can make change to long easily
    Second, this is the case where you do cast it.Cast does not help either
    Third - read the exception. The database, not java, is telling you that you can't do that. Probably because the field is too small.
    This is close. I purposely embeded 9 billions as long (with the L), and the compile was OK. But the run time generated error again.
    I manually inserted 9 billiions into the table and it is OK. .
    So I guess, the problem is my client JDBC always look for integer although I the parameter is long or double.Well that statement is phrased badly or just wrong.
    You are calling setDouble() so it is using a double. There is no other possibility.
    My field is numeric(12) or double precisionThat specific field doesn't really look like a double to me. It looks like a integer with 12 digits.
    Certainly won't work for any money field either since there is no fractional part. And I could certainly see a JDBC driver interpreting that as an integer, and in that case it would refuse to convert a double to it. The double that you are passing in.
    Now if it was numeric(12,2) or numeric(14,2) then that would be more interesting.
    The fact that you used a GUI database tool to do something doesn't mean much because the tool is not the database itself.

  • AD RMS Prelicensing Agent on Exchange side. Pure prelicensing testing.

    Hello everybody!
    My SCOM server reports about prelicensing issue, and it's time for me to understand what is this actually. Now it is clear that Exchange server acquire Use License on behalf of end-user at the middle of delivering way. So, end-user don't really need anymore
    to contact RMS server to acquire Use Licence, it was ebeded to email. Also clear that this feature is active as soon as I activated InternalLicensing. 
    I did Test-IRMConfiguration -Sender xxxx -Recipient xxxx and commandlet said that prelicense succesfully was acquired from licensing servers for Recipient. So, from servers point of view everything works perfect. 
    Correct me if I wrong, but as I understood, prelicensing feature allows repicient to open IRM protected content (email and attachment) even being offline.
    Non-autoritative Prove . For my understanding "offline" means that end-user (recipient) has no
    access to URLs of RMS servers. It is actually easily done in test environment by modifying hosts file and loop RMS URLs to 127.0.0.1. 
    So, I sent from User1 to User2 email with attachment and protected it with custom RMS template. 
    User2 has no access to RMS server (RMS activation was done before, CLC, RAC - everything in a folder). User2 opens Outlook, and when it tries to open protected email, system says that it require to reach RMS server to acquire Use License to open protected
    content. Hey, but what about prelicensing? 
    User1 sends to User2 email with attachment and ptorects them with "Do not forward" template. User2 can open content even being offline. To tell the truth this mystery case with "Do not forward" template is out of scope of my interest,
    since this template is not going to be a part of production deployment. 
    What do I do wrong? Does anybody test RMS pure prelicensing feature? 
    Thanks. 

    Hi,
    I have some progress in my testing: prelicensing works for message body and attachment(s).
    But here I'd like to admit several importan things: 
    1. Prelicensing works only in case if Author uses template with unchecked box
    "Require a new license every time content is consumed (disable client-side caching)". 
    2. Prelicensing works only if "Don't Forward" template in use, or any
    custom template from
    Root Cluster (but not from Licensing Only cluster). 
    3. I couldn't reproduce your case when you can open message body, but can't open protected attachment. 
    Answers: 
    1. Get-RMSTemplate commandlet brings template
    from Root Cluster only (+Don't Forward), but nothint from Licensing only cluster. Do you have the same results? Looks like Exchange knows nothing about Licensing Only cluster. Is it true, it is by design?
    2. Test-IRMConfiguration works good. I set -Sender and
    -Recipient parametrs. 
    Acquiring Prelicense for '<recipient@>' from RMS Licensing Uri (https://<rms_root_cluster_URL>/_wmcs/licensing) ...
        - PASS: Prelicense acquired.
    OVERALL RESULT: PASS
    As you see RMS Root cluster was in use during the test , but nothing about licensing only cluster.
    What happens when Sender sends email which protected within template from  Licensing Only cluster? Prelicensing Agent MUST reach Licensing only cluster URL to obtain valid EUL. The test above doesn't cover this case.
    Test-IRMconfiguration confirms actually the same what I had got within tests: prelicensing works in case of using template from Root Cluster. 
    Do I need to do some extra tricks to force Exchange "see" licensing only cluster (templates)?
    So, does prelicensing work for custom templates from Licensing Only cluster? Should these templates from Licensing only cluster be enumerated by using Get-RMStemplate? 
    Profile Signature?

Maybe you are looking for