The bug with JNI function RegisterNatives in Java 1.6

JDK 1.6 has problems with implementation of native methods in the class that loaded at runtime. I found it after making debug version of JVM.DLL.
I have JNI code that
- loads at runtime a new class with native methods;
- implements these methods with RegisterNatives();
- gets Field and Constructor IDs (at this time JVM cleans all finction pointers in Methods Table of the class);
- creates the object of this class and passes it to Java code for callbacks.
When Java calls my native methods I get the exception: "java.lang.UnsatisfiedLinkError", the naive method was not implemented.
I did workaround in my JNI code:
- load the class;
- get Field and Constructor IDs;
- implement methods with RegisterNatives();
- create the object of this class and pass it to Java code for callbacks.
This version of my code runs fine.

What I do with Java? I am developing
- .NET JNI SDK (like regular JNI SDK for C++) for
integration .NET and SUN/IBM Java codes,
- technology of integrating Java applications with
other programming platforms without knowledge of Java
Application sources,
- automation of JNI programming in C++ and .NET,
- tools for conversion AWT based applications to
SWING, etc.
Beside Java projects I develop projects with
Databases, OLAP, WEB in .NET, C++, VB6, etc.
That is why I have no much time to focus in SUN Java.Yes and I am busy too.
That had nothing to do with my post however.
I suggested that if your sole or primary critieria for langauge selection is whether the language forums have company representatives then you should choose .Net rather than java.
Myself the forum support is never even a minor factor in language selection.

