Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8068779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:48:05+00:00 2026-06-05T12:48:05+00:00

in my java code JDBC driver class is not supported with ms sql server

  • 0

in my java code JDBC driver class is not supported with ms sql server 2008 while it works perfectly with ms sql server 2005

i have put jdbc driver class “com.microsoft.sqlserver.jdbc.SQLServerDriver”

MY CODE IS

import java.sql.*;

  public class MysqlConnect{
  public static void main(String[] args) {
  System.out.println("MySQL Connect Example.");
  Connection conn = null;
  String url = "jdbc:sqlserver://SQLSERVERIP:1433;";
  String dbName = "DatabaseName=DBNAME";
  String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
  String userName = "sa"; 
  String password = "password";
  try {
  Class.forName(driver).newInstance();
  conn = DriverManager.getConnection(url+dbName,userName,password);
  System.out.println("Connected to the database");
  conn.close();
  System.out.println("Disconnected from database");
  } catch (Exception e) {
  e.printStackTrace();
  }
 }
}    

while i am trying to connect it gives an error

com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open database "hj_cnb_ci
" requested by the login. The login failed.
        at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError
(SQLServerException.java:197)
        at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:246
)
        at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:83)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerC
onnection.java:2529)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConne
ction.java:1905)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServer
Connection.java:41)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecu
te(SQLServerConnection.java:1893)
        at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4615)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLSe
rverConnection.java:1400)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLSer
verConnection.java:1045)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConne
ction.java:817)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerCon
nection.java:700)
        at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.
java:842)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at MysqlConnect.main(MysqlConnect.java:14)

plz help me to sort out this issue..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T12:48:07+00:00Added an answer on June 5, 2026 at 12:48 pm

    Please check your jdbc driver version. “Microsoft JDBC Driver 4.0” is suitable for your ms sql server 2008.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a java code to connect with MS SQL Server 2005. MS
I am working on a Java project for class and have not worked much
Possible Duplicate: ClassNotFoundException com.mysql.jdbc.Driver I have included the mysql-connector-java-5.1.16-bin.jar into my Eclipse library, this
I am trying to connect the sql server 2008 with servlet.this is my code.
Lets say i have the following bit of code import java.sql.Connection; import java.sql.DriverManager; import
I have some Java code which performs bitwise operations on a BitSet. I have
I have this Java code, and I want to do the same thing in
In my Java code, I occasionally run into situations where I have to catch
I have some Java code that is throwing out of memory exceptions after running
In my Java code I have function that gets file from the client in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.