Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Unable To Connect The MS SQL Server(Unable To Connect The MS SQL Server)
Unable To Connect The MS SQL Server [message #1815845] Sat, 12 October 2019 16:18 Go to next message
Mukesh Lekhrajani is currently offline Mukesh LekhrajaniFriend
Messages: 12
Registered: May 2018
Junior Member
Hello Team Eclipse !

I tried all possible options, searched on google for 2+ hours - but could not connect to MS SQL Server 2017 from Java.

Here are the details :

Instance Name : DESKTOP-2LFJRMD
Database Name : Test_Learning
JAR Files : mssql-jdbc-7.4.1.jre12.jar & mssql-jdbc-7.4.1.jre12-shaded.jar

Code :

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.SQLException;

public static void main(String[] args) {
String varConnectionString;
Connection varConnection;
String varUser;
String varPass;
varConnectionString = "jdbc:sqlserver://DESKTOP-2LFJRMD\\databaseName=Test_Learning";
varUser = "sa";
varPass = "Mukesh@1507";
try
{
varConnection = DriverManager.getConnection
(
varConnectionString,
varUser,
varPass
);
System.out.println("Yesss, Connected");
}
catch(SQLException e)
{
System.out.println("Oh No, Connection Failed");
e.printStackTrace();
}
}
}


Error Message :

Oh No, Connection Failed
java.sql.SQLException: No suitable driver found for jdbc:sqlserver://DESKTOP-2LFJRMD\databaseName=Test_Learning
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at MakeConnectionToSQL.main(MakeConnectionToSQL.java:34)

Please Help..



Thanks,
Mukesh Lekhrajani.
Re: Unable To Connect The MS SQL Server [message #1815846 is a reply to message #1815845] Sat, 12 October 2019 16:59 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33252
Registered: July 2009
Senior Member
This isn't a forum about general Java questions, it's a forum for asking specifically about Eclipse's Java Development Tools. Try something like StackOverflow or ask wherever you got this jar from.

Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Next Button Event Listener - JFace Wizard
Next Topic:PERSPECTIVES
Goto Forum:
  


Current Time: Tue Nov 05 16:31:40 GMT 2024

Powered by FUDForum. Page generated in 0.03193 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top