• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver

 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I follow the sample in
https://spring.io/guides/gs/accessing-data-mysql/
it run successfully, then I try to change it to connect to my local sql server, so I add

in pom.xml, and in application.properties, I change it to

and then in my run configuration, I kept it unchange, that is,
java 17, -cp accessing-data-mysql-complete
com.example.accessingdatamysql.AccessingDataMysqlApplication


then I run this configuration, but now error:


java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:467) at org.springframework.util.ClassUtils.forName(ClassUtils.java:283) at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.driverClassIsLoadable(DataSourceProperties.java:190) at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.determineDriverClassName(DataSourceProperties.java:171) at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.initializeDataSourceBuilder(DataSourceProperties.java:123) at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration.createDataSource(DataSourceConfiguration.java:48) at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari.dataSource(DataSourceConfiguration.java:90) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) .......



is shown, why? the same run configuration is success to run the mysql sample.

2) and in intellij console, I cannot see what classpath it is using, any method to show the classpath this run configuration is using?

3) in intellij project settings > Modules > Dependencies, I just see
Maven: com.mysql:mysql-connector-j:8.0.31
but no
mssql-jdbc
although my pom.xml has it, why?


 
peter tong
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
after change pom.xml, need reload the maven project
https://www.jetbrains.com/help/idea/delegate-build-and-run-actions-to-maven.html#maven_reimport
or set auto reload as in above url
 
You totally ruined the moon. You're gonna hafta pay for that you know. This tiny ad agrees:
Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders
https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing
reply
    Bookmark Topic Watch Topic
  • New Topic