-1

私はWebサービスを持っていて、Webサービスからデータをフェッチしてそのデータをデータベースに保存していますが、例外が発生していて、データベースがデバイス上で正常に作成されていることを確認し、正常に開いたデータベースを適切に閉じています私のWebサービスデータの特殊文字の問題、私は私のWebサービスにいくつかのストーリーがあり、それはいくつかの特殊文字を含んでいます...そして、それらをデータベースに挿入しようとすると、SQL LOGIC ERROR try { conn = (StreamConnection) Connector.open(" http://tandonindia.com/story_new_xml?user=500 "+";deviceside=true"/ +";interface=wifi" /);

            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();  
            docBuilderFactory.setIgnoringElementContentWhitespace(true);
            docBuilderFactory.setCoalescing(true);

            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();    

            docBuilder.isValidating();      

            is = conn.openInputStream();    
            doc = docBuilder.parse(is);     
            doc.getDocumentElement().normalize(); 
            System.out.println ("ROOT ELEMENT OF DOCUMENT IS=  " +  doc.getDocumentElement().getNodeName());
            //add(new LabelField(""+  doc.getDocumentElement().getNodeName()));

            NodeList nodeList = doc.getElementsByTagName("item");
            for (int i = 0; i < nodeList.getLength(); i++){
                //System.out.println(""+nodeList.getLength());

                Node node = nodeList.item(i);
                if(node.getNodeType() == Node.ELEMENT_NODE) {

                      Element element = (Element) node;
                      NodeList nodelist = element.getElementsByTagName("Week");
                      Element element1 = (Element) nodelist.item(0);
                      NodeList fstNm = element1.getChildNodes();
                      System.out.print("Week-- " + (fstNm.item(0)).getNodeValue().toString());

                      Element element2 = (Element) node;
                      NodeList nodelist1 = element2.getElementsByTagName("Year");
                      Element element3 = (Element) nodelist1.item(0);
                      NodeList fstNm1 = element3.getChildNodes();
                      System.out.println("\nYear-- "+(fstNm1.item(0)).getNodeValue().toString());


                      //For retriving text from node notification
                      Element element4 = (Element) node;
                      NodeList nodelist2 = element4.getElementsByTagName("subject");
                      Element element5 = (Element) nodelist2.item(0);
                      NodeList fstNm2 = element5.getChildNodes();
                      System.out.println("subject--"  + (fstNm2.item(0)).getNodeValue().toString());


                      //For retriving text from node Link
                      Element element15 = (Element) node;
                      NodeList nodelist21 = element15.getElementsByTagName("storypath");
                      Element element51 = (Element) nodelist21.item(0);
                      NodeList fstNm22 = element51.getChildNodes();
                      System.out.println("storypath--"  + (fstNm22.item(0)).getNodeValue().toString());

                      try {
                            db2 = DatabaseFactory.open(str);
                             db2.beginTransaction();
                             Statement statmnt2 = db2.createStatement("INSERT into tbstory(Week,Year,subject,storypath) VALUES("+"'"+(fstNm.item(0)).getNodeValue().toString()+"','"+(fstNm1.item(0)).getNodeValue().toString()+"','"+(fstNm2.item(0)).getNodeValue().toString()+"','"+(fstNm22.item(0)).getNodeValue().toString()+"')");
                             System.out.println("INSERTING STORYIESSSSSSSSSSSSSSSSS");

                             statmnt2.prepare();
                             statmnt2.execute();
                             statmnt2.close();

                             db2.commitTransaction();
                             db2.close();
                        } catch (Exception e) {
                            // TODO Auto-generated catch block
                            db2.close();
                            System.out.println("1111222333"+e.toString());

                            e.printStackTrace();
                        }

                }

            }
            System.out.println("----------------");

        }catch(Exception e){

            System.out.println("error 1"+e.getMessage());
        }

そして、私が得たエラーは net.rim.device.api.database.DatabaseException: INSERT into tbstory(Week,Year,subject,story[0.0] path) VALUES('25','2013','PRIZE VEGETABLE!' の下にあります。 、ババはコダイカナルの生徒たちにこの話をしました。


  now this time i have very less content , again i got the error on INSERT query and how can i find that which character is giving me error, i'll post my exception while adding a small string in my Database.. can u tell me according to you which character is giving  error  or how can i figure out  which character is giving me error

net.rim.device.api.database.DatabaseException: INSERT into tbstory(storypath) VALUES('O[0.0] ne day, the Pandit came excitedly and told Rabidas, a cobbler, "My friend Today the queen is coming [0.0] to have the holy bath. I have been called to do the rit[0.0] uals; for today is a very special day, whoever has a dip in mother Ganga could emerge all pure. Do C[0.0] ome Don't miss this opportunity" Rabidas shook his head and said "Man changa to katooti me Ganga", p[0.0] ointing to his leather bag, (if mind is pure Ganga will[0.0]  be in my leather bag).
[0.0] 
[0.0]  
[0.0] 
[0.0] Angrily the Pandit went away muttering, "When will this fool understand the truth and try to earn Go[0.0] d's Grace?"  His life will be spent in the company of  this disgusting leather only'.
[0.0] 
[0.0]  
[0.0] 
[0.0] In the evening the Pandit came panting, "Rabi, What a miracle occurred today  Ganga Mayya Blessed ou[0.0] r queen with a golden bangle and told her she will get the second one when a person as pure and as d[0.0] evoted as she come to there to dip in the holy river. T[0.0] omorrow the whole city of Kashi will come and see who that lucky Blessed person is".
[0.0] 
[0.0]  
[0.0] 
[0.0] Rabi said "My dear friend It must be you only; for who can be more purer and devoted than you who ta[0.0] ke hundreds of people for holy bath every day?"
[0.0] 
[0.0]  
[0.0] 
[0.0] Pleased and puffed up with pride the Pandit said, "I know it must be me only. Tomorrow I will be the[0.0]  first person to take the holy dip".
[0.0] 
[0.0]  
[0.0] 
[0.0] Next day, the Pundit came late in the evening with an air of dejection over him. Rabi asked "So, my [0.0] friend did you get the second bangle?
[0.0] 
[0.0]  
[0.0] 
[0.0] Rabi closed his eyes and silently prayed "Oh mother, why don't you save this poor Pundit from this d[0.0] ilemma? I know you are everywhere and  manifest anything at any time. Then he put his hand into his [0.0] leather bag and Lo Wonder  of wonders A shinning gold b[0.0] angle emerged
[0.0] 
[0.0]  
[0.0] 
[0.0] The Pandit was spellbound at this great miracle. He bowed down to the cobbler in all humility.
[0.0] 
[0.0]  
[0.0] 
[0.0] "My dear, you have opened my eyes. All work is worship of God; Inner Purity is greater than Outer Pu[0.0] rity.'): SQL logic error or missing database
4

2 に答える 2

1

どのバージョンの BBOS でテストしていますか? OS 5 の初期リリースでは、トランザクションを使用しようとすると「SQL ロジック エラー」例外がスローされることがわかりました。唯一の回避策は、暗黙的なトランザクションに切り替えることです。beginTransaction/commitTransaction の呼び出しをスキップするだけです。これは、5.0.0.0 から 5.0.0.400 までのすべての BBOS アプリ バージョンと、5.0.0.402、5.0.0.405、5.0.0.602 に影響します。

于 2013-06-30T00:12:58.237 に答える