MYSQL Connector Driver Issue
Hi, I'm trying to implement an sql database, but I'm only getting the "No suitable driver found", anyone knows why it could be?
implementation group: 'com.mysql', name: 'mysql-connector-j', version: '9.1.0'
Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/name?user=user&password=password37 Replies
ā
This post has been reserved for your question.
Hey @ponchisao326! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
Hey @ponchisao326
Use Class.forName("com.mysql.cj.jdbc.Driver"); to load driver.
š¤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
that's no longer necesary in modern sql connector versions, however I already tryed it with no result
š¤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
no result meaning same exception or different exception?
same exception š«
I mean, it just says "no suitable driver found for com. mysql.cj.jdbc.Driver"
wait, is it really that exact text?
not something like
no suitable driver found for jdbc:mysql:...
?
How are you running the project?with the class.forName is what I said
on Intellij with Gradle
Did it really not say
ClassNotFoundException
?
Can you show the full stack trace?let me check again
Okay, let me code it again and I will show you
this is with the class.forName
This without the class.forName
oh this is a Minecraft thing
make sure the JDBC driver is available at runtime
like when the mod or whatever it is is loaded, make sure the JDBC driver is loaded with it
how can I make that?
idk how Minecraft does it
haha
maybe you need to add the JAR to the directory
maybe it has a specific Gradle thing you have to mark the dependency with
(i.e. maybe
implementation
may be the wrong option)I tryed with runtimeOnly & compileOnly
aswell as with implementation
like maybe there's a directory where you should put libs in
maybe you have a config file where you also have to specify necesssary dependencies
I think that's not possible in minecraft modding
š«
idk how Minecraft modding works
I know your point and its a good option, but I don't think there's a way to do that on minecraft modding
though actually there is something you could maybe do
My last option is to use an sqlite file and send it to the server via sftp or smth
but I don't even know if it would be a good option though
Can you run
Class.forName("com.mysql.cj.jdbc.Driver", true, getClass().getClassLoader());
?yeah, on my way
Caused by: java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver
Did you still have the old
Class.forName
in it?nope, I've replaced it
š¤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
Okay, I've tryed in another project with maven and it's working, I don't know why
I have the same thing on the two projects
but it's not working
š«
I think it's probably because of how Minecraft loads stuff
yeah, I think so
or maybe a gradle problem
but I don't know
Okay, definitely is a minecraft forge problem
You could try printing
JdbcConnection.class
and check what happens with thatgonna try
š¤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.