connecting to SQL Server from Netbeans

前端 未结 2 1441
轻奢々
轻奢々 2021-01-16 04:03

I am trying to connect to a server instance of SQL Server 2010 that I installed recently using NetBeans. I have downloaded the latest JDBC driver for MS SQL Server, but I ca

相关标签:
2条回答
  • 2021-01-16 04:39

    This should help:

    http://netbeans.org/kb/docs/java/gui-db.html

    Edit: As per comment below this was for derby stuff. Here is a more useful link but it's not got any information on supplying the DB username or password. It might be enough depending on your exact requirement.

    0 讨论(0)
  • 2021-01-16 04:41

    Port number should normally be 1433 for MSSQL, but often, this may not even be specified, so to do that you would need to:

    1. Open Microsoft SQL Configuration Manager
    2. Find 'SQL Server Network Configuration' on the left pane and expand it
    3. Select 'Protocols for
    4. Right-click TPC/IP on the right and select properties
    5. Make sure Enabled and Listen All have Yes chosen in the Protocol tab
    6. Select the IP Addresses tab and scroll to the end where IPAll is.
    7. Type in 1433 in TCP Dynamic Ports and leave TCP Port empty
    8. Click OK then select SQL Server Services on the left pane
    9. Right-click on 'SQL Server (YOU SERVER NAME)' and click Restart

    The instance name is not necessary, it can be left blank.

    Now for Username:

    Note that what comes after // (jdbc:sqlserver://) is usually the host and not your username.

    1. Open Microsoft SQL Server Management Studio
    2. Right-click on the server and click properties
    3. Go to Security and choose 'SQL Server and Windows Authentication mode'
    4. You will get a warning asking you to restart your server. Ignore this for now and go back into Microsoft SQL Server Management Studio
    5. Expand 'Security' then expand 'Logins'
    6. You will find the default user called 'sa', right-click on it and select Properties
    7. In General you can enter a password of your choice, enter the same password in Confirm Password
    8. Click 'Status' on the left and make sure Login is 'Enabled' then OK everything!

    Go back into NetBeans and try to connect again. This time using Port 1433, nothing for Instance Name, username as 'sa' and password . Test the connection to ensure you get no errors. Good luck.

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