Return-Path: X-Original-To: apmail-db-derby-user-archive@www.apache.org Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7EC9010266 for ; Thu, 6 Jun 2013 16:08:01 +0000 (UTC) Received: (qmail 47914 invoked by uid 500); 6 Jun 2013 16:08:01 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 47572 invoked by uid 500); 6 Jun 2013 16:07:56 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Delivered-To: moderator for derby-user@db.apache.org Received: (qmail 21887 invoked by uid 99); 6 Jun 2013 15:34:29 -0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of martin@attivio.com designates 213.199.154.188 as permitted sender) X-Forefront-Antispam-Report: CIP:157.56.244.213;KIP:(null);UIP:(null);IPV:NLI;H:CH1PRD0510HT003.namprd05.prod.outlook.com;RD:none;EFVD:NLI X-SpamScore: -3 X-BigFish: PS-3(zzc85fh4015I168aJzz1f42h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ah1fc6hzz17326ah18c673h8275bh8275dhz2fh2a8h668h839hd25hf0ah1288h12a5h12bdh137ah1441h1504h1537h153bh15d0h162dh1631h1758h18e1h1946h19b5h19ceh1ad9h1b0ah1bceh1d07h1d0ch1d2eh1d3fh1dc1h1de9h1dfeh1dffh1e1dh1155h) Received-SPF: pass (mail11-db8: domain of attivio.com designates 157.56.244.213 as permitted sender) client-ip=157.56.244.213; envelope-from=martin@attivio.com; helo=CH1PRD0510HT003.namprd05.prod.outlook.com ;.outlook.com ; From: Martin Serrano To: "derby-user@db.apache.org" Subject: issue with using optimizer hints in jdbc Thread-Topic: issue with using optimizer hints in jdbc Thread-Index: Ac5iySm6ou6bzkJWTn6JuMgUi/4Fjw== Date: Thu, 6 Jun 2013 15:33:46 +0000 Message-ID: <57A08970CC9C7342A3043E023890794126F9C8B1@CH1PRD0510MB367.namprd05.prod.outlook.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [66.227.116.194] Content-Type: multipart/alternative; boundary="_000_57A08970CC9C7342A3043E023890794126F9C8B1CH1PRD0510MB367_" MIME-Version: 1.0 X-OriginatorOrg: attivio.com X-Virus-Checked: Checked by ClamAV on apache.org --_000_57A08970CC9C7342A3043E023890794126F9C8B1CH1PRD0510MB367_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, I am using version 10.9.1.0 with the embedded driver, spring, and using the= BasicDataSource. I am trying to issue this query: org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL= grammar [DELETE FROM metric_data md --derby-properties index=3Dmetric_data= _ts WHERE metric_instance_id IN (SELECT metric_instance.metric_instance_id FRO= M projects, metrics, metric_instance WHERE projects.project_id =3D metrics.= project_id AND metrics.metric_id =3D metric_instance.metric_id AND projects= .online =3D true) AND md.timestamp <=3D 1369884755355]; nested exception is= java.sql.SQLSyntaxErrorException: Syntax error: DERBY-PROPERTIES. Caused by: ERROR 42X01: Syntax error: DERBY-PROPERTIES. at org.apache.derby.iapi.error.StandardException.newExcepti= on(Unknown Source) at org.apache.derby.impl.sql.compile.SQLParser.checkInterna= lFeature(Unknown Source) at org.apache.derby.impl.sql.compile.SQLParser.propertyList= (Unknown Source) at org.apache.derby.impl.sql.compile.SQLParser.deleteBody(U= nknown Source) at org.apache.derby.impl.sql.compile.SQLParser.preparableDe= leteStatement(Unknown Source) at org.apache.derby.impl.sql.compile.SQLParser.preparableSQ= LDataStatement(Unknown Source) at org.apache.derby.impl.sql.compile.SQLParser.StatementPar= t(Unknown Source) at org.apache.derby.impl.sql.compile.SQLParser.Statement(Un= known Source) at org.apache.derby.impl.sql.compile.ParserImpl.parseStatem= ent(Unknown Source) at org.apache.derby.impl.sql.GenericStatement.prepMinion(Un= known Source) at org.apache.derby.impl.sql.GenericStatement.prepare(Unkno= wn Source) at org.apache.derby.impl.sql.conn.GenericLanguageConnection= Context.prepareInternalStatement(Unknown Source) The line of code where I issue it is like this: jdbc.update("DELETE FROM metric_data md --derby-properties index=3Dmetr= ic_data_ts \r WHERE metric_instance_id IN (SELECT metric_instance.metric_in= stance_id FROM projects, metrics, metric_instance WHERE projects.project_id= =3D metrics.project_id AND metrics.metric_id =3D metric_instance.metric_id= AND projects.online =3D true) AND md.timestamp <=3D 19292929292"); What do I need to do to use optimizer hints in this setup? Thanks, -Martin --_000_57A08970CC9C7342A3043E023890794126F9C8B1CH1PRD0510MB367_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi,

 

