Solving SQL Server Connection Problem

Written Date: September 7, 2009
User Rating: / 71 Hits: 92,968
Add your comment

Upon database modeling with the ORM feature, you always need to connect to the server. However, you may encounter problem in connecting to the SQL server, which is great obstruction to your modeling. In this article, we will provide ways to help you to check whether your configurations for connecting to SQL Server are correct.

There are three significant aspects that uses may neglect, leading the failure of the connection to the SQL Server.

Server Settings

Enable TCP/IP

  1. Open your SQL Server Configuration Manager.
    open sql config manager
  2. Expand SQL Server Network Configuration and select Protocols for SQLEXPRESS.
    sql network config express
  3. Take a look at TCP/IP, which requires to be Enabled. If yours is Disabled, right-click on it and select Enable in the popup menu.
    enable tcp ip
  4. Also, you may take a look at the Port setting of your server. Right-click on TCP/IP and select Properties in the popup menu.
    right click tcp ip properties
  5. Click the IP Address tab in the TCP/IP Properties dialog box.
    click ip address tab
  6. Under IPAll section, you can see the TCP Port (default: 1433) and you can edit the port of your server.
    tcp port

Correct Hostname and Port

Back to your VP application, have a check in your database configuration and see if you have entered the Hostname and Port correctly.

  1. Select Tools > Object-Relational Mapping (ORM) > Database Configuration in the VP application.
    tool orm db config
  2. Select the Language, server and the driver in the Database Configuration dialog box.
    select lang server driver
  3. Enter Hostname, which must be either the IP address of your computer or your computer name.
    db config hostname
  4. Enter the port of your SQL Server. It's 1433 by default, but if you have edited the port for your SQL Server or running on other named instance, you need to enter the corresponding port.
    db config port

Allow Remote Connection

Your need to make sure that remote connection to your SQL Server is enabled.

  1. Startup your SQL Server.
    start sql server
  2. Right-click on the server and select Properties in the popup menu.
    right click sql server properties
  3. In the Server Properties dialog box, select Connections.
    select connection
  4. Check the checkbox of Allow remote connections to this server.
    check allow remote connection

Diagnosis of Connection in Command Line

You can diagnose whether your SQL Server is in-use by the command line. For Windows Vista, Telnet is not installed by default, you need to install it before running the telnet command.

Install Telnet Client in Windows Vista

  1. Open Control Panel from the Start Menu.
    control panel
  2. Select Programs in the Control Panel.
    select programs
  3. Under Programs and Features, select Turn Windows features on or off.
    select turn on off win features
  4. Scroll down to find the option Telnet Client, check this option and press OK.
    select telnet client

Run Telnet Command

  1. Shutdown your SQL Server first and launch the command prompt.
  2. Enter telnet %host% %port% in the command prompt, where %host% and %port% are the host and port of your SQL Server.
    enter telnet msg in command
  3. Press Enter to see if it can call the SQL Server. If telnet can communicate with the host and port you specified, it will show a blank dialog box. This means your SQL Server is able to be connected.
    telnet succeed connect to sql
    If it fails to connect to your SQL Server, there will be message of the failure.
    telnet cannot connect to sql

Authentication Method

Make sure that you are using the appropriate authentication method in connecting to your SQL Server.

  1. Startup your SQL Server.
    start sql server
  2. Right-click on the server and select Properties in the popup menu.
    right click sql server properties
  3. In the Server Properties dialog box, select Security.
    select security
  4. Normally, the Server Authentication is set to SQL Server and Windows Authentication Method.
    select sql and win auth
  5. If you are using the Windows Authentication Method, you will need another connection URL in order to connect to the SQL Server.
    • Java (SQL Server 2005 Microsoft Driver)
    • Java (jDTS)
      where <server_type> = sqlserver
      ** Domain Server is required. If no domain server is available, please try domain=workgroup
    • .NET:
      Server=%HOST%,%PORT%;Database=%DATABASE%;User ID=%USER_ID%;Password=%PASSWD%;Trusted_Connection=Yes;Domain=%WINDOW_DOMAIN%
  6. Get back to the VP application and enter the URL in the Connection String section in the Database Configuration dialog box.
    enter url in connection string

Adapter File

While you are using can non-compatible adapter file, you will not be able to connect to the server.

