[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 65
  • Last Modified:

Getting error trying to connect to SQL Server using java

Trying to connect to a SQL Server database from our internal web portal.
This is what I'm getting:
An error occurred at line: 1,694 in the jsp file: /accountDetail.jsp
DriverManager cannot be resolved
1691: Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
1693: String connectionUrl = "jdbc:sqlserver://HNCIISDEV;" + "databaseName=WebPortal;user=" + login + ";password=" + pass;
1694: con = DriverManager.getConnection(connectionUrl);
1695: }
1696: catch(ClassNotFoundException cnfex)
1697: {

Any ideas what my developer is missing?
Brian Sandt
Brian Sandt
  • 2
1 Solution
Pawan KumarDatabase ExpertCommented:
IS your connection string correct. In most of the cases connection string seems to be incorrect.

For connection string please refer - https://www.connectionstrings.com/sql-server/
Nakul VachhrajaniTechnical Architect, Capgemini IndiaCommented:
It looks like your environment does not have the JDBC driver for SQL Server installed. Can you please try installing it? https://msdn.microsoft.com/en-us/library/mt484311(v=sql.110).aspx
Brian SandtSystems AdministratorAuthor Commented:
The JDBC driver was installed.  

Sending my developer the link for the connection string.
Brian SandtSystems AdministratorAuthor Commented:
Developer was finally able to get it working.

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now