I am using version 10.9.1.0 with the embedded driver= , spring, and using the BasicDataSource.  I am trying to issue this qu= ery:

 

org.springframework.jdbc.BadSqlGrammarException: Sta= tementCallback; bad SQL grammar [DELETE FROM metric_data md --derby-propert= ies index=3Dmetric_data_ts

 WHERE metric_instance_id IN (SELECT metric_ins= tance.metric_instance_id FROM projects, metrics, metric_instance WHERE proj= ects.project_id =3D metrics.project_id AND metrics.metric_id =3D metric_ins= tance.metric_id AND projects.online =3D true) AND md.timestamp <=3D 1369884755355]; nested exception is java.sql.SQLS= yntaxErrorException: Syntax error: DERBY-PROPERTIES.

Caused by: ERROR 42X01: Syntax error: DERBY-PROPERTI= ES.

        &nbs= p;       at org.apache.derby.iapi.error.Stand= ardException.newException(Unknown Source)

        &nbs= p;       at org.apache.derby.impl.sql.compile= .SQLParser.checkInternalFeature(Unknown Source)

        &nbs= p;       at org.apache.derby.impl.sql.compile= .SQLParser.propertyList(Unknown Source)

        &nbs= p;       at org.apache.derby.impl.sql.compile= .SQLParser.deleteBody(Unknown Source)

        &nbs= p;       at org.apache.derby.impl.sql.compile= .SQLParser.preparableDeleteStatement(Unknown Source)

        &nbs= p;       at org.apache.derby.impl.sql.compile= .SQLParser.preparableSQLDataStatement(Unknown Source)

        &nbs= p;       at org.apache.derby.impl.sql.compile= .SQLParser.StatementPart(Unknown Source)

        &nbs= p;       at org.apache.derby.impl.sql.compile= .SQLParser.Statement(Unknown Source)

        &nbs= p;       at org.apache.derby.impl.sql.compile= .ParserImpl.parseStatement(Unknown Source)

        &nbs= p;       at org.apache.derby.impl.sql.Generic= Statement.prepMinion(Unknown Source)

        &nbs= p;       at org.apache.derby.impl.sql.Generic= Statement.prepare(Unknown Source)

        &nbs= p;       at org.apache.derby.impl.sql.conn.Ge= nericLanguageConnectionContext.prepareInternalStatement(Unknown Source)

The line of code where I issue it is like this:=

 

    jdbc.update("DE= LETE FROM metric_data md --derby-properties index=3Dmetric_data_ts \r WHERE= metric_instance_id IN (SELECT metric_instance.metric_instance_id FROM proj= ects, metrics, metric_instance WHERE projects.project_id =3D metrics.project_id AND metrics.metric_id =3D metric_instance.metric_id= AND projects.online =3D true) AND md.timestamp <=3D 19292929292");=

 

What do I need to do to use optimizer hints in this = setup?

 

Thanks,

-Martin

--_000_57A08970CC9C7342A3043E023890794126F9C8B1CH1PRD0510MB367_--