Query in mysql

how to write a query for identifying the capital letter int he first inserted value.
to be clear, I have two values Microsoft and microsoft now I have to create a query to get 'Microsoft'.how is this possible?
thank you in advance.

mySQL?
In Transact-SQL (Microsoft SQL Server) you can solve it this way:
DECLARE @table AS Table (name varchar(20));
INSERT INTO @table VALUES ('Microsoft'), ('microsoft');
-- With ASCII value check
SELECT *
FROM @table
WHERE ASCII(LEFT(name, 1)) = ASCII(LEFT(UPPER(name), 1))
-- With binary compare
SELECT *
FROM @table
WHERE LEFT(name, 1) COLLATE LATIN1_GENERAL_BIN = LEFT(UPPER(name), 1) COLLATE LATIN1_GENERAL_BIN
Olaf Helper
[ Blog] [ Xing] [ MVP]

Similar Messages

  • SQL query for mySQL

    Hi,
    I posted a question a couple of days ago, about the following question:
    The problem i have is i have a table to query, which is a s follows:
    Table: ECReact
    id: int (11)
    ReactID: varchar(5)
    Ecid: int(11)
    EC:varchar(12)
    the question i have is, how do i check in the column ReactID for entries that have the same ECid occurring more than once ?
    i did get a response to this question as shown below:
    SELECT ReactID, Ecid AS tmp
    FROM ECReact
    WHERE (SELECT COUNT (*)
    FROM ECReact
    WHERE Ecid = tmp) > 1;
    however, i was getting exceptions thrown out - because i'm querying a mySQL database and apparently this does not support nested queries
    Any Suggestions ?
    Thanks

    search the web,
    http://www.developer.be/index.cfm/fuseaction/tutorialDetail/GroupID/28/tutorialName/mySQL-SimulatingSubQueriesUsingTemporaryTables.htm
    mySQL - Simulating Sub Queries Using Temporary Tables By Martin Sutton
    Summary:
    Recently I was constructing a dynamic reporting engine.
    One particular report required information from several tables although not possible using just a standard join.
    With a sub-query, the task would of been simple, however, as I discovered it was more complex than first thought.
    Method:
    Had I had access to sub-queries my syntax would of looked similar to this:
    SELECT DISTINCT #fieldlist# FROM customers c WHERE c.customerid
    NOT IN (SELECT DISTINCT customerid, dateplaced FROM currentorders
    WHERE dateplaced BETWEEN '#SetVariable("fromdate", fromyear & "/" & frommonth & "/" & fromday)#'
    AND '#SetVariable("todate", toyear & "/" & tomonth & "/" & today)#')
    All would of been fine.
    Now, I knew mySQL did not support sub-queries but I wasn't aware that this report would be needed.
    The workaround was not overly complex but needs more than a casual glance.
    Below is the finished code. We can see that we need to re-create the temporary table each time,
    and also drop it, if it exists.
    First we check to see if the temporary table exists, and if so, we drop it.
    drop table IF EXISTS temp
    Secondly, we create the temporary table and populate it with data needed for the join.
    CREATE TEMPORARY TABLE temp SELECT DISTINCT customerid, dateplaced FROM currentorders
    WHERE dateplaced BETWEEN '#SetVariable("fromdate", fromyear & "/" & frommonth & "/" & fromday)#'
    AND '#SetVariable("todate", toyear & "/" & tomonth & "/" & today)#'
    Now we left join on the temporary table to create a recordset containing customers with no orders.
    NULL is returned if there is no match on the joined fields in the right table.
    SELECT DISTINCT #fieldnames# FROM customers c LEFT OUTER JOIN temp t ON c.customerid = t.customerid WHERE t.customerid IS NULL

  • Oracle Query to MYSQL query

    Hi,
    How to convert the below oracle query to MYSQL query
    Oracle Query:
    SELECT b.* FROM (SELECT t2.*, MIN(t2.id) over(PARTITION BY t2.rid)ord_num
    FROM (SELECT t1.id, dense_rank() over(ORDER BY nvl(t1.CLI_ID_CLIENT_EXT, 'a'||t1.id)) rid
    FROM CANGEN_MATRICE_BKUP t1) t2) t, (SELECT ROWNUM , b.* FROM CANGEN_MATRICE_BKUP b) b
    WHERE t.id = b.id ORDER BY t.ord_num, b.id
    i dont know howto convert the MYSQL query?
    Please help on this.
    Regards
    Sudhakar P.

    No MySQL haven't analytic functions. But every analytic function can be achieved with simple SQL, just one needs to write more it :)
    So here is a starting point how to emulate analytic functions in MySQL
    http://www.oreillynet.com/pub/a/mysql/2007/03/29/emulating-analytic-aka-ranking-functions-with-mysql.html
    And MySQL haven;t rowids as well, but actually I dont see any sense of it in this particular query.
    Gints Plivna
    http://www.gplivna.eu

  • Problem in update Query of  MySQL

    Hi
    I have a large amounts of records in a teble & i want to update the records in a particular condition but it takes time in updating.
    I have also used batch update but it's also not going to solve my problem.
    can anyone help what should i do to frequently update in a large amount of data.
    I am using MySQL along with core java.

    It's not a Java question but more of a database profiling question. Try to post your description of the problem and the query in a MySQL forum.
    Kaj

  • Don't get a result set from a query to mySql database

    Hello everyone,
    I am writing a program in which i refer to a mySql database.
    I encountered a problem using the executeQuery in which i don't get a resultSet at the end of the run,
    instead i get a null.
    gust for the record, the api says that it will never return null(se 6), also i queried the DB with a mySql client and the data is there
    and when i use execute("") everything works fine.
    I just can't get my wished result.
    the peace of code I am referring to is here, please feel free to say if you need more code...
    public static ResultSet getAccountResSet(int id) throws SQLException {
             //String query = "SELECT acctNum, acctOwnerId, acctOwnerName, balance, acctType, creditLimit, yearlyInterest, duration, creationDate, relatedCheckingAccoun FROM accounts WHERE acctNum="+id;
             String query = "select * from accounts where id="+id;
             ResultSet rs = statement.executeQuery(query);//this line falls, rs is null and i get null pointer exception
             return rs;
        }thanks for you help :)
    Edited by: gizmokaka on Mar 29, 2008 8:37 AM

    Maybe it's not the function executeQuery(query) that gives you the nullpointer. I think it may be that there is no connection to the DB, in which case the statement variable is null. Call to a method through this variable will trigger a nullpointer. Could you please post the exception text here? It may tell you where the NullPointerException occurs.
    //Chris

  • Query in mysql DB with Dieadem

    Hi,
    I am using a mysql database to store some report data and I want to use Diadem to show the data and create the charts.
    I can connect to the database using diadem and see the database structure. I also can select specific columns and create charts.
    My question is if I can make a query for a specific value, the same way that it can be use datafinder to query a specific value in a TDM file.
    I have read in the NI developer zone in http://zone.ni.com/devzone/cda/tut/p/id/4260 in the Getting data out tab there is a dialog that is a good example of what I want.
    Do we have to build this tools? How ?
    Thanks.

    Hi hugoc,
    I'm sorry, I don't know how I saw spaces yesterday-- there are none now in your column or table names.  The "Show Query Results in Dialog" button should pop up a dialog with a table of values in it.  So the fact that you're not getting anything to happen is not expected and is a problem of some sort.
    You could always put back in the 3 data base connection lines so that you can try out the Wizard with the 3 data bases it contacts by default.  Then you should see that dialog pop up.  This would be a general way to tell what "should" happen.  I've not seen this SQL command FORMAT before.  Does this dynmically convert a string column to a float column for the purposes of the query?  If so, why are you storing float values in a string column in the data base?  If not, then why is the FORMAT command necessary-- if we're doing float comparisons, what need is there for a format specification?  Or is the FORMAT determining the display of the values that are returned by the query?
    The WHERE clause in the query is cotained in the "CondStr" variable in the SUDialog file.  This happens in the Function "QuerySelData()" at the following line:
    T1 = "SELECT " & Prefix & QColStr & " FROM " & QTables(k) & CondStr & SortStr 
    It also occurs in the Function "GetQueryProp()" in the following line:
    If (CondBool) Then T1 = T1 & CondStr 
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Some diffrence in oracle query and mysql query

    sir i see both query in SessionBean1
    mysql query
    SELECT ALL usert.username,
    usert.userid,
    usert.camid FROM usert
    this not use user name
    oracle query
    SELECT ALL MFA.LUSER.USERID,
    MFA.LUSER.TITLE,
    MFA.LUSER.CAMPID,
    MFA.LUSER.PWD,
    MFA.LUSER.USERNAME
    FROM MFA.LUSER
    the user name mfa is use in this query you can see
    this is main diffrence
    but i yse both in code but not get result
    try {
    RowKey userRowKey = luserDataProvider.findFirst
    (new String[] { "MFA.LUSER.USERNAME" },
    new Object[] { textField4.getText()});
    if (userRowKey == null) {
    textField3.setText("11111");
    return null;
    } else {
    textField3.setText("22222");
    return null;
    catch (Exception e) {
    log("Cannot perform login for userid " + textField3.getText(), e);
    error("Cannot perform login for userid " + textField3.getText() + ": " + e);
    textField3.setText("77777");
    return null;
    problem in only oracle not in mysql
    please give me idea how i get result
    thank you

    can you post your query with explain plan for both 9i version and 10g version.
    Thanks,
    karthick.

  • Problem by doing a query on MySQL using dblink

    Good Morning,well,the DBLink works perfectly,but if the field in the MySQL DB is type TEXT(CLOB) throw the next error:
    ORA-28500: la conexión de ORACLE a un sistema no Oracle ha devuelto este mensaje:
    [Generic Connectivity Using ODBC]DRV_BlobRead: DB_ODBC_ENGINE (1489): ; [MySQL][ODBC 5.1 Driver][mysqld-5.1.30]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"CUSTOM_VALUES" WHERE "id"=16' at line 1 (SQL State: 37000; SQL Code: 1064)
    ORA-02063: 2 lines precediendo a MYSQLDB
    28500. 00000 - "connection from ORACLE to a non-Oracle system returned this message:"
    *Cause:    The cause is explained in the forwarded message.
    *Action:   See the non-Oracle system's documentation of the forwarded
    message
    Thank you
    Edited by: 812419 on 18-ene-2011 0:41

    Hi,
    You are hitting a known problem with the MySQL ODBC driver and 10g HSODBC which is discussed in this note on My Oracle Support -
    Problems Selecting Mysql Blob Data Using Hsodbc - Error In Your SQL Syntax          (Doc ID 739274.1)
    There are 3 workrounds -
    a) convert the affected column to a char or varchar column in MySQL.
    b) use the Openlink ODBC driver. This is available from -
    http://download.openlinksw.com/
    c) create a view in MySQL which uses the 'CAST' function to convert the affected column to char. As an
    example for a BLOB -
    create view test_blob_v as select col1, cast(col2 as char) as col2 from test_blob ;
    Then select from the view in Oracle -
    select * from test_blob_v@mysql ;
    ========
    If you are using 10g HSODBC you should migrate to 11g Database Gateway for ODBC (DG4ODBC) as 10g HSODBC is now desupported and DG4ODBC is the replacement product.
    Regards,
    Mike

  • Query question (mysql)

    I wanted to know if I can use the Mysql UPDATE syntax to
    update more then one table at a time, or do i have to have separate
    queries for that?
    Also can anyone give me some advise on a good MySQL reference
    book ?
    Thanks

    The best MySQL reference I know of is online here
    http://dev.mysql.com/doc/refman/5.0/en/update.html

  • Query from mySQL java.lang.NullPointerException

    I have compile and run the following code but it was an error (java.lang.NullPointerException) when I click the loginButton. Please help me, I don't know how to solve the problem.
    /* * Main.java * * Created on February 19, 2008, 2:50 AM */ package dataprotect; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.swing.*; import javax.swing.JOptionPane; import dataprotect.SecretQuest; public class Main extends javax.swing.JFrame {         /** Creates new form Main */     private Connection connection;     private Statement statement;     private ResultSet rs; /** * * @author  Aiman */     public void connectToDB() {         try {             connection= DriverManager.getConnection("jdbc:mysql://localhost/data_protect?user=root&password=password");             statement = connection.createStatement();                     } catch (SQLException connectException) {             System.out.println(connectException.getMessage());             System.out.println(connectException.getSQLState());             System.out.println(connectException.getErrorCode());             System.exit(1);         }     }     private void init() {         connectToDB();     }             /** Creates new form Main */     public Main() {         initComponents();     }         /** This method is called from within the constructor to     * initialize the form.     * WARNING: Do NOT modify this code. The content of this method is     * always regenerated by the Form Editor.     */     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                              private void initComponents() {         loginPanel = new javax.swing.JPanel();         userField = new javax.swing.JTextField();         passLabel = new javax.swing.JLabel();         passField = new javax.swing.JPasswordField();         loginButton = new javax.swing.JButton();         userLabel = new javax.swing.JLabel();         jLabel1 = new javax.swing.JLabel();         registerPanel = new javax.swing.JPanel();         regLabel = new javax.swing.JLabel();         registerButton = new javax.swing.JButton();         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);         setTitle("Data Protector");         loginPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));         passLabel.setText("Password:");         loginButton.setText("Login");         loginButton.addActionListener(new java.awt.event.ActionListener() {             public void actionPerformed(java.awt.event.ActionEvent evt) {                 loginButtonActionPerformed(evt);             }         });         userLabel.setText("Username:");         javax.swing.GroupLayout loginPanelLayout = new javax.swing.GroupLayout(loginPanel);         loginPanel.setLayout(loginPanelLayout);         loginPanelLayout.setHorizontalGroup(             loginPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, loginPanelLayout.createSequentialGroup()                 .addContainerGap()                 .addGroup(loginPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                     .addComponent(userLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 89, Short.MAX_VALUE)                     .addComponent(passLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 89, Short.MAX_VALUE))                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                 .addGroup(loginPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                     .addComponent(loginButton)                     .addComponent(passField, javax.swing.GroupLayout.DEFAULT_SIZE, 134, Short.MAX_VALUE)                     .addComponent(userField, javax.swing.GroupLayout.DEFAULT_SIZE, 134, Short.MAX_VALUE))                 .addContainerGap())         );         loginPanelLayout.setVerticalGroup(             loginPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)             .addGroup(loginPanelLayout.createSequentialGroup()                 .addContainerGap()                 .addGroup(loginPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                     .addComponent(userField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                     .addComponent(userLabel))                 .addGap(16, 16, 16)                 .addGroup(loginPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                     .addComponent(passLabel)                     .addComponent(passField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 21, Short.MAX_VALUE)                 .addComponent(loginButton)                 .addContainerGap())         );         jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18));         jLabel1.setText("Data Protector");         registerPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());         regLabel.setText("If you are first user? Please register first.");         registerButton.setText("Register");         registerButton.addActionListener(new java.awt.event.ActionListener() {             public void actionPerformed(java.awt.event.ActionEvent evt) {                 registerButtonActionPerformed(evt);             }         });         javax.swing.GroupLayout registerPanelLayout = new javax.swing.GroupLayout(registerPanel);         registerPanel.setLayout(registerPanelLayout);         registerPanelLayout.setHorizontalGroup(             registerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)             .addGroup(registerPanelLayout.createSequentialGroup()                 .addGroup(registerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                     .addGroup(registerPanelLayout.createSequentialGroup()                         .addGap(93, 93, 93)                         .addComponent(registerButton))                     .addGroup(registerPanelLayout.createSequentialGroup()                         .addGap(28, 28, 28)                         .addComponent(regLabel)))                 .addContainerGap(18, Short.MAX_VALUE))         );         registerPanelLayout.setVerticalGroup(             registerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, registerPanelLayout.createSequentialGroup()                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)                 .addComponent(regLabel)                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                 .addComponent(registerButton)                 .addContainerGap())         );         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());         getContentPane().setLayout(layout);         layout.setHorizontalGroup(             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)             .addGroup(layout.createSequentialGroup()                 .addContainerGap(72, Short.MAX_VALUE)                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)                             .addComponent(registerPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)                             .addComponent(loginPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))                         .addGap(67, 67, 67))                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()                         .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)                         .addGap(114, 114, 114))))         );         layout.setVerticalGroup(             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)             .addGroup(layout.createSequentialGroup()                 .addContainerGap()                 .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)                 .addGap(15, 15, 15)                 .addComponent(loginPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                 .addGap(25, 25, 25)                 .addComponent(registerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)                 .addGap(27, 27, 27))         );         pack();     }// </editor-fold>                            private void registerButtonActionPerformed(java.awt.event.ActionEvent evt) {                                              // TODO add your handling code here:   //      registerPanel a = new MainFrame();       //      a.show();                        this.setVisible(false);     }                                                  private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) {                                                            Connection conn = null;         Statement stmt = null;         ResultSet rs = null;           try {         Statement statement = connection.createStatement();         rs = statement.executeQuery("select username, password from system");                         // create a statement             stmt = conn.createStatement();             // extract data from the ResultSet                 String username = userField.getText();         String password = new String(passField.getPassword());         if(username.equalsIgnoreCase(password)) {             JOptionPane.showMessageDialog(this, "Login Successful");             SecretQuest a = new SecretQuest();             a.show();                        this.setVisible(false);   }         else{     JOptionPane.showMessageDialog(this, "Incorrect username/password combination.", "Login Error", JOptionPane.ERROR_MESSAGE);                 } } catch (Exception e) {             e.printStackTrace();             System.exit(1);         }     /*  try {                 java.sql.Statement s = conn.createStatement();                 java.sql.ResultSet r = s.executeQuery                 ("SELECT username, password FROM system");                 while(r.next()) {                         System.out.println (                                 r.getString("username") + " " +                                 r.getString("password") );                         }         }         catch (Exception e) {                 System.out.println(e);                 System.exit(0);                 } */     }                                                  /**     * @param args the command line arguments     */     public static void main(String args[]) {         java.awt.EventQueue.invokeLater(new Runnable() {             public void run() {                 new Main().setVisible(true);             }         });     }         // Variables declaration - do not modify                        private javax.swing.JLabel jLabel1;     private javax.swing.JButton loginButton;     private javax.swing.JPanel loginPanel;     private javax.swing.JPasswordField passField;     private javax.swing.JLabel passLabel;     private javax.swing.JLabel regLabel;     private javax.swing.JButton registerButton;     private javax.swing.JPanel registerPanel;     private javax.swing.JTextField userField;     private javax.swing.JLabel userLabel;     // End of variables declaration                      }
    I'm using mysql-connector-java-5.0.8 and mysql version 5.0...Any ideas?
    Thanks a lot for your help =)

    Its look can't solve the error..I try to change from:
    // create a statement
            stmt = conn.createStatement();
            // extract data from the ResultSetto this one as you said:
    // create a statement
            stmt = connection.createStatement();
            // extract data from the ResultSetBut the same problem was happen.
    After the error it appear this on output windows of NetBean 5.5:
    at dataprotect.Main.loginButtonActionPerformed(Main.java:198)
            at dataprotect.Main.access$000(Main.java:17)
            at dataprotect.Main$1.actionPerformed(Main.java:76)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
            at java.awt.Component.processMouseEvent(Component.java:6038)
            at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
            at java.awt.Component.processEvent(Component.java:5803)
            at java.awt.Container.processEvent(Container.java:2058)
            at java.awt.Component.dispatchEventImpl(Component.java:4410)
            at java.awt.Container.dispatchEventImpl(Container.java:2116)
            at java.awt.Component.dispatchEvent(Component.java:4240)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
            at java.awt.Container.dispatchEventImpl(Container.java:2102)
            at java.awt.Window.dispatchEventImpl(Window.java:2429)
            at java.awt.Component.dispatchEvent(Component.java:4240)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)Edited by: Aiman on Feb 25, 2008 5:43 AM

  • Problem of Query Chinese words in MySQL using Java (Servlet java)

    In my servlet, if I build in this sql inside ,
    SELECT * FROM table WHERE location='Chinese word here'
    It outputs nothing!
    if i change the 'Chinese word here' to English,it have result!
    But if I query in mysql, i can
    If the 'Chinese word here' is get in a form, (ie 'Chinese word here' is got by req.getParameter but not built in), it can display result, why???

    Hi hlj_zhj
    Oh your method works, I change the Gb2322 to Big5,
    and I have a question about your "return shift", shift is not defined in your part of programme, so I change to follows:
    private String getISO(String gbstr){
    String temp=null;
    try{
    String temp_p = gbstr;
    byte[] temp_t = temp_p.getBytes("Big5");
    temp = new String(temp_t, "ISO8859-1");
    catch(Exception e){}
    return temp;
    ANOTHER question, Some of my BIG5 words contains "Hong Kong Words,eg:�`������", therefore, using temp_p.getBytes("Big5") not work in this case, do you have any suggestion in this case? thanks

  • How to pass mysql query id through url parameter to a detail page

    Hi there,
    I am a newbie to JSP and I am trying to pass a url parameter to a detail page so that it will query a mysql data query to show the details of that query. How can I write the query on the details page so that it will display the query results on the page. eg select * From data Where = "passed_url parameter_ value". Please i need urgent help on this please.

    <Acknowledged>
    which should be strongly cautioned against even for "newbies".
    </Acknowledged>
    Right, but the code you posted will "work" in a very harmful wayNot always, I used normal Statements last year and I had no problems.
    Even with pretty capible code brakers trying to cause $h!t with my application.
    Just check for invalid datatypes, and for SQL Injections remove stuff like ' or replace with `
    But yes PStat... are the better way.

  • Help with an advance mysql query

    I'm using CF 7 to query a MySQL 5 DB.
    I was wondering if it's possible to add an OR operator in a
    subquery or at the end of a conditional statment. Let's say that in
    my conditional WHERE statement after a few inclusive conditions, I
    wanted to add an "AND & OR" logic.
    maybe by including part of my code I can be a little more
    clear:
    <cfquery name="domysearch" ...>
    SELECT
    a.id as id,
    b.company as company,
    c.add_line1 as add_line1,
    FROM registratn_contacts a, registratn b,
    registratn_addresses c
    WHERE a.owner = #arguments.owner#
    AND b.id = a.master_record
    AND c.id = a.address_id
    AND c.state = 'NY'
    OR c.state = 'CA'
    I would like to know if I can or should accomplish this in my
    query or if I should have this logic outside the query?
    Thanks for any help!!!!
    Carlos

    WHERE .....
    AND (c.state = 'NY' OR c.state = 'CA')
    You can use an OR, but it is probably
    better to use an IN clause, as it is essentially an OR, and
    would be more efficient.
    AND c.state IN ( 'NY', 'CA')
    Phil

  • Displaying Japanese in Browser from MySQL query

    Hi All,
    I have the following jsp where I am trying to query a MySQL database for japanese words and display them on a web page.
    <html>
    <head>
    <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
    <%@page import="java.sql.*" %>
    </head>
    <%
    String connectionURL = "jdbc:mysql://localhost:3306/japanese?user=;password=";
    Connection connection = null;
    Statement statement = null;
    ResultSet rs = null;
    %>
    <body>
    <%
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    connection = DriverManager.getConnection(connectionURL, "root", "");
    statement = connection.createStatement();
    rs = statement.executeQuery("SELECT kanji, kana, english FROM vocab");
    while (rs.next()) {
    out.println("Kanji: " + rs.getString("kanji")+"<br>");
    out.println("Kana: " + rs.getString("kana")+"<br>");
    out.println("English: " + rs.getString("english")+"<br>");
    rs.close();
    %>
    </body>
    </html>But when I run this through my browser (http://localhost:8180/japanese/mysql.jsp) I get the following output:
    Kanji: ???
    Kana: ??????
    English: elephant
    I am using:
    * mysqld Ver 5.0.22-Debian_0ubuntu6.06.3-log for pc-linux-gnu on i486 (Debian Etch distribution)
    * Apache/Tomcat 5.0
    * java-6-sun
    Can someone please tell me what I need to do?

    That is fine, but has following limitations.
    (1)     Blob has limitation of size of 4kb and you cannot afford to load heavy objects in session which messes performance
    (2)     Content type (gif/jpeg) dependency, I need to explicitly declare content type.
    (3)     I need to know the size of image
    Hence following one of the ways is suggested to store
    and retrieve. Use <iamge src to
    retrieve the file
    Steps involved in displaying image from the database
    works with post Oracle 9i
    (1)     Provide read permission to the Oracle account to
    read the file from a directory
    (2)     Create an image table that contains
    ordsys.ordimage column.
    (3)     Upload the file into Oracle Database in
    ordsys.ordimage column table using a procedure.
    (4)     Provide java file write permission to the Oracle
    account.
    (5)     Export the file from the Oracle Database to
    output directory.
    (6)     Read the file in JSP using src image tag
    Regards,
    Shankar G. Pednekar

  • How to query data from Oracle, MySQL, and MSSQL?

    For an environment consisting of Oracle 11g/12c enterprise edition, MySQL 5.7 community edition, and MSSQL 2008/2012 stanard/enterprise edition, is there any major issue using DG4ODBC to query data from all 3 platforms?
    Is there other free alternatives?
    If the queried data is mostly contained in MySQL or MSSQL, will it be more efficient to query from MySQL or MSSQL?
    If yes, any suggestion of how to do it in those platforms? I know MSSQL can use linked server but it is quite slow.

    mkirtley-Oracle wrote:
    Hi Ed,
        It is semantics.  By multiple instances I mean you have the gateway installed in an ORACLE_HOME which has 1 listener. However, if you are connecting to different non-Oracle databases or different individual databases of that non-Oracle database then you need multiple gateway instances for each database being connected.  I did not mean that you need a gateway installed in a separate ORACLE_HOME for each non-Oracle database to which you are connecting.
    Each of these would have a separate instance file within that ORACLE_HOME/hs/admin directory with the connection details for the non-Oracle database to which that instance connects.. So, you would have -
    initgtw1.ora - connects to MySQL
    initgtw2.ora - connect to SQL*Server northwind database
    initgtw3.ora - connect to SQL*Server test database
    etc
    etc
    Each of these instances would have a separate entry in the gateway listener.ora.
    In MOS have a look at this note -
    How To Add A New Database or Destination To An Existing Gateway Configuration (Doc ID 1304573.1)
    Regards,
    Mike
    Ah yes, we are in agreement, it was just semantics.  Thanks.

Maybe you are looking for