com microsoft sqlserver jdbc SQLServerDriver not found error

0 votes

I'm having the same issue as this thread. while trying to connect from Java to my SQL Server 2008 database.

String userName = "xxxx";
String password = "xxxx";
String url = "jdbc:sqlserver:xxx.xxx.xxx.xxx;databaseName=asdfzxcvqwer;integratedSecurity=true";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
connection = DriverManager.getConnection(url, userName, password);

I keep getting a ClassNotFoundException Whenever I try to load the driver from Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1713)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1558)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at repositories.RepositoryBase.<init>(RepositoryBase.java:22)
    at repositories.ProductsRepository.<init>(ProductsRepository.java:13)
    at api.Products.init(Products.java:31)
    at javax.servlet.GenericServlet.init(GenericServlet.java:160)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:865)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:136)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

The required jdbc and jtds drivers have been added to the library, and CLASSPATH has also been established. Sincerely, I have no idea what went wrong.enter image description here

Edit: Upon suggestion, I tried to download this jdbc jar and place it in my WEB-INF/lib, then set my CLASSPATH variable to that location. Still, the same problem is happening.enter image description here

Can someone please help me with this?

Sep 6, 2022 in Database by Kithuzzz
• 38,020 points
728 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Database

0 votes
1 answer

Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452) in sql 2008

Solution Go to Start > Programs > Microsoft SQL Server > Enterprise Manager. Right-click the SQL ...READ MORE

answered Sep 12, 2022 in Database by narikkadan
• 63,680 points
1,063 views
0 votes
3 answers

MySQL "Could not create connection to database serve" error

Pls check that you have MySQL server ...READ MORE

answered Jul 3, 2020 in Database by anonymous
29,832 views
0 votes
1 answer
0 votes
0 answers

org.hibernate.exception.SQLGrammarException:Could not execute JDBC batch update

I am using Hibernate to extract a ...READ MORE

Aug 9, 2022 in Database by Kithuzzz
• 38,020 points
2,939 views
0 votes
0 answers

Login to Microsoft SQL Server Error: 18456

When I try to connect to the SQL ...READ MORE

Aug 14, 2022 in Database by Kithuzzz
• 38,020 points
579 views
0 votes
0 answers

SQLException: No suitable Driver Found for jdbc:oracle:thin:@//localhost:1521/orcl

I'm attempting to create a Java EE ...READ MORE

Aug 15, 2022 in Database by Kithuzzz
• 38,020 points
689 views
0 votes
0 answers

SqlServer: Login failed for user

I created a pretty straightforward JDBC login ...READ MORE

Aug 26, 2022 in Database by Kithuzzz
• 38,020 points
607 views
0 votes
1 answer

How to retrieve column names from java.sql.ResultSet?

You may refer the below code: ResultSet ...READ MORE

answered Jul 4, 2018 in Java by sophia
• 1,400 points
2,827 views
0 votes
1 answer

Establish JDBC Connection in R through single sign-on

You can certainly connect to databases with ...READ MORE

answered Sep 12, 2018 in AWS by Priyaj
• 58,100 points
2,458 views
0 votes
1 answer

Find Oracle JDBC driver in Maven repository

Download the jar and place it in ...READ MORE

answered Sep 26, 2018 in Java by Daisy
• 8,140 points
3,252 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP