Skip to content
Advertisement

Tag: java

Replace Parameters in SQL query text with XXXXX

I m writing a small utility that captures and logs SQL statements, but will have to remove sensitive data from the Query text and replace with with some dummy text (i.e:XXXXX). What is a good way to parse the SQL query in java and replace parameters value? for example: replace with Answer Using JSQLParser (V0.8.9) this is a solution for

How would I write SELECT TOP 25 sql query in Spring data repository

A quick question, because I am sure this is something silly. I have the following query which I can execute in NetBeans sql command window: My goal is to put put it in my ArcustRepository class: public interface ArcustRepository extends JpaRepository { However, that findBytop query doesn’t seem to work and when I start my service with tomcat7 returns this:

How to use named parameter in plain sql with jooq

I’m using JOOQ with plain/raw SQL, so that means i’m not using any code generation or the fluid DSL thingy. The following code works: Now let’s say i have a query with multiple parameters like this: How do i use a named parameter with these types of queries? I’m thinking something like : But the above code doesn’t work (for

Extract SQL statements from Java/SQL files

I have a huge codebase that has a lot of JAVA and .sql files. I intend to extract all the SQL statements from all these files. Here is the way I intend to achieve this – Build a regex file containing patterns like select, insert, delete, update etc that I intend to extract. Parse files line by line in code

Advertisement