Comments (9)
Hey Alen,
All good now, thank you
Best Regards,
Ciprian
from distributed-lock.
same issue with sqlserver:
org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [DELETE FROM `locked` WHERE expireAt < ?;]; SQL state [S0001]; error code [102]; Incorrect syntax near '`'.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '`'.
at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1542)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:667)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:960)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:1015)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:1025)
at com.github.alturkovic.lock.jdbc.service.SimpleJdbcLockSingleKeyService.acquire(SimpleJdbcLockSingleKeyService.java:51)
from distributed-lock.
I currently don't have the time to tackle this, if any of you have time to solve this, I would be happy to merge a PR.
from distributed-lock.
Hi Guys,
I tried to create a pull request, but I've got some errors. Maybe it is because of firewall issues.
Please find bellow the queries tested with oracle:
public static final String ACQUIRE_FORMATTED_QUERY = "INSERT INTO %s (lock_key, token, expireAt) VALUES (?, ?, ?)";
public static final String RELEASE_FORMATTED_QUERY = "DELETE FROM %s WHERE lock_key = ? AND token = ?";
public static final String DELETE_EXPIRED_FORMATTED_QUERY = "DELETE FROM %s WHERE expireAt < ?";
public static final String REFRESH_FORMATTED_QUERY = "UPDATE %s SET expireAt = ? WHERE lock_key = ? AND token = ?";
Best Regards,
Ciprian
from distributed-lock.
@cipianpascu that was the first version of the queries. The issue is that INSERT INTO %s
gets resolved into INSERT INTO lock
and lock
is a keyword in MySQL so it has to be escaped.
The current issue is that different databases escape keywords differently. So ` (backtick escape) is breaking PSQL syntax.
from distributed-lock.
Oh, I didn't know. But that is a small/corner case. No one will use the name 'lock' in production for a table. I propose to change the default to something else. For example 'tbl_lock' or 'table_lock' or anything else that is not interfering with the sql sintax.
from distributed-lock.
Should be fixed in 1.5.0, I decided to change the default table name as suggested to avoid further complications
from distributed-lock.
not yet. sadly I get ORA-00933: SQL command not properly ended in this moment
from distributed-lock.
It seems like it might be due to the semicolon at the end? I released a new fix version, could you try with that one? (1.5.1)
from distributed-lock.
Related Issues (20)
- Allow re-entrant code within same Thread? HOT 9
- Need a help HOT 13
- `scriptExecutor` of `RedisTempate` is null HOT 1
- JDBC lock is not working with MySql due to wrong SQL syntax
- MongoLocked: Don't retry on "fail to acquire" HOT 2
- Cant create a table with reserved name 'lock' for jdbclock as HOT 1
- Need a hand :) ! HOT 3
- Null lock token versus LockNotAvailableException HOT 4
- "RetriableLock should return null if lock is not acquired after the last retry" - ok.. but why? HOT 2
- RedisLock throws RedisReadOnlyException when using RedisStaticMasterReplicaConfiguration and ReadFrom.REPLICA_PREFERRED HOT 2
- Importing the whole library causes auto wiring issues in Spring Boot HOT 5
- Does it Support Spring Boot 3 ? HOT 7
- Getting Started HOT 2
- Option not to throw exception on lock fail HOT 1
- JDBC Manual Controlled Lock HOT 4
- Testing Annotated Locks HOT 8
- What is the reason behind only using JitPack? HOT 1
- About throwing option added in recent PR HOT 1
- Wrong documentation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from distributed-lock.