Java inernationalization query

what is the difference between ucs-2 and utf-16 encoding
mysql does not support utf-16

This may help:
http://www.terena.nl/library/multiling/unicode/utf16.html

Similar Messages

  • Limit query for Java Persistence Query Language

    Hi,
    Anybody know Java Persistence Query Language can support limit querry to limit the number of row return(Like SQL LIMIT clause)?
    Thanks

    I think the javax.persistence.Query methods setFirstResult and setMaxResults are what you need...

  • Java Mapping Query

    Hi Experts,
    I have a query regarding creating Output XML in SAP PI 7.1. I am using the below command
    out.getOutputPayload().getOutputStream().write(outDoc.toString().getBytes("UTF-8"));
    Where out is the TransformationOutput parameter and outDoc is an output XML not the String.So, I have used toString() here.
    But, when we have imported it in PI7.1 the output is not creating but the entire program is running successfully.
    Th error to create output XML in PI7.1 is as below.
    Unable to display tree view; Error when parsing an XML document (Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 5b, 23, 64 (:main:, row:1, col:3))
    Kindly let me know.
    Regards,
    Aniruddha

    Hi Ninad,
    Thanks for your interest in the post, it is a file to mdm scenario, where the entire mapping is wriiten in Java map.
    We have tested the Java program in NWDS with main() and it has worked successfully.But, when I changed the main with transform and tested it in PI7.1 with the required changes I am getting  that error
    Unable to display tree view; Error when parsing an XML document (Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 5b, 23, 64 (:main:, row:1, col:3))
    But, I have addeed trace in different level and all are coming means the program is running, only in case of
    getTrace().addInfo("Before passing XML to String");
    out.getOutputPayload().getOutputStream().write(outDoc.toString().getBytes("UTF-8"));
    getTrace().addInfo("After passing  XML to String");
    Both the getTrace() is showing in PI7.1.
    Trace Output:
    Records Created - 1
    Before passing XML to String
    After passing XML to String
    END APPLICATION TRACE ***
    Java mapping hcl/com/XmlValidation completed. (executeStep() of hcl.com.XmlValidation).
    Execution of mapping on server took 564 milliseconds Executed successfully
    only the changed syntax is I am using toString() on outDoc as outDoc is an Document type not the String Type.Actaully, I have manipulate the input as an XML not as a String or Stream.
    Regards,
    Aniruddha

  • URGENT! Java Bean Query

    I am using Tomcat 3.1 and MySQL database for an application I am designing. Below is the code for a java bean that registers users details. The code compiles correctly, but I would like to know if there is any code that I might have left out? What changes should I make to make it more user friendly?
    I do not want to use servlets, as they are very difficult to setup.
    REGISTRATION.JAVA
    package gcd;
    import java.sql.*;
    import java.util.*;
    import java.lang.*;
    import java.awt.*;
    import java.text.*;
    import java.io.*;
    import com.mysql.jdbc.*;
    public class Registration
         public Registration(){}
    String first_name;
    String last_name;
    String role;
    String email;
    String error;
    java.sql.Connection con;
    public void setFirstName( String value )
    first_name = value;
    public void setLastName( String value )
    last_name = value;
    public void setRole( String value )
    role = value;
    public void setEmail( String value )
    email = value;
    public String getFirstName()
    return first_name;
    public String getLastName()
         return last_name;
    public String getRole()
         return role;
    public String getEmail()
         return email;
         public void connect() throws ClassNotFoundException, SQLException, Exception
    try
    System.setProperty("jdbc.drivers", "com.mysql.jdbc.Driver");
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con = DriverManager.getConnection("jdbc:mysql://localhost/gcdBB_db","","");
    catch (ClassNotFoundException e)
    error = "ClassNotFoundException: Could not locate DB driver.";
    throw new ClassNotFoundException(error);
    catch (SQLException e)
    error = "SQLException: Could not connect to database.";
    throw new SQLException(error);
    catch (Exception e)
    error = "Exception: An unknown error occured while connecting to database.";
    throw new Exception (error);
         public void disconnect() throws SQLException
    try
    if(con != null)
    con.close();
    catch (SQLException e)
    error = ("SQLException: Unable to close the database connection.");
    throw new SQLException(error);
    public java.sql.ResultSet validateRegistration(String firstname, String lastname, String role, String email) throws SQLException, Exception
    java.sql.ResultSet rs = null;
    try
    String queryString = ("INSERT INTO registration (firstname,lastname,role,email) VALUES ('" + firstname + "','" + lastname + "','" + role + "','" + email + "';");
    java.sql.Statement stmt = con.createStatement();
    rs = stmt.executeQuery(queryString);
    catch (SQLException e)
    error = "SQLException: Could not execute the query.";
    throw new SQLException(error);
    catch (Exception e)
    error = "An exception occured while retrieving users.";
    throw new Exception(error);
    return rs;
    Thanks,
    Niall

    in JavaBean class:
    The setting/getting method should be matched with the first letter capitalized. ie.
    String firstName;
    String lastName;
    public void setFirstName(String value) { firstName = value ; }
    public String getFirstName() { return firstName; }
    public void setLastName(String value) { lastName = value ; }
    public String getLastName() { return lastName; }
    String role and email coded correctly.
    remember: put your bean in package and call from package.

  • Creating a Java named query?

    Hi,
    From the application developers manual; is it implied that named queries can be created using the Oracle Toplink API in Java; i.e out of the workbench but I have not been able to find any references to this elsewhere. Does anyone have any information on this? i.e creating the named query in Java code and then adding it to the project deployment.
    In addition, is it possible to have it such that if a named query expects 4 arguments; the Java code is written to check if there are any null values passed in, and if the values are null those columns wlil be removed from the query.

    There are really two types of queries that apply.
    Named queries being those queries defined in Java code at application start up that take a fixed number and types of parameters. These queries are typically added using descriptor after-load methods. In the MW you select the static after-load method where you wish to define your queries. As of TopLink 9.0.4 it is possible to define your named queries with arguments directly in the MW without an after-load method.
    Redirect queries are queries where TopLink invokes your method at runtime to execute the query. This approach allows for your code to selectively build the where clause based upon the arguments passed in.
    Some links into the docs that may be of interest:
    after-load: http://download-west.oracle.com/docs/cd/B10464_01/web.904/b10316/dscriptr.htm#1014978
    Using named queries: http://download-west.oracle.com/docs/cd/B10464_01/web.904/b10313/queries.htm#1146839
    Redirect queries: http://download-west.oracle.com/docs/cd/B10464_01/web.904/b10313/queries.htm#1141580
    Doug

  • BI Java SDK - query parameters

    Hello.
    I`m using BI Java SDK to develop a custom Java Swing Application to integrate with the SAP BW 3.5
    I need to replicate the BW query in Java Application and execute this in the Java Side.
    My question is: ...can i replicate the initial screen of the BW query in Java Application  ?
    The initial screen of bw query with the filters and parameters to execute the query in Java side.
    How i capture the filters and paramenters of BW query in BI Java SDK ?
    Best Regards.
    Taylor

    We have a problem with the API BI Java SDK.
    In my application, i using the swing and BI Java SDK to list al cubes and execute the queries.
    The tutorials in "BI Java SDK Examples page" are in "Hard Coded" for all itens, parameters, cubes, mdx Queries ...etc !!!
    When i try to execute the query i need add all dimensions in rows to set in moveDimensionToRows in IBICommandProcessor Class
    This the sample code and the problem:
    //Create olap Query and Commandprocessor
    IBIQuery query = olap.createQuery(cube);
    IBICommandProcessor commandProcessor = query.getCommandProcessor();
    //Here i set the dimension in "hard Coded", but my application captures this automatically to set the dimensions.
    Dimension dimension1 = olap.getObjectFinder().findDimensionFirst(cube, "0CALMONTH");
    Dimension dimension2 = olap.getObjectFinder().findDimensionFirst(cube, "EPINSTALA__0UCRATE_CAT");
    // Here i move the (dimension1 and dimension2 to rows. <-- THE PROBLEM IS HERE - How to capture only dimensions in rows to set in moveDimensionRows ???
    commandProcessor.moveDimensionToRows(dimension2);
    commandProcessor.moveDimensionToRows(dimension1);
    // Execute the query and retrieve the result set.
    IBIDataSet dataset = query.execute();
    Problem --> When i try to execute the query without set moveDimensionToRows, this return only the global result of query (1 row only).
    To return all data in my Grid (JTable), i need to set moveDimensionToRows.
    How i can capture only the rows dimensions to set in moveDimensionToRows and collum dimension ???
    How to separate row dimension and collum dimension???
    thanks...

  • Java card query

    I am a student in my final year of university and im looking into using the java card as part of my final project. could somebody clarify for me some things i am unsure of. Am i able to use any smart card reader or do i need one specific for a java card, if so which one. If i can use any im ok as i can get hold of some. Also, am i correct in that i would write my java code as normal then use a program to write it to the card? any help would be much appreciated. Thanks

    Hi,
    you can use any reader.
    the java code has to be compiled , then converted using the sun-provided JCDK tool "converter" then loaded in the card using globalplatform, with the gpshell tool.
    beware, there are some restrictions to what can be written in the code. specifically, there is no "int" "float" "java.lang.String" and the memory is very small.
    and yes, objects are allocated in non volatile memory. So the "new" keyword must not be used too often, except in the initialization methods.
    why? because the JC virtual machine is always live. it does not stop. When you tear the card, the VM is suspended, then resumed when you reinsert the card, but the objects are still here.
    when an apdu is sent to the card, the JCVM calls a callback in your code. But your Applet object still exists.
    regards
    sebastien.

  • Java reflection query

    hi,
    I have a class B that inherits from a class A. Now, in a class C, I have a following method :
    Class C
    public void foo( A ){ ..}
    if I query class C for a method "foo" that takes params of type B, it does not return the above defined method.
    Why is this so?

    the short answer is "because that's how Class.getMethod() behaves". it kind of assumes that you know the exact signature of the method in advance. most of the time this suffices, but other times, like what you're doing, it doesn't work. the above article discusses some of the issues with reflective method lookup, and provides some code that should help you replace Class.getMethod() with something a little more dynamic.

  • Java api query

    new to java - here goes a silly queston - how can i access the source documentation of particular api classes or methods?
    for example ...
    how "lastIndexOf(Object o)" of ArrayList is actually implemented, or how a particular search method has been coded ...
    Cheers in advance, Mike

    if you want to look at the actual code then you need to download the sdk, and look in src.zip

  • Java Dictonary query

    Hi All,
      Can i retrive or store data in java dictonary using simple java coding/ using JDBC..?? Is it possible if so, request you to let me know the sample code.
    Thanks in adv.,

    No.
    The Oracle client doesn't even have an API for accessing TNS entries-- any app that wants to display that sort of information has to parse the tnsnames.ora file. Additionally, there are a number of way to configure TNS aliases other than in the tnsnames.ora file, so even if you parse the file, that is only a subset of the databases a user can probably connect to.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Java Date query -- Please help...Really Stuck!!!

    My application gets a date from the database. I also create a new Date() to hold todays date. I need to be able to calculate the number of hours between the 2 if the days are the same or the no of days/hours if the days/month/year are different
    Can anyone help me with some code that might help me do this
    Thanks in advance

    import java.util.Calendar;
    import java.util.Date;
    public final class DateUtils {
        private static void displayDifference( final Calendar c1, final Calendar c2, final int field, final String displayText ) {
            System.out.println( displayText + " " + Math.abs( c1.get( field ) - c2.get( field ) );
        public static final void dateDiff( final Date d1, final Date d2 ) {
            final Calendar c1 = Calendar.getInstance();
            final Calendar c2 = Calendar.getInstance();
            c1.setTime( d1 );
            c2.setTime( d2 );
            displayDifference( c1, c2, "Years: ", Calendar.YEAR );
            displayDifference( c1, c2, "Days: ", Calendar.DAY_OF_YEAR );
            displayDifference( c1, c2, "Hours: ", Calendar.HOUR );
            displayDifference( c1, c2, "Minutes: ", Calendar.MINUTE );
            displayDifference( c1, c2, "Seconds: ", Calendar.SECOND );
    }

  • Java IO query

    Hi ,
    I am new to java programming .
    I am trying to work with flat file (non-relational database) , if anybody can tell me is there way to do add , modify , update, delete record operations using Java IO package.

    You mean treat a flat file like a database? There is no default functionality for this kind of thing within standard java. Your best bet might be to try to set up a windows specific ODBC driver(or something applicable to whatever platform you are using) to a file that can do these things you want, and then use that within java.

  • Java-SQL Query, Its Urgent.....................

    hi,
    my problem is that i want to get data from the oracle database(SQL) and then put it into a JTABLE.
    The data seems to come correctly into the ResultSet rs Object, but i dont know how to put the data from the rs Object into the JTable.
    Please reply,

    Hi,
    If this is really important, I suggest that you post your question in the Swing Forums. As it is more appropriate for that forum, and you will get a quicker response.
    Damian Sutton.

  • Java export query.

    Quick question guys. Is there anyway I can verify that the export is success either by doing any sanity checks with the configuration of the source system so as to predict any problems while importing to target system.
    Basically i did an export and it finished fine. However there is no files in APPS directory in the export directory except a LABEL.ASC file so am guessing something is not right here. I could see while exporting that it was unable to read some of the configuration however none of these got recorded in the sapinst_Dev and sapinst log files and it shows as finished fine. The SDM directory seems to have been exported fine however not sure if there is any standard process to verify the consitancy of the file system configuration on the source system.
    Regards
    Kalyan

    Hi
    When sapint says successfully your good to go. The SDM Directory is the main one. Make sure it has SDMKIT.JAR file the size of the jar file will be between 1 to 2 gb depending upon the source system.
    APPS directory will have only LABEL.ASC

  • Error when invoking Rule Engine using Java API

    Hi,
    I have implemented a Java class which calls the Rule Engine to execute the rules. If I test by setting the value of the input inside a main method and get the output, it is working fine. The ruleset is also invoked and there is no problem. However, when I expose this java class as a web service and invoke the web service, I get the below error. I dont get the error if the .rules file is not present in the loaction mentioned. I get the error when the .rules file is present in the location. Not sure if this is an issue with the java call outs or loading the dictionary.
    Error:_
    <faultcode>S:Server</faultcode>
    <faultstring>oracle/rules/sdk2/exception/SDKException</faultstring>
    <ns2:exception xmlns:ns2="http://jax-ws.dev.java.net/" note="To disable this feature, set com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace system property to false" class="java.lang.NoClassDefFoundError">
    <message>oracle/rules/sdk2/exception/SDKException</message>
    <ns2:stackTrace>
    <ns2:frame line="38" file="ImplementRules.java" method="Query" class="oracle.rules.querystudentcriteria.ImplementRules"/>
    <ns2:frame line="native" file="NativeMethodAccessorImpl.java" method="invoke0" class="sun.reflect.NativeMethodAccessorImpl"/>
    <ns2:frame line="39" file="NativeMethodAccessorImpl.java" method="invoke" class="sun.reflect.NativeMethodAccessorImpl"/>
    <ns2:frame line="25" file="DelegatingMethodAccessorImpl.java" method="invoke" class="sun.reflect.DelegatingMethodAccessorImpl"/>
    <ns2:frame line="597" file="Method.java" method="invoke" class="java.lang.reflect.Method"/>
    <ns2:frame line="101" file="WLSInstanceResolver.java" method="invoke" class="weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker"/>
    <ns2:frame line="83" file="WLSInstanceResolver.java" method="invoke" class="weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker"/>
    <ns2:frame line="152" file="InvokerTube.java" method="invoke" class="com.sun.xml.ws.server.InvokerTube$2"/>
    <ns2:frame line="264" file="EndpointMethodHandler.java" method="invoke" class="com.sun.xml.ws.server.sei.EndpointMethodHandler"/>
    <ns2:frame line="93" file="SEIInvokerTube.java" method="processRequest" class="com.sun.xml.ws.server.sei.SEIInvokerTube"/>
    <ns2:frame line="604" file="Fiber.java" method="__doRun" class="com.sun.xml.ws.api.pipe.Fiber"/>
    <ns2:frame line="563" file="Fiber.java" method="_doRun" class="com.sun.xml.ws.api.pipe.Fiber"/>
    <ns2:frame line="548" file="Fiber.java" method="doRun" class="com.sun.xml.ws.api.pipe.Fiber"/>
    <ns2:frame line="445" file="Fiber.java" method="runSync" class="com.sun.xml.ws.api.pipe.Fiber"/>
    <ns2:frame line="275" file="WSEndpointImpl.java" method="process" class="com.sun.xml.ws.server.WSEndpointImpl$2"/>
    <ns2:frame line="454" file="HttpAdapter.java" method="handle" class="com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit"/>
    <ns2:frame line="250" file="HttpAdapter.java" method="handle" class="com.sun.xml.ws.transport.http.HttpAdapter"/>
    <ns2:frame line="140" file="ServletAdapter.java" method="handle" class="com.sun.xml.ws.transport.http.servlet.ServletAdapter"/>
    <ns2:frame line="319" file="HttpServletAdapter.java" method="run" class="weblogic.wsee.jaxws.HttpServletAdapter$AuthorizedInvoke"/>
    <ns2:frame line="232" file="HttpServletAdapter.java" method="post" class="weblogic.wsee.jaxws.HttpServletAdapter"/>
    <ns2:frame line="310" file="JAXWSServlet.java" method="doPost" class="weblogic.wsee.jaxws.JAXWSServlet"/>
    <ns2:frame line="727" file="HttpServlet.java" method="service" class="javax.servlet.http.HttpServlet"/>
    <ns2:frame line="87" file="JAXWSServlet.java" method="service" class="weblogic.wsee.jaxws.JAXWSServlet"/>
    <ns2:frame line="820" file="HttpServlet.java" method="service" class="javax.servlet.http.HttpServlet"/>
    <ns2:frame line="227" file="StubSecurityHelper.java" method="run" class="weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction"/>
    <ns2:frame line="125" file="StubSecurityHelper.java" method="invokeServlet" class="weblogic.servlet.internal.StubSecurityHelper"/>
    <ns2:frame line="292" file="ServletStubImpl.java" method="execute" class="weblogic.servlet.internal.ServletStubImpl"/>
    <ns2:frame line="26" file="TailFilter.java" method="doFilter" class="weblogic.servlet.internal.TailFilter"/>
    <ns2:frame line="56" file="FilterChainImpl.java" method="doFilter" class="weblogic.servlet.internal.FilterChainImpl"/>
    <ns2:frame line="326" file="DMSServletFilter.java" method="doFilter" class="oracle.dms.wls.DMSServletFilter"/>
    <ns2:frame line="56" file="FilterChainImpl.java" method="doFilter" class="weblogic.servlet.internal.FilterChainImpl"/>
    <ns2:frame line="3592" file="WebAppServletContext.java" method="run" class="weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction"/>
    <ns2:frame line="321" file="AuthenticatedSubject.java" method="doAs" class="weblogic.security.acl.internal.AuthenticatedSubject"/>
    <ns2:frame line="121" file="SecurityManager.java" method="runAs" class="weblogic.security.service.SecurityManager"/>
    <ns2:frame line="2202" file="WebAppServletContext.java" method="securedExecute" class="weblogic.servlet.internal.WebAppServletContext"/>
    <ns2:frame line="2108" file="WebAppServletContext.java" method="execute" class="weblogic.servlet.internal.WebAppServletContext"/>
    <ns2:frame line="1432" file="ServletRequestImpl.java" method="run" class="weblogic.servlet.internal.ServletRequestImpl"/>
    <ns2:frame line="201" file="ExecuteThread.java" method="execute" class="weblogic.work.ExecuteThread"/>
    <ns2:frame line="173" file="ExecuteThread.java" method="run" class="weblogic.work.ExecuteThread"/>
    </ns2:stackTrace>
    The Java class looks like:
    public PersonType Query (PersonType p)
    try {
    //FileReader reader = new FileReader("/home/orasoa/223345/STRS1.rules");
    //FileReader reader = new FileReader("D:\\Arun\\NGCE_WS\\POC1\\UHG\\QueryStudentCriteria\\oracle\\rules\\querystudentcriteria\\STRS1.rules");
    InputStream stream=ImplementRules.class.getResourceAsStream("/STRS1.rules");
    Reader reader=new InputStreamReader(stream);
    RuleDictionary dict = RuleDictionary.readDictionary(reader, new DecisionPointDictionaryFinder(null));
    List<SDKWarning> warnings = new ArrayList<SDKWarning>();
    dict.update(warnings);
    DecisionPoint decisionPoint = new DecisionPointBuilder().with("STRS1_DecisionService_1").with(dict).build();
    DecisionPointInstance point = decisionPoint.getInstance();
    ArrayList input=new ArrayList();
    input.add(p);
    point.setInputs(input);
    List<Object> output=point.invoke();
    catch (Exception e) {}
    return p;
    Cheers,
    - AR

    Hi, I am getting a similar error when I deploy my application on the weblogic server.
    Could you detail how this was resolved?
    Thanks,
    SB

Maybe you are looking for