Languages

Spring Boot 2 - JdbcTemplate throws: java.sql.SQLException: Before start of result set

4 points
Asked by:
Abel-Burks
758

I have trouble uring JdbcTemplate query() function getting single result from ResultSet.

This is exception I got:

This is stack trace:

SQL query I used:

My java source code:

1 answer
5 points
Answered by:
Root-ssh
178180

In the above case you need to call resultSet.next() function before calling resultSet.getLong(1) function.

Fixed source code:

0 commentsAdd comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join