i want to connect to SSMS database from eclipse but it throws SQLserverException

后端 未结 2 809
一整个雨季
一整个雨季 2021-01-28 18:12

I want to connect to SSMS database from eclipse. when compiler reaches to DriverManager.getConnection(url) line it throws error.I enable TCP/IP also but it giving e

相关标签:
2条回答
  • 2021-01-28 18:59

    If "MSSQLSERVER" is the name of the database then try

     "jdbc:sqlserver://localhost;databaseName=MSSQLSERVER;user=sa;password=coder182"
    

    if it is the name of the instance try

     "jdbc:sqlserver://localhost;instanceName=MSSQLSERVER;user=sa;password=coder182"
    

    and of course verify that the server is running and using port 1434

    0 讨论(0)
  • 2021-01-28 19:06
    • open SQL Server Configuration Manager
    • SQl Server Network Configuration
    • protocols for MSSQLSERVER
    • TCP/IP(Must be enabled already or enable it)
    • (Double Click)
    • IP Addresss
    • scroll down to IPALL
    • Enter port number 1433 or 1434 and leave dynamic ports empty and apply setting and restart your service

    And you must specify databaseName you want to connect

    "jdbc:sqlserver://localhost;instance=MSSQLSERVER;databaseName=name_of_database;user=sa;password=your_password;"
    

    Mark answer as accepted if issue resolved

    0 讨论(0)
提交回复
热议问题