The simplest way to get the compatible adapter file is let our application download it for you:

  1. Select Tools > Object-Relational Mapping (ORM) > Database Configuration.
    tool orm db config
  2. After you have chosen the language, server and driver, click the Download and Update button beside the Adapter file field.
    dl adapter file
  3. VP will download the adapter file for you.
    adapter file downloaded

If your still fail to connect to SQL server with all the above steps of checking, please contact for technical suppot.

Rate this Article

Click on one of the stars below to rate this article from 1 (lowest) to 5 (highest).

Comments (21)

written by Wilson on July 26, 2010

El mismo sigue sin funcionar..siguiendo los mismos pasos, es mas probando el telnet me da conexion correcta.

written by hashan on August 6, 2011

jtds 1.2 file is not downloaded. so i downloaded the jar file and continued. but itz not working can you tell me what is problem in my process?

written by Jick Yeung on August 8, 2011

Dear Hashan,

Thank you for your post. Unfortunately, we are unable to reproduce the problem you've encountered. May I know the URL of the page where you downloaded the Jar? Second, you said that it is not working. Do you see any error on screen? If so, could you tell me what the error is about?

Best regards,
Jick Yeung

written by Lateisha on December 16, 2011

I love these articles. How many words can a wodrsmith smith?

written by prasad on February 29, 2012

thanks da
this is very good example for mssql server connection purpose

one more time i will
saying thanks ya

written by KIMIGX on April 24, 2012

hey i did everything even dowloaded the drivers for visual padigrim itself,and even the connection on telnet work,but i cant still connect to sql server 2008,using .net settings,it raise up the following error

Test adapter connection failed!
java.sql.SQLException: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.
    at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(
    at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(
    at net.sourceforge.jtds.jdbc.TdsCore.login(
    at net.sourceforge.jtds.jdbc.ConnectionJDBC2.(
    at net.sourceforge.jtds.jdbc.ConnectionJDBC3.(
    at net.sourceforge.jtds.jdbc.Driver.connect(
    at org.orm.ertodb.DriverWrapper.connect(
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at v.ixqh.i(:44)
    at v.ixqh.f(:53)

,urgent help because i need to make a huge database

written by Shivam Choudhary on May 29, 2012

when i run my program on visual studio 2010 the database connection is closed Automatically and the value of textfield is going as Null in the i resolve this problem

written by rain wong on May 29, 2012

Hi Shivam,

Your application is build on top of our generated ORM layer source code?

written by shivam choudhary on May 30, 2012

My program is in visual studio 2010 using c# language...and in back end sqlserver 2008 express edition

written by rain wong on May 30, 2012

So you mean you building the entire application on your own, but not using our ORM feature, right?

written by Shivam Choudhary on May 30, 2012


written by rain wong on May 30, 2012

In this case we are not able to give you help since it is outside the scope of our products. I suggest you can send a question to our forum ( and see will there any user give you help, or maybe you can search Google for help.

written by bill on September 12, 2012

when setting up ms sql connection, driver file download button is disabled...test connection results in message "drive file not specified"

written by Rain Wong on September 13, 2012

Hello Bill, can you send some screenshots to Our support team will help you out.

written by Atyulya on September 28, 2012

How to add custom button on NANT install build and on click of that button how to call a method/function to check the database connection.

written by Rain Wong on September 30, 2012

Hi Atyulya,

May I know what you mean by NANT install build?

written by F.S on April 7, 2014

With this article I can connnect to SQL 2008 but I want to connect to SQL 2012 and I can't !!!
Please help me...

written by Rain Wong on April 7, 2014

The connection to SQL 2012 should just in the same way as 2008. Would you please send us your log file to have a look? You can export the log file from the About dialog, and send to Thanks!

written by Sammy on July 9, 2014

On the SQL Server itself, "telnet 1433" works! From another computer "telnet 1433" gives me Connect Failed error. Question is how to fix this? The firewall rule on SQLSERVER is there to allow inbound traffic on port 1433. Am I missing something else?

written by Angus Chan on July 11, 2014

I think you need enable the TCP/IP connection in SQL Server. May be following page can help

written by wk on October 25, 2014

Excellent guide for Trouble Shooting if SQL Connection has Problems. Many thanks. Solved my Problem.

Write comment



Enter the calculation result

security code