Similar Messages

  • JDBC 8.1.6.0.1 Bug with grouping function

    Hi,
    I found a bug in the JDBC 8.1.6.0.1 driver, concerning the new grouping functionality of Oracle 8.1.6. Look at the following code fragment:
    String cSelect = "SELECT DACO_VU_NAME AS DIM1, ' ' AS DIM2, TO_CHAR(DACO_VERKAUFSDATUM,'yyyymm') AS DIM_DATE, GROUPING(DACO_VU_NAME) AS DIM1GROUP, GROUPING(' ') AS DIM2GROUP, GROUPING(TO_CHAR(DACO_VERKAUFSDATUM,'yyyymm')) AS DIM_DATEGROUP, sum(DACO_BRUTTOBETRAG_TX) AS VALUE FROM DATENCONTAINER GROUP BY CUBE (DACO_VU_NAME, '-', TO_CHAR(DACO_VERKAUFSDATUM,'yyyymm') ) ORDER BY 1,2,3";
    try {
    System.out.println("SELECT: " + cSelect);
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery(cSelect);
    while (rset.next()) {
    String cTest1 = rset.getString("DIM1");
    String cTest2 = rset.getString("DIM2");
    String cTest3 = rset.getString("DIM_DATE");
    String cChar1 = rset.getString("DIM1GROUP");
    String cChar2 = rset.getString("DIM2GROUP");
    String cChar3 = rset.getString("DIM_DATEGROUP");
    System.out.println(cTest1 + "\t" + cTest2 + "\t" + cTest3 + "\t" + cChar1 + "\t" + cChar2 + "\t" + cChar3);
    }When I compile this with the mentioned JDBC version and run it with java 1.2.2 (JDeveloper 3.1), i get the following output:
    Ahrend GmbH & Co. KG 200003 0 0 0
    Ahrend GmbH & Co. KG 200003 1 0 0
    Ahrend GmbH & Co. KG 200004 0 0 0
    Ahrend GmbH & Co. KG 200004 1 0 0
    Ahrend GmbH & Co. KG null 0 0 1
    Ahrend GmbH & Co. KG null 1 0 1
    null 200003 0 1 0
    null 200003 1 1 0
    null 200004 0 1 0
    null 200004 1 1 0
    null null 0 1 1
    null null 1 1 1As you can see, the grouping columns are mixed up. In this example, everywhere a normal row shows a "null" value, a corresponding grouping row should show a "1", but as you can see, for the last 6 rows, the ones are not in the first, but in the second grouping row.
    When I compile the example with the Oracle 8.1.5 JDBC driver, I get the following, correct, output:
    Ahrend GmbH & Co. KG 200003 0 0 0
    Ahrend GmbH & Co. KG 200004 0 0 0
    Ahrend GmbH & Co. KG null 0 0 1
    Ahrend GmbH & Co. KG 200003 0 1 0
    Ahrend GmbH & Co. KG 200004 0 1 0
    Ahrend GmbH & Co. KG null 0 1 1
    null 200003 1 0 0
    null 200004 1 0 0
    null null 1 0 1
    null 200003 1 1 0
    null 200004 1 1 0
    null null 1 1 1The special thing about this example is, that I use a constant row for grouping (row 2). If you use a normal database row, everything works fine with 8.1.6.0.1, but nevertheless, this should be a bug.
    Any comments on this are highly appreciated, since I need the JDK 1.2 for the application and I didn't find a working Oracle 1.2 JDBC version.
    Thanks,
    Thorsten.

    Patches can be obtained from an Oracle Support Services technical analyst.
    null

  • Help calling JNI function from a java thread

    I am using the following code to call a JNI fuction from a java thread:
    public class CMSMessageHandler extends MessageHandler{
    static{
    System.loadLibrary("jastb");
    public native int cmsReadIt(ByteBuffer buff);
    private ByteBuffer dirbuf = null;
    /** Creates a new instance of CMSMessageHandler */
    public CMSMessageHandler() {
    // allocate to max size datagram
    dirbuf = ByteBuffer.allocateDirect(65536);
    public void readMessages(){
    /*Thread worker = new Thread(){
    public void run(){*/
    int count;
    while (true){
    try{
    count = cmsReadIt(dirbuf);
    } catch (Exception e){
    e.printStackTrace();
    worker.start();*/
    public static void main(String[] args) {
    CMSMessageHandler handler = new CMSMessageHandler();
    handler.readMessages();
    When I run this main method with the thread commented out, it works great. When I run the main method with the thread, it works great for a while, and then funny things start happening with the native library I am using. My native library uses shared memory, signals, and semaphores. It feels a bit like my java program is stomping on the resources that my native library is using, when a run the java program with a thread.
    Is there something I don't know about calling native code from a thread? Should I be doing something explicitly to protect my native library's shared memory, signals, or semaphores?
    Thanks,
    Lisa.

    Does the library do any initialization when loaded? Does it make a dangerous assumption that the thead calling cmdReadIt will always be the same thread that initially loaded it? Try loading the library in the worker thread instead of in the main thread via the static initializer.Yes. There is a call to another native method cmsOpenIt that does CMS initialization. I put cmsOpenIt as well as the System.loadLibrary("jastb") in the worker thread and I'm still experiencing the same problems.
    Incidently, the mere presence of another Thread in this program does not seem to cause problems. It's only when I run calls to cmsReadIt in a thread that I get into trouble.
    For example, this works fine:
    public class CMSMessageHandler extends MessageHandler{
        public native int cmsReadIt(ByteBuffer buff);
        public ByteBuffer dirbuf = null;
        static {
            System.loadLibrary("jastb");
        public CMSMessageHandler() {
            // allocate to max size datagram
            dirbuf = ByteBuffer.allocateDirect(65536);
        public void readMessages(){
            try{
                int count = 0;
                while (true){
                    count = cmsReadIt(dirbuf);
            } catch (Exception e){
        public static void main(String[] args) {
            CMSMessageHandler handler = new CMSMessageHandler();
            Thread worker = new Thread(){
                public void run(){
                    while (true){
                        try{
                            Thread.currentThread().sleep(1000);
                            System.out.println("sleep thread.");
                        } catch (Exception e){
                            e.printStackTrace();
            worker.start();
            handler.readMessages();  
        }Are there JVM flags that I should experiment with that might help mitigate/diagnose this problem?

  • Bug with min function applied to an attribute?

    Does anyone know if there is a bug with the minimum function when it is applied to an attribute?
    I have Accounts, Date, Sales Type and volume in my request.
    I have applied min(Date) in the fx of the Date column.
    My query is hitting the YAGO table even though non of the columns i am using is mapped onto a YAGO table.
    As a test I've removed the min function frem the Date column and applied it to the Account column.
    Again my query hits the YAGO table.
    Does anyone know if it is a bug or can someone propose a workaround?
    I am using OBIEE version 10.1.3.4.1090414.1922 on Windows XP.

    Hi,
    You can create a separate report and refer it into the column of main report by 'Filter based on results of another request'
    This should resolve
    Hope this helps
    Regards
    MuRam

  • Shading pattern bug with stitching functions

    I am using Acrobat Professional 7 for Windows, but I don't believe the situation has changed in Acrobat 9.
    I have a simple hand-crafted pdf that is designed to test shading patterns with extend regions when used with stitching (Type 3) functions. These behave according to the spec in most cases, but there is a special case where they don't. I've included the job at the end of this message.
    The special case is where a Bounds entry is identical to one of the Domain values. The spec doesn't say what should happen for this case, but I might expect either the end child function would be ignored, or that it is used but the appropriate colour would be evaluated using it and applied to the extend region.
    What in fact happens, is that the extend regions have their colour derived from evaluating 0 or 1 through the end child functions. This is true regardless of whether the shading domain includes zero. But, these are used the wrong way round.
    This might seem like a specialised case that would never appear in the field from real world application, but that is not the case. I have dozens of such jobs from customers displaying exactly this problem with varying workarounds by producers such as (Agfa Apogee Normalizer), (Acrobat Distiller 6.0 \(Windows\)), (Adobe PDF library 7.77), (Creo Normalizer JTP ver. 3.1.6), (Adobe PDF Library 8.0).
    In more detail, the job has one radial shading pattern using a stitching function with 6 child functions. The first child function coincides with the function domain, as do the last two child functions. The domain of the shading is a subset of the stitching function, arranged so that the end child functions should never be evaluated.
    I believe the whole of the shading should be a solid cyan because the domain is 0.3 to 0.7. Only one of the child functions covers this range which is solid cyan. Acrobat displays the inner extended region as black which can only be explained by pushing 1 through the first child function, and the outer extended region is yellow which can only be explained by pushing 0 through the final child function.
    I believe Acrobat should be using the shading domain limits for the extend regions. Instead, it is using 0 and 1. But worse, the values are being used the wrong way round.
    This is my hand-crafted job for testing shading patterns with Type 3 functions. The job is hand crafted, and I haven't gone to the trouble of setting the xref table or setting the stream lengths, but Acrobat does repair the file and it behaves the same as other, real-world, jobs
    %PDF-1.4
    %âãÏÓ
    1 0 obj
    <<
    /Type /Catalog
    /Pages 2 0 R
    >>
    endobj
    2 0 obj
    <<
    /Type /Pages
    /Count 1
    /Kids [4 0 R ]
    >>
    endobj
    3 0 obj
    << % Info dictionary
    /Title (FunctionType 3 boundary test)
    /CreationDate (D:20051118000000-00'00')
    /Author (John Jefferies)
    >>
    endobj
    4 0 obj
    << % Page 1
    /Type /Page
    /Parent 2 0 R
    /Resources 5 0 R
    /MediaBox [0 0 300 300]
    /Contents [6 0 R]
    >>
    endobj
    5 0 obj
    << % Resources Groups
    /Shading <<
    /Radial 7 0 R
    >>
    /ProcSet [/PDF]
    >>
    endobj
    6 0 obj
    << % Page contents
    /Length 1
    >>
    stream
    q 1 0 0 1 0 0 cm /Radial sh Q
    endstream
    endobj
    7 0 obj
    << % Radial shading covering group
    /ShadingType 3
    /ColorSpace /DeviceCMYK
    /BBox [0 0 300 300]
    /Coords [150 150 30 150 150 175]
    /Function 8 0 R
    /Domain [0.3 0.7]
    /Extend [true true]
    >>
    endobj
    8 0 obj
    << % Function for shadings
    /FunctionType 3
    /Domain [0 1]
    /Range [0 1 0 1 0 1 0 1]
    /Functions [9 0 R 10 0 R 11 0 R 12 0 R 13 0 R 14 0 R]
    /Bounds [0 0.25 0.25 1 1]
    /Encode [0 1 0 1 0 1 0 1 0 1 0 1]
    >>
    endobj
    9 0 obj
    << % Function for shadings: Red - Black
    /FunctionType 2
    /Domain [0 1]
    /Range [0 1 0 1 0 1 0 1]
    /C0 [0 1 1 0]
    /C1 [0 0 0 1]
    /N 1
    >>
    endobj
    10 0 obj
    << % Function for shadings: Green
    /FunctionType 2
    /Domain [0 1]
    /Range [0 1 0 1 0 1 0 1]
    /C0 [1 0 1 0]
    /C1 [1 0 1 0]
    /N 1
    >>
    endob

    Philip, thankyou for offering to look at this.
    I have attached 'FunctionType 3 boundary.pdf' which was the original file I attempted to post. The file 'AcrOut Domain 0_3-0_7.png' makes it clear what I am seeing in Acrobat. I would also like to augment my original post a little to point out incompatibilities between Acrobat and CPSI.
    1. From my PoV, compatibility between Acrobat and CPSI is important, so I've also attached a file that contains equivalent PostScript. On my Ricoh Aficio with CPSI (3016.203) inside it, the job is rendered in solid cyan as I would expect given that the domain of the shading is restricted to [0.3 0.7].
    2. If the jobs are changed to make the shading domain [0 1] instead of [0.3 0.7], Acrobat displays a green ring (expected), and the inner extend region is now red (expected). The outer extend region remains yellow.
    CPSI renders the job almost the same as Acrobat, but the outer extend region is painted in cyan, not yellow. An Nth reading of the PDF and PS specs has revealed a subtle difference; there is one sentence in the stitching function section of the PDF spec not present in the PS spec, it is "If the last bound, Bounds(k−2) , is equal to Domain(1) , then x′ is defined to be Encode(2i)". I take this to mean the outer extends region may have different color in the PDF and PS versions by design.
    3. If the pdf job is changed to make the shading domain [0.01 0.99], Acrobat displays the inner extend in black as before (unexpected), otherwise the same as 2).
    To summarise:
    1. There appears to be a bug in Acrobat whereby it ignores domain of the shading when painting the extend regions.
    2. There is an incompatibility between Acrobat and CPSI in the outer extends region when the final Bounds entry is equal to the Domain value. This may be by design.

  • HT1688 PassSource beta - geting message - Found the bug with account creation

    PassSource beta website giving me a message - "Found bug with account creation"

    PassSource is NOT an Apple service.

  • Do they have plans to fix the bugs with Yosemite.  I keep losing internet connection on my Mac Book

    Ever since i installed Yosemite on my Mac Book pro i keep losing internet connection.  Should I go back to mavericks because I just hate this Yosemite or do they plan to fix the bugs soon?  I did a complete clean install and I am still having problems.  I see a lot of complicated solutions and I am not that tech savvy to go into my settings.  Thanks

    All software has bugs. The first release (which you have) will be the worst.
    Many advocate not upgrading to a new operating system until it's been out for 3 months or longer. In the Windows world many recommend not upgrading until a full year has passed.
    So yes, most / some bugs and glitches will get fixed over time.   If you wish to reduce your difficulties in the future wait a while before installing ANY new OS.
    I suggest you post specific details on your Internet problems. How are you connected etc.

  • Does anybody have a current status on all the bugs with iTunes 10.5.2 and Windows 7?

    I guess that fact that iTunes isn't even available as a drop down kind of answers my question!

    Most of the info on the web page you link to is 2-4 years old. I doubt it applies. Your workaround is actually the best solution: It's always preferred to use the latest PDF viewer. Reader and Acrobat can exist on the same machine.
    Also, why 10.1.2? There have been 6 releases since then with documented security enhancements (meaning there are also published vulnerabilities which are patched), bug fixesm, and feature enhancments.
    I'll ping some folks about the error you are getting. . .
    hth,
    Ben

  • The problem with AGO function

    Oracle BI 11g
    Hi!
    In repositiry I created time hierarchy:
    1. Year
    - YearID (Primary Key)
    - YearName (Use For display)
    1.1 Month
    - MonthID (Primary Key)
    - MonthName (Use For display, Sorted By MonthID)
    1.1.1 Date
    - DateID (Primary Key)
    - Date (Use For display, Chronological Key).
    After that I create calculated logical column "Revenue (1 year ago)": Ago("DB"."Table"."Revenue" , "DB"."Calendar"."Year" , 1)
    But when I use created column in Analysis, I get strange results (Date, Revenue, Revenue (1 year ago)):
    09.02.2007..........1000....................
    09.03.2007..........3000....................
    06.04.2007..........5000....................
    08.02.2008..............................1000
    07.03.2008..............................3000
    11.04.2008..............................5000
    As you can see dates in 2008 year are different that in 2007! Why it can be???
    Edited by: 849986 on 21.04.2011 6:01

    I thought that I made mistake when I created my repository or something else. But I got this problem in Oracle demo-repository SampleAppLite as well! I created Analysis: Calendar Date, Revenue, Year Ago Revenue:
    07.01.2008..........2167
    08.01.2008..........1920
    05.01.2009...........................2167
    06.01.2009...........................1920
    It's a bug in Oracle BI 11 or I do something wrong?

  • [JNI Beginner] GC of Java arrays returned by the native code

    Hello all,
    I am beginning with JNI, to integrate a C library that pilots an industrial equipment, into a java UI. This library enables to exchange various proprietary PDUs (protocol data units), with the equipment, up and down (request/replies). Both requests and replies are arrays of bytes (+char*+).
    "Request" byte arrays are constructed by Java code, which passes them to the JNI code that glues with the lib. "Reply" byte arrays are returned to the Java code, which analyzes them.
    The "return reply" part is very similar to this [tutorial example|http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jniexamp.html] , which returns bytes read from a file. However there's something I don't understand with regard to garbage collection of the returned byte array:
    - in this stock example, the C code creates a Java byte array fills it, and simply returns it (example code stripped to highlight only the parts relevant to my question):
        jByteArray=(*env)->NewByteArray(env, size);
        (*env)->SetByteArrayRegion(env, jByteArray, 0, size, (jbyte *)sourceBytes);
        return (jByteArray);What will happen to this Java array (jByteArray) with regard to garbage collection?
    - if it's no more referenced (the example Java code just systemouts it and forgets it), will it be eligible to GC?
    - if it is referenced by a Java variable (in my case, I plan to keep a reference to several replies as the business logic requires to analyze several of them together), do regular Java language GC rules apply, and prevent eligibility of the array to GC as long as it's referenced?
    That may sound obvious, but what mixes me up is that the same tutorial describes memory issues in subsequent chapters: spécifically, the section on "passing arrays states that:
    [in the example] the array is returned to the calling Java language method, which in turn, garbage collects the reference to the array when it is no longer usedThis seems to answer "yes" to both my questions above :o) But it goes on:
    The array can be explicitly freed with the following call:
    {code} (*env)-> ReleaseByteArrayElements(env, jByteArray, (jbyte *)sourceBytes, 0);{code}Under what circumstances would one need to explicitly free jByteArray when it's about to be returned to the Java calling method? Or does this sentence apply to completely different situations (such as, when the array is +not+ returned as is to a Java method)?
    The tutorial's next section has a much-expected +memory issues+ paragraph, from which I quote:
    By default, JNI uses local references when creating objects inside a native method. This means when the method returns, the references are eligible to be garbage collected.I assume this means, +unless the references are assigned, in the Java code, to a Java variable+, right?
    If you want an object to persist across native method calls, use a global reference instead. A global reference is created from a local reference by calling NewGlobalReference on the the local reference.I assume this enables the C code to maintain a global reference to a java object even if it's not referenced anymore from the Java variables, right?
    I also checked the [JNI specification|http://download-llnw.oracle.com/javase/6/docs/technotes/guides/jni/spec/design.html#wp1242] , but this didn't clear the doubt completely:
    *Global and Local References*
    The JNI divides object references used by the native code into two categories: local and global references. Local references are valid for the duration of a native method call, and are automatically freed after the native method returns. Global references remain valid until they are explicitly freed.
    Objects are passed to native methods as local references. All Java objects returned by JNI functions are local references. The JNI allows the programmer to create global references from local references. JNI functions that expect Java objects accept both global and local references. A native method may return a local or global reference to the VM as its resultAgain I assume the intent is that Global references are meant for objects that have to survive across native calls, regardless of whether they are referenced by Java code. But what worries me is that combining both sentences end up in +All Java objects returned by JNI functions are local references (...) and are automatically freed after the native method returns.+.
    Could you clarify how to make sure that my Java byte arrays, be they allocated in C code, behave consistently with a Java array allocated in Java code (I'm familiar already with GC of "regular" Java objects)?
    Thanks in advance, and best regards,
    J.

    jduprez wrote:
    Hello all,
    I am beginning with JNI, to integrate a C library that pilots an industrial equipment, into a java UI. This library enables to exchange various proprietary PDUs (protocol data units), with the equipment, up and down (request/replies). Both requests and replies are arrays of bytes (+char*+).
    "Request" byte arrays are constructed by Java code, which passes them to the JNI code that glues with the lib. "Reply" byte arrays are returned to the Java code, which analyzes them.
    The "return reply" part is very similar to this [tutorial example|http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jniexamp.html] , which returns bytes read from a file. However there's something I don't understand with regard to garbage collection of the returned byte array:
    - in this stock example, the C code creates a Java byte array fills it, and simply returns it (example code stripped to highlight only the parts relevant to my question):
        jByteArray=(*env)->NewByteArray(env, size);
    (*env)->SetByteArrayRegion(env, jByteArray, 0, size, (jbyte *)sourceBytes);
    return (jByteArray);What will happen to this Java array (jByteArray) with regard to garbage collection?It will be collected when it is no longer referenced.
    The fact that you created it in jni doesn't change that.
    The array can be explicitly freed with the following call:
    (*env)-> ReleaseByteArrayElements(env, jByteArray, (jbyte *)sourceBytes, 0);Under what circumstances would one need to explicitly free jByteArray when it's about to be returned to the Java calling method? Or does this sentence apply to completely different situations (such as, when the array is not returned as is to a Java method)?
    Per what the tutorial says it is either poorly worded or just wrong.
    An array which has been properly initialized it a just a java object. Thus it can be freed like any other object.
    Per your original question that does not concern you because you return it.
    In terms of why you need to explicitly free local references.
    [http://download-llnw.oracle.com/javase/6/docs/technotes/guides/jni/spec/design.html#wp16785]
    The tutorial's next section has a much-expected memory issues paragraph, from which I quote:
    By default, JNI uses local references when creating objects inside a native method. This means when the method returns, the references are eligible to be garbage collected.I assume this means, unless the references are assigned, in the Java code, to a Java variable, right?As stated it is not precise.
    The created objects are tracked by the VM. When they are eligible to be collected they are.
    If you create a local reference and do NOTHING that creates an active reference elsewhere then when the executing thread returns to the VM then the local references are eligible to be collected.
    >
    If you want an object to persist across native method calls, use a global reference instead. A global reference is created from a local reference by calling NewGlobalReference on the the local reference.That is not precise. The scope is the executing thread. You can pass a local reference to another method without problem.
    I assume this enables the C code to maintain a global reference to a java object even if it's not referenced anymore from the Java variables, right?
    It enables access to it to be insured across multiple threads in terms of execution scope. Normally you should not use them.

  • How to find the number of data items in a file written with ArryToFile function?

    I have written an array of number in 2 column groups to a file using the LabWindows/CVI function ArrayToFile...Now if I want to read the file with FileToArray Function then how do I know the number of items in the file. during the write time I know how many array items to write. but suppose I want the file to read at some later time then How to find the number of items in the file,So that I can read the exact number and present it. Thanks to all
    If you are young work to Learn, not to earn.
    Solved!
    Go to Solution.

    What about:
    OpenFile ( your file );
    cnt = 0;
    while ((br = ReadLine ( ... )) != -2) {
    if (br == -1) {
    // I/O error: handle it!
    break;
    cnt++;
    CloseFile ( ... );
    There are some ways to improve performance of this code, but if you are not reading thousands of lines it's quite fast.
    After this part you can dimension the array to pass to FileToArray... unless you want to read it yourself since you already have it open!
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Any limitations regarding number of JNI functions used?

    Are there any limitations regarding the number of JNI functions used?
    Is there any performance\footprint\other issue when using over 500 JNI functions?
    Thanks you
    Noa.

    I'm new to the JNI world. The JNI world is no different from any other programming world in the respects you're asking about.
    is the number of native functions in my JNI interface may have any affect on the performance?Same answer. Why would it? Why are you fixated on the number of functions here and there? It's about the last thing you should be concerned with. Bizarre question. What you should be worried about is time and space.
    Does the general performance of the JVM and specifically the access time to each of the functions may differ in the case of having 1 JNI function verse having 1000 such functions?Why would it?
    (for example due to going over a long lookup table etc). Do you actually think the designers of JNI are that incompetent? Why?

  • A problem with a function

    Oracle Version: 10g
    Operating System: Microsoft windows 2003
    Hello, I need some help, I would appriciate if anyone could help me out.
    on one hand, I have a table that contains a list of table names that are sensitive in my org.
    In addition, not all the columns in the table are sensitive, some tables have only one or tow sensitive columns
    on the other hand, I have another table that contains all the SQL Statements that passed through all my DB's in the org + some other details like username, machine name etc.
    the sql statement is one columns - varchar2(4000). ALL the SQL TEXT is printed there.
    I need to create a report of the SQL Statements and their details that have any reference to the sensitive entities.
    I'm kind of new to PL/SQL or programming in DB in general.
    Can you please assist me in designing the write function and script.
    Additional details:
    Sensitive_tables table:
    table_name varchar2 (65) -- the names of the sensitive tables
    All_fields number (1) -- 0=not all the fields are sensitive, 1=all the fields are sensitive
    the conditions where the function should return true:
    1. It's not a select/SELECT statement.
    2. There is a relation to a sensitive table that all its columns are sensitive
    3. There is a relation to a sensitive table and to a specific sensitive column.
    below is the function.
    There are 2 cursors - the first loop will check if the SQL Statement touches a sensitive column + a sensitive table.
    The second one checks if the the SQL Statement a table that all its columns are sensitive.
    CREATE OR REPLACE function sens_entity_match (p_statement varchar2)
    return VARCHAR2
    IS
    v_match VARCHAR2(5);
    sql_stmt VARCHAR2(4000);
    TYPE tbls_wth_all_flds IS REF CURSOR;
    tbls_all_fields tbls_wth_all_flds;
    table_name_y varchar2(65);
    TYPE tbls_wthout_all_flds IS REF CURSOR;
    tbls_some_fields tbls_wthout_all_flds;
    table_name_n varchar2(65);
    BEGIN
    sql_stmt:=upper(p_statement);
    OPEN tbls_all_fields FOR select table_name from sens_tables where ALL_FIELDS='1';
    OPEN tbls_some_fields FOR select table_name from sens_tables where ALL_FIELDS='0';
    FETCH tbls_all_fields INTO table_name_y;
    FETCH tbls_some_fields INTO table_name_n;
    WHILE tbls_some_fields%FOUND LOOP
    BEGIN
    IF upper (sql_stmt) like 'SELECT%' THEN
    BEGIN
    RETURN ('FALSE');
    v_match:='FALSE';
    END;
    ELSIF
    ( ((sql_stmt LIKE '%ID_NUMBER%' ) OR (sql_stmt LIKE '%id_number%' )) AND (sql_stmt LIKE table_name_n) )
    OR
    ( ((sql_stmt LIKE '%ADDRESS%') OR (sql_stmt LIKE '%address%')) AND (sql_stmt LIKE table_name_n) )
    OR
    ( (((sql_stmt LIKE '%EMAIL%') OR (sql_stmt LIKE '%E_MAIL%')) OR (sql_stmt LIKE '%email%') OR (sql_stmt LIKE '%e_mail%') ) AND (sql_stmt LIKE table_name_n) )
    OR
    (( (sql_stmt LIKE '%BANK%') or (sql_stmt LIKE '%bank%')) AND (sql_stmt LIKE table_name_n) )
    OR
    ( ((sql_stmt LIKE '%PYM%') OR (sql_stmt LIKE '%PYM%')) AND (sql_stmt LIKE table_name_n) )
    OR
    ( ((sql_stmt LIKE '%CREDIT_CARD%') OR (sql_stmt LIKE '%credit_card%')) AND (sql_stmt LIKE table_name_n) )
    OR
    ( ( (sql_stmt LIKE '%USER%') OR (sql_stmt LIKE '%user%') )AND (sql_stmt LIKE table_name_n) )
    OR
    ( ((sql_stmt LIKE '%CHURN%') OR (sql_stmt LIKE '%churn%') ) AND (sql_stmt LIKE table_name_n) )
    OR
    ( ((sql_stmt LIKE '%LEGAL%') OR (sql_stmt LIKE '%legal%') ) AND (sql_stmt LIKE table_name_n) )
    THEN
    BEGIN
    v_match:='TRUE';
    RETURN ('TRUE');
    END;
    ELSE
    v_match:='FALSE';
    END IF;
    FETCH tbls_some_fields INTO table_name_n;
    END;
    END LOOP;
    WHILE tbls_all_fields%FOUND LOOP
    BEGIN
    IF upper (sql_stmt) like 'SELECT%' THEN
    BEGIN
    v_match:='FALSE';
    RETURN ('FALSE');
    END;
    ELSIF (sql_stmt LIKE table_name_y) THEN
    BEGIN
    v_match:='TRUE';
    RETURN ('TRUE');
    END;
    ELSE
    BEGIN
    v_match:='FALSE';
    RETURN ('FALSE');
    END;
    END IF;
    FETCH tbls_all_fields INTO table_name_y;
    END;
    END LOOP;
    RETURN (v_match);
    END;
    Eexampls that should should be true:
    select sens_entity_match ('update address_data set "EMAIL" = :24 where rowid= :old_rowid') from dual;
    {address_data is a sensitive_table that exists in "sensitive_tables" table and email is a sensitive column}
    select sens_entity_match ('isnert into legal (ssss) select bbbb from input where rowid = 666;') from dual;
    {legal  is a sensitive_table that exists in "sensitive_tables" table and all its columns are sensitive}
    An example that shouldn't should be true:
    select sens_entity_match ('select bank from bank_details where bank_id= 11;') from dual;
    {The SQL text is a select statement}
    The function complies and works, but it doesn't catch all the SQL Statements that are relevant.
    How can I improve it?
    What should I change?
    I would appriricate any help.
    Thanks,
    Roni.

    Hi user611218!
    If I understud right, then you want to have some kind of auditing. I suggest if want auditing than you should use the auditing capabilities of Oracle (Standard auditing and Fine Grained Auditing). It's much easier to generate a report from an Auditingtrail than to create a "Self-Made-Function".
    But if you prefer the soluting with your function then you should change the following:
    ELSIF( ((sql_stmt LIKE '%ID_NUMBER%' ) OR (sql_stmt LIKE '%id_number%' )) AND (sql_stmt LIKE table_name_n) )
    CHANGE IT TO
    ELSIF ((INSTR(LOWER(sql_stmt), 'id_number') > 0)) AND (INSTR(LOWER(sql_stmt), LOWER(table_name_n))))
    Change all the LIKE ... Statements to INSTR ... like above.
    Hope this helps!

  • Using Starts-with XSLT function with XI

    Hi All,
    Any help is apperciated. I am using the starts-with xslt function and when i do so the message gets stucks in the queue. If i run code without the starts-with then is works??
    <xsl:for-each select="receipt/prod">
         <xsl:for-each select="carrier/carrier_detail/carrier">
               <xsl:choose>
                   <xsl:when test="carrier_type='CASE'">
                        <xsl:choose>
                             <xsl:when test="starts-with(carrier_barcode, '00')">
                                                   do something
                                            </xsl:when>
                                           <otherwise>
                                                 do something
                                           </otherwise>
    so on..
    when i try to process messsage using this xslt format it gets sysfail in the queue, but without it, it works fine.
    I need to a special format if the condition of barcode starts with 00

    Chirag,
    Create xslt on abap mapping using transaction SXLT_TOOL on XI abap stack. Copy paste same xslt code and run with test file. You can debug code or most likely you can see error message too.
    Actually your mapping raising an exception which result in sys-fail.
    Hope this will help.
    Nilesh

  • Help with this problem please GasPump.java

    I've been working on this program for a week now and i have not gotten it to complie yet. Could anybody help me out? Your help would be greatly appreciated. Thanks.
    public class GasPump {
          double pricePerGallon;
          double gallons;
          int fuelType;
          int paymentType;
          float washPrice;
          String fuelName;
           public GasPump ( )  
             { pricePerGallon = 2.699; }
           public GasPump ( double price)  
             { pricePerGallon = price; }        
           public void setCost(double cost)   
             { double pricePerGallon  = cost; }
           double  getCost( )
             { return pricePerGallon; }
           public setGrade(int fuelType)
             { String fuelName;
            switch (fuelType)
                   case 1:    fuelName = ?Regular Unleaded?
                                  break;
                   case 2:    fuelName = ?Mid grade Unleaded?
                                  break;
                   case 3:    fuelName = ?Super Unleaded?
                                  break;
                   case 4:    fuelName = ?Diesel?
                                  break;
                   case 5:    fuelName = ?Natural Gas?
                                  break;
                   default:   System.out.println(?Unknown fuel type? + fuelType);
                               fuelName = ?Unknown?;
                   public String getGrade ( )
                   { return fuelName; }
                   double calcBill (double gallons)
                   { return(pricePerGallon * gallons); }
                   void paymentMethod(int  paymentType)    
                    if (paymentType  == 1)
                   payInsideMethod();
                    else
                          if (paymentType == 2)
                    payOutsideMethod();
                          else
                        if (paymentType == 3)
                       payInsideMethod ( );   
                          else
                     System.out.println(?Unknown payment type?);
                void payInsideMethod( )
                     System.out.println(?Pay cashier inside the gas station?);
                void payOutsideMethod( )
                System.out.println(?Please pay with your credit card ?);
               float   carWash (int washType)
                 washPrice = 0.00f;       
                  if (washType == 1)
                    washPrice = 7.00f;   
                      else
                  if (washType == 2)
                             washPrice = 8.00f; 
                  else
                            System.out.println(?Unknown wash type?);
                      return  (float)washPrice;   
                       void printReceipt ( )  
                        /*     System.out.println(fuelName + ? ? +gallons + ? Gallons purchased at $ ? + 
                               pricePerGallon + ? per gallon ? + ? Total cost is:  ? + 
                               pricePerGallon * gallons + ? Total bill is $ :" +
                               ((pricePerGallon * gallons) + washPrice)); */
                           System.out.printf("%s %.2f Gallons purchased at $%.2f per gallon.\nTotal
                  cost is: %.2f",
                                               fuelName, gallons, pricePerGallon, pricePerGallon *
                  gallons);
                       System.out.printf(" Total bill is $: %.2f", ((pricePerGallon * gallon) +
               washPrice));
               }

    sorry my compile errors read
    GasPump.java:31: illegal character: \8220
             case 3:    fuelName = ?Super Unleaded?;
                                   ^
    GasPump.java:31: illegal character: \8221
             case 3:    fuelName = ?Super Unleaded?;
                                                  ^
    GasPump.java:33: illegal character: \8220
             case 4:    fuelName = ?Diesel?;
                                   ^
    GasPump.java:33: illegal character: \8221
             case 4:    fuelName = ?Diesel?;
                                          ^
    GasPump.java:35: illegal character: \8220
             case 5:    fuelName = ?Natural Gas?;
                                   ^
    GasPump.java:35: illegal character: \8221
             case 5:    fuelName = ?Natural Gas?;
                                               ^
    GasPump.java:37: illegal character: \8220
            default:   System.out.println(?Unknown fuel type? + fuelType);
                                          ^
    GasPump.java:37: illegal character: \8221
            default:   System.out.println(?Unknown fuel type? + fuelType);
                                                            ^
    GasPump.java:37: ')' expected
            default:   System.out.println(?Unknown fuel type? + fuelType);
                                                                         ^
    GasPump.java:38: illegal character: \8220
                               fuelName = ?Unknown?;
                                          ^
    GasPump.java:38: illegal character: \8221
                               fuelName = ?Unknown?;
                                                  ^
    GasPump.java:59: illegal character: \8220
                              System.out.println(?Unknown payment type?);
                                                 ^
    GasPump.java:59: illegal character: \8221
                              System.out.println(?Unknown payment type?);
                                                                      ^
    GasPump.java:59: ')' expected
                              System.out.println(?Unknown payment type?);
                                                                        ^
    GasPump.java:64: illegal character: \8220
                      System.out.println(?Pay cashier inside the gas station?);
                                         ^
    GasPump.java:64: illegal character: \8221
                      System.out.println(?Pay cashier inside the gas station?);
                                                                            ^
    GasPump.java:64: ')' expected
                      System.out.println(?Pay cashier inside the gas station?);
                                                                              ^
    GasPump.java:69: illegal character: \8220
                      System.out.println(?Pay at the pump with credit card ?);
                                         ^
    GasPump.java:69: illegal character: \8221
                      System.out.println(?Pay at the pump with credit card ?);
                                                                           ^
    GasPump.java:69: ')' expected
                      System.out.println(?Pay at the pump with credit card ?);
                                                                             ^
    GasPump.java:82: illegal character: \8220
                             System.out.println(?Unknown wash type?);
                                                ^
    GasPump.java:82: illegal character: \8221
                             System.out.println(?Unknown wash type?);
                                                                  ^
    GasPump.java:82: ')' expected
                             System.out.println(?Unknown wash type?);
                                                                    ^
    GasPump.java:94: unclosed string literal
                           System.out.printf("%s %.2f Gallons purchased at $%.2f per
    gallon.\nTotal
                                             ^
    GasPump.java:95: unclosed string literal
                   cost is: %.2f",
                                ^
    GasPump.java:97: ')' expected
                     gallons);
                             ^
    26 errorsBasically wherever I have a quotation mark or a semi-colon there is a error there. I just started programming so im still trying to get the hang of it

Maybe you are looking for

  • HP Laserjet 2550L Won't Print In Color

    I recently upgraded to Leopard, and now my HP Laserjet 2550L will not print in color. I've tried printing for several different apps, but they always come out in b & w. It does however print in color when printing a test page from the printer itself,

  • 3D does not work in Photoshop CS6 on my Dell i7 laptop

    Hi Problems with 3D objects. PS freezes every time I create a 3D object and try to come out of 3D mode or save the file. TRIED: Updating driver for ATI Mobility Radeon HD560V display adapter AMD website auto-suggested and installed HD 4650 (?) driver

  • Will Apple replace my apple tv cable for free?

    My apple tv cable is broken ( power cable not hdmi ) and i was wondering if i called apple, would they replace it for free? or would i have to pay for it? If yes, how much in CAD

  • Execute Calculation for ASO

    Hi, I am trying to convert BSO calc script to ASO calc script using "Execute Calculation" function in maxl. But getting some errors. here is one of the example of calc script. FIX (Actual, "Curr Assig", "Any Product") Sales=0; ENDFIX execute calculat

  • Printing front end documents

    Hi CRM Experts, Is it possible to print a front end document in CRM. I need a follow up document to be printed from the action profile of a Business transaction. The action profile initially prints a smart form output. A document which is relavant to