Solved

Getting error trying to connect to SQL Server using java

Posted on 2016-09-30
4
39 Views
Last Modified: 2016-10-11
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");
1692:
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?
0
Comment
Question by:Brian Sandt
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
Pawan Kumar Khowal earned 500 total points
ID: 41824370
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/
0
 
LVL 11

Expert Comment

by:Nakul Vachhrajani
ID: 41824735
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
0
 

Author Comment

by:Brian Sandt
ID: 41826174
The JDBC driver was installed.  

Sending my developer the link for the connection string.
0
 

Author Closing Comment

by:Brian Sandt
ID: 41838820
Developer was finally able to get it working.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now