B4J Library SQLiteJDBC and slf4j

Hi all!

An important observation about SQLiteJDBC.

Starting with version 3.43.2.0, the authors of the SQLiteJDBC library added the SLF4J logging framework as a dependency. You can find more information about this HERE.
Therefore, applications using SQLiteJDBC version 3.43.2.0 and higher must add references to the following SLF4J libraries (latest stable version files):
slf4j-api-2.0.13.jar
slf4j-nop-2.0.13.jar

Download files; save in your additional libraries folder and add the following lines to your project:
B4X:
#AdditionalJar: slf4j-api-2.0.13
'The reference to slf4j-nop is not mandatory. However SLF4J will issue a warning, that can be ignored.
'So, for a cleaner log add this 
#AdditionalJar: slf4j-nop-2.0.13.jar

Main repository of SLF4 files can be found HERE.

I should have posted this when version 3.43.2.0 was released, but I totally forgot to do so.
I do apologize for my forgetting! ?

Regards!
 
Last edited:

aeric

Expert
Licensed User
Longtime User
Yes. This has been reported previously.
 

tchart

Well-Known Member
Licensed User
Longtime User
According to Maven Xerial is using 1.7.36 of SLF4J

I just tested and all thats needed is the one AdditionalJar

The code below works in debug and release modes.

1716841429918.png
 

Claudio Oliveira

Active Member
Licensed User
Longtime User
Yes. This has been reported previously.
True!
Actually I liked your reply to that thread and it put me in the right direction for solving my own problem with SQLiteJDBC.
I've prepared this post of mine a long time ago and have forgotten to send it to the forum. Shame on me!
Today I updated those links and posted it.
Better late than never. ?
Thanks, @aeric!
 
Last edited:

Claudio Oliveira

Active Member
Licensed User
Longtime User
According to Maven Xerial is using 1.7.36 of SLF4J

I just tested and all thats needed is the one AdditionalJar

The code below works in debug and release modes.

View attachment 154079
Yeah, on version 3.43.2.1 they did a downgrade on dependency to SLF4J version 1.7
Maybe this is the reason why your code works fine.
I'm not sure it'll work with later versions of SLF4J. Never tried actually.
I'll give it a shot...

Thanks @tchart!
 

Claudio Oliveira

Active Member
Licensed User
Longtime User
I'll give it a shot...

I've tested your code with different versions of SLF4J: 1.7.9, 2.0.9, 2.0.12 and 2.0.13
Truth is, your code worked fine with all of them, still the warning below is issued every time:

Captura de tela 2024-05-27 185452.png

It can be ignored, of course. But adding
B4X:
#AdditionalJar: slf4j-nop-1.7.9
I get no warnings whatsoever. Cleaner log, as I like.

So, I it's proven unnecessary to add a reference to slf4j-sdk, opposite to what I stated in the first post - which I will edit right away to correct this erroneous information.

Thanks again, @tchart!
 

tchart

Well-Known Member
Licensed User
Longtime User
So, I it's proven unnecessary to add a reference to slf4j-sdk, opposite to what I stated in the first post - which I will edit right away to correct this erroneous information.
One last thing, Ive just tested adding the "slf4j-nop" jar to my project that was showing that error.

With a "slf4j-nop" 1.7.x version those warnings arent shown.

With a "slf4j-nop" 2.x version those warnings are shown.

So it comes down to what version of sl4j the author is using as 2.x doesnt seem to stop the messages on older versions.
 

Claudio Oliveira

Active Member
Licensed User
Longtime User
I think you must use the same version as slf4j-api.
If you're using slf4j-api-1.7.9 you should use slf4j-nop-1.7.9 as well. Using a higher version doesn't work as expected.
On the other hand, if you're using slf4j-api-2.x then you can use slf4j-nop-1.x, and it works. Sort of backward compatibility. I think I've tested this. Not sure, though. Done so many tests that I'm a bit confused now. ?
 
Top