Re: [dbutils] Issue when using more than 1 parameter in query
Hello Amol, 2015-11-10 21:03 GMT+01:00 Amol Kulkarni: > Hi, > > I am getting a ORA-00942: table or view does not exist when I query using > dbutils api with 2 parameters. My enviroment si WAS 8.5.5 and oracle db 11g > > I am using dbutils1.6 to make db calls. The problem occurs if I send two > query parameters like SELECT * FROM DIGITAL_CERTIFICATE_CACHE WHERE > CERT_SUBJECT_NAME=? AND CERT_STATUS=? Parameters: [70-B3-D5-1F-30-4E-DF-20, > I] . If I send only one SELECT * FROM DIGITAL_CERTIFICATE_CACHE WHERE > CERT_SUBJECT_NAME=? Parameters: [70-B3-D5-1F-30-4E-DF-20] then query > returns and application is working. My dbutils code is as follows > > > >QueryRunner run = new QueryRunner(${DataSource}); > // getting Query from propertues file to fetchBySubject > String sqlquery = PropertyFileUtil > .getPropertyValue("fetchbysubject.sql"); > [fetchbysubject.sql = SELECT * FROM DIGITAL_CERTIFICATE_CACHE WHERE > CERT_SUBJECT_NAME=? AND CERT_STATUS=?] > // preparing instance for Custom ResultSetHandler to process > // ResultSet > ResultSetHandler handler = new > DPIServicesDAOResultSetHandler(); > results = run.query(sqlquery, handler, new Object[] { > subjectname, > "I" }); > > > > Can somebody please point the problem. > Does it work, when you run the query via the command line? Regards, Benedikt -- http://people.apache.org/~britter/ http://www.systemoutprintln.de/ http://twitter.com/BenediktRitter http://github.com/britter
Re: Commons Lang substitution
Hello, 2015-11-14 22:25 GMT+01:00 Anthony Brice: > I could be wrong, but I do believe StrSubstitor requires a prefix and > suffix. I don't think the class will replace variables that aren't in the > map either, unless you write a custom StrLookup that returns an empty > string for variables not previously defined. > Yes, this is correct. The replace with blank could be implemented using a custom StrLookup. However, it is not possible to configure a StrSubstitutor to use only a starting character. Benedikt > On Sat, Nov 14, 2015 at 11:02 AM Alex Soto wrote: > > > Hi I have two special requirements that I think that Common-Lang > > StrSubstitutor does not cover, but I would like to know if it is correct > or > > not. > > > > The first requirement is that I would like to know if there is a way to > > make StrSubstitutor works with using simple character as prefix and no > > suffix. For example: > > > > "This is my $name and I am happy" > > > > I have tried by using new StrSubstitutor(map, "$", "") and > > StrSubstitutor(map, "$", " ") but no luck. > > > > I have tried with commons-lang and commons-lang3. > > > > The second one is that I would like to know if there is a way to force > that > > in case of no substitution found, the var is replaced with white space > > instead of untouch it. > > > > Thank you very much for your attention. > > > > Alex. > > > -- http://people.apache.org/~britter/ http://www.systemoutprintln.de/ http://twitter.com/BenediktRitter http://github.com/britter
Re: Commons Lang substitution
Benedikt Ritter wrote: > Hello, > > 2015-11-14 22:25 GMT+01:00 Anthony Brice: > >> I could be wrong, but I do believe StrSubstitor requires a prefix and >> suffix. I don't think the class will replace variables that aren't in the >> map either, unless you write a custom StrLookup that returns an empty >> string for variables not previously defined. >> > > Yes, this is correct. The replace with blank could be implemented using a > custom StrLookup. However, it is not possible to configure a > StrSubstitutor to use only a starting character. End "character" could be any non-alphanum character. Isn't it what the StrMatcher could be used for? Cheers, Jörg - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [dbutils] Issue when using more than 1 parameter in query
Yes it does work when done through sql developer command line , also tried from sql plus it works. The problem occurs only through dbutils. On Tue, Nov 17, 2015 at 12:33 AM, Benedikt Ritterwrote: > Hello Amol, > > 2015-11-10 21:03 GMT+01:00 Amol Kulkarni : > > > Hi, > > > > I am getting a ORA-00942: table or view does not exist when I query using > > dbutils api with 2 parameters. My enviroment si WAS 8.5.5 and oracle db > 11g > > > > I am using dbutils1.6 to make db calls. The problem occurs if I send two > > query parameters like SELECT * FROM DIGITAL_CERTIFICATE_CACHE WHERE > > CERT_SUBJECT_NAME=? AND CERT_STATUS=? Parameters: > [70-B3-D5-1F-30-4E-DF-20, > > I] . If I send only one SELECT * FROM DIGITAL_CERTIFICATE_CACHE WHERE > > CERT_SUBJECT_NAME=? Parameters: [70-B3-D5-1F-30-4E-DF-20] then query > > returns and application is working. My dbutils code is as follows > > > > > > > >QueryRunner run = new QueryRunner(${DataSource}); > > // getting Query from propertues file to fetchBySubject > > String sqlquery = PropertyFileUtil > > .getPropertyValue("fetchbysubject.sql"); > > [fetchbysubject.sql = SELECT * FROM DIGITAL_CERTIFICATE_CACHE WHERE > > CERT_SUBJECT_NAME=? AND CERT_STATUS=?] > > // preparing instance for Custom ResultSetHandler to process > > // ResultSet > > ResultSetHandler handler = new > > DPIServicesDAOResultSetHandler(); > > results = run.query(sqlquery, handler, new Object[] { > > subjectname, > > "I" }); > > > > > > > > Can somebody please point the problem. > > > > Does it work, when you run the query via the command line? > > Regards, > Benedikt > > > -- > http://people.apache.org/~britter/ > http://www.systemoutprintln.de/ > http://twitter.com/BenediktRitter > http://github.com/britter >
Re: [dbutils] Issue when using more than 1 parameter in query
Hello Amol, can you see the query being sent to your database in the query log? Maybe it is different from what you're expecting. Benedikt 2015-11-17 7:23 GMT+01:00 Amol Kulkarni: > Yes it does work when done through sql developer command line , also tried > from sql plus it works. The problem occurs only through dbutils. > > On Tue, Nov 17, 2015 at 12:33 AM, Benedikt Ritter > wrote: > > > Hello Amol, > > > > 2015-11-10 21:03 GMT+01:00 Amol Kulkarni : > > > > > Hi, > > > > > > I am getting a ORA-00942: table or view does not exist when I query > using > > > dbutils api with 2 parameters. My enviroment si WAS 8.5.5 and oracle db > > 11g > > > > > > I am using dbutils1.6 to make db calls. The problem occurs if I send > two > > > query parameters like SELECT * FROM DIGITAL_CERTIFICATE_CACHE WHERE > > > CERT_SUBJECT_NAME=? AND CERT_STATUS=? Parameters: > > [70-B3-D5-1F-30-4E-DF-20, > > > I] . If I send only one SELECT * FROM DIGITAL_CERTIFICATE_CACHE WHERE > > > CERT_SUBJECT_NAME=? Parameters: [70-B3-D5-1F-30-4E-DF-20] then query > > > returns and application is working. My dbutils code is as follows > > > > > > > > > > > >QueryRunner run = new QueryRunner(${DataSource}); > > > // getting Query from propertues file to fetchBySubject > > > String sqlquery = PropertyFileUtil > > > .getPropertyValue("fetchbysubject.sql"); > > > [fetchbysubject.sql = SELECT * FROM DIGITAL_CERTIFICATE_CACHE WHERE > > > CERT_SUBJECT_NAME=? AND CERT_STATUS=?] > > > // preparing instance for Custom ResultSetHandler to > process > > > // ResultSet > > > ResultSetHandler handler = > new > > > DPIServicesDAOResultSetHandler(); > > > results = run.query(sqlquery, handler, new Object[] { > > > subjectname, > > > "I" }); > > > > > > > > > > > > Can somebody please point the problem. > > > > > > > Does it work, when you run the query via the command line? > > > > Regards, > > Benedikt > > > > > > -- > > http://people.apache.org/~britter/ > > http://www.systemoutprintln.de/ > > http://twitter.com/BenediktRitter > > http://github.com/britter > > > -- http://people.apache.org/~britter/ http://www.systemoutprintln.de/ http://twitter.com/BenediktRitter http://github.com/britter