Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Cecil Westerhof Newsgroups: comp.lang.java.programmer Subject: Re: Which databases are the most used with Java Date: Tue, 15 Aug 2017 14:15:40 +0200 Organization: Decebal Computing Lines: 26 Message-ID: <87inhpni1f.fsf@munus.decebal.nl> References: <87y3qovwjb.fsf@munus.decebal.nl> <87tw1bx2c9.fsf@munus.decebal.nl> <87a833wzcx.fsf@munus.decebal.nl> <87pobz9yv5.fsf@munus.decebal.nl> <87h8x9pfi8.fsf@munus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="72fb8bea0235c6b94245dccb186de60d"; logging-data="13693"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/CxDyIz6CcN2VvWyaeo8QfpurykypfBzs=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-Homepage: http://www.decebal.nl/ Cancel-Lock: sha1:/TO0jQqvmYn3omhJdyaIOvx5xSI= sha1:B8syjHce1ccknlK/8L9/mSFePvI= Xref: csiph.com comp.lang.java.programmer:37233 Martin Gregorie writes: > On Tue, 15 Aug 2017 07:27:27 +0200, Cecil Westerhof wrote: > >> That is certainly interesting, but that extends PreparedStatement, not >> Statement. >> > Slightly OT, but PreparedStatement() is to be preferred to > Statement.execute() especially if any part of the SQL query originates > outside the application executing it. There are two reasons for this: I agree wholeheartedly, but I have queries that are hard coded. For example: SELECT COUNT(*) as count FROM usedProverbs I do not think I should use a PreparedStatement there. When there is input (even if it is generated by my own program) I always use PreparedStatement. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof