This discussion is archived
7 Replies Latest reply: Jan 19, 2012 11:01 AM by 912166 RSS

Can not connect to sql server on port 1433

user13178709 Newbie
Currently Being Moderated
guys ,I'm using oracle sql developer on mac os x and I'm trying to connect to sql server on port 1433 but it always fails...any ideas ?
  • 1. Re: Can not connect to sql server on port 1433
    mkirtley-Oracle Expert
    Currently Being Moderated
    Hi,
    Are you trying to do this as part of a migration ?
    Have you followed the necessary setup steps for a connection to SQL*Server as shown in the documentation -

    Oracle® SQL Developer
    User’s Guide
    Release 2.1

    1. Ensure that the source database is accessible by the Microsoft SQL Server or
    Sybase Adaptive Server user that is used by SQL Developer for the source
    connection. This user must be able to see any objects to be captured in the
    Microsoft SQL Server or Sybase Adaptive Server database; objects that the user
    cannot see are not captured. For example, if the user can execute a stored
    procedure but does not have sufficient privileges to see the source code, the stored
    procedure cannot be captured.
    2. Ensure that you can connect to the Microsoft SQL Server or Sybase Adaptive
    Server database from the system where you have installed SQL Developer.
    3. Ensure that you have downloaded the JTDS JDBC driver from
    http://jtds.sourceforge.net/.
    4. In SQL Developer, if you have not already installed the JTDS driver using Check
    for Updates (on the Help menu), do the following:
    a. Click Tools, then Preferences, then Database, then Third Party JDBC Drivers.
    b. Click Add Entry.
    c. Select the jar file for the JTDS driver you downloaded from
    http://jtds.sourceforge.net/.
    d. Click OK.
    5. In SQL Developer, click Tools, then Preferences, then Migration: Identifier
    Options, and ensure that the setting is correct for the Is Quoted Identifier On
    option (that is, the setting reflects the database to be migrated).
    If this option is enabled, quotation marks (double-quotes) can be used to refer to
    identifiers; if this option is not enabled, quotation marks identify string literals. As
    an example of the difference in behavior, consider the following T-SQL code:
    select col1, "col 2" "column_alias"

    And if so, what error do you get ?

    Regards,
    Mike
  • 2. Re: Can not connect to sql server on port 1433
    mkirtley-Oracle Expert
    Currently Being Moderated
    One other question - is SQL*Server using port 1433 ? It is the default but you need to check in case it has been changed.

    We need to ask the obvious !

    Regards,
    Mike
  • 3. Re: Can not connect to sql server on port 1433
    user13178709 Newbie
    Currently Being Moderated
    Hey mike, thanks alot for ur reply.
    the thing is I'm trying to make a new connection for SQL Server but the process always fails. First, I click on the button "new" then I choose "database connection" and I click on the SQLServer tab. I check the box windows authentication and I specify the hostname as localhost, port as 1433 the port number was there the first time I tried to make a new connection I guess and I leave the windows domain name empty...the error is "Status : Failure- Test failed: Cannot connect to Microsoft SQL Server on localhost"...btw, I followed all the directions in the documentation...waiting for ur reply :)

    Regards,
    Ismail
  • 4. Re: Can not connect to sql server on port 1433
    mkirtley-Oracle Expert
    Currently Being Moderated
    Ismail,
    I don't have a Mac box to test but I've tried reproducing on Windows.
    I didn't use Windows Authentication as I haven't setup my system for that, and get a SSO error which is different from the one you report.
    The only way I get the same error as you -

    Status : Failure- Test failed: Cannot connect to Microsoft SQL Server on localhost

    is when I use an incorrect port number for the connection or if SQL*Server is not started.
    Could you check that your SQL*Server database is started and is using port 1433 ?
    There should be a SQL*Server network utility that you can use to check the port for TCP connections.
    Could you also -

    - not use Windows authentication
    - use a valid SQL*Server user and password in the connection setup - remember these are case sensitive
    - make sure SQL*Server is started
    - that it uses port 1433

    If you still have problems instead of localhost use the action hostname name of the machine where SQL*Server is running including the domain.
    On my Widows setup I do not get an option to enter domain details.

    Regards,
    Mike
  • 5. Re: Can not connect to sql server on port 1433
    user13178709 Newbie
    Currently Being Moderated
    Mike, Thanks a lot for your concern. I still have no idea what to do but I'll keep u updated with the new updates if there are any :)

    Best Regards,
    Ismail
  • 6. Re: Can not connect to sql server on port 1433
    mkirtley-Oracle Expert
    Currently Being Moderated
    Ismail,
    All I can suggest is the following -

    - confirm SQL*Server is using port 1433
    - use the full hostname instead of localhost
    - make sure SQL*Server is started
    - use a valid SQL*Server user/password for the connection and not Windows Authentication
    - do not check the 'Windows Authentication' or 'Default Password' options

    If that doesn't work then perhaps it is something specific to running on a Mac.

    Regards,
    Mike

    Edited by: mkirtley on Jun 7, 2010 2:27 PM
  • 7. Re: Can not connect to sql server on port 1433
    912166 Newbie
    Currently Being Moderated
    While this is probably no longer helpful to the original poster, it was still an issue for me and I believe I have found the answer.

    Using SQL Developer for Mac OS X to connect to MS SQL databases that require Windows Authentication using the jTDS driver, for some reason checking the "Use Windows Authentication" doesn't work. When I checked the logs on my sql server it was complaining that the login was using an NT account with SQL Authentication. The Use Windows Authentication was checked and all other settings were correct.

    I decided to poke around and find out what connection string was being used. If you look in ~/sqldeveloper/system3.0.04.34/o.jdeveloper.db.connection.11.1.1.4.37.59.31/connections.xml (There may be some variations in the path based on version of sql developer you are using) you can find an object called <StringRefAddr addrType="customURL"> The contents of which will look something like "jdbc:jtds:sqlserver://[server]:[port]/[database]". This is the connection string. If you add on to the end of it ";domain=[domain]" so that the whole string looks like the following then windows authentication works

    jdbc:jtds:sqlserver://[server]:[port]/[database];domain=[domain]

    This is because, the JTDS driver will use sql authentication if that domain is not set and presumably sql developer isn't doing that. I'm not sure if the problem is with the jTDS or sql developer, but once I made the change, I was able to login just fine. Hope this helps.

    Edited by: 909163 on Jan 19, 2012 11:01 AM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points