Answer the question
In order to leave comments, you need to log in
Java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver?
Hello everyone, I ask for help.
I am writing a project on vaadin flow.
Java 1.8
I'm trying to connect to MSSQL, I get a message like:
"java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver"
I connected mssql-jdbc both via maven and as a regular library.
Here is the code:
.......
Driver d = (Driver)Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
con = DriverManager.getConnection(connectionUrl,"login","pass");
stmt = con.createStatement();
.......
Answer the question
In order to leave comments, you need to log in
When IDEA runs your program, it ensures that the dependencies it needs are in the CLASSPATH. When the application server launches it, it does not and the program crashes because it cannot find the jdbc driver jar file. Read the instructions for your server, find out where to put the dependency jar files.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question