0

i need to connect to SQL server from node so i need connection string. How to define connection strings in SQL server 2012 ? or what are the ones by default ?

abderrahmen
  • 351
  • 1
  • 3
  • 14
  • The connection string hasn't changed, it's the same as it was with all previous versions. What are you really asking? Did you try to create a connection and had a problem? Tried to google for the syntax but didn't find something that covers a specific scenario? – Panagiotis Kanavos Feb 12 '15 at 13:27

3 Answers3

0

I'm not sure whether I get your question right...

Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;

Is that what you are looking for?

Edi G.
  • 2,432
  • 7
  • 24
  • 33
  • yes! but i want to know where to find the value of ID and Password for example – abderrahmen Feb 12 '15 at 13:39
  • did you have install your SQL-Server? can you connect with Microsoft Management Studio? – Edi G. Feb 12 '15 at 13:41
  • yes but when i connect to the sql server with node it tels me connection error so i thought i had to enter valid connection string here is my initial problem http://stackoverflow.com/questions/28474096/connect-to-sql-server-2012-with-node-js – abderrahmen Feb 12 '15 at 13:45
0

The server/instance name syntax used in the server option is the same for all SQL Server connection strings.

Server=myServerName\myInstanceName;Database=myDataBase;User Id=myUsername;
Password=myPassword;
Dudi Konfino
  • 1,126
  • 2
  • 13
  • 24
0

You can create a new universal data link file (.udl) on your computer and double click the file in order to select provider and enter connection data. This way, you can test the connection and modify the settings accordingly.

Create a new file a.txt for instance, and rename this file to a.udl

Then follow the steps below to configure connection

  1. Double-click the universal data link (.udl) file. The Data Link Properties dialog box opens, displaying the following tabs: Provider, Connection, Advanced, and All. Choose Next to navigate from tab to tab.
  2. On the Provider tab, select a database provider.
  3. On the Connection tab, either select the data source name (DSN) of an available Provider, or enter a custom connection string. Valid DSNs for providers that are pre-defined on your system are displayed in the Use Data Source drop-down list.
  4. Use the Advanced tab to view and set other initialization properties for your data. 5.Use the All tab to review and edit all OLE DB initialization properties available for your OLE DB provider.
  5. Choose OK to save the connection string to the Universal Data Link (.udl) file.

Then open up the file with a text editor to access the connection string stored.

rasso
  • 2,131
  • 3
  • 21
  • 24
  • connection succeded but i don't get connection string in a.udl when i open it with text editor :[oledb] ; Everything after this line is an OLE DB initstring Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=dbUsers;Data Source=ICEFOX-PC\NODE maybe this is related to the fact that i connect to server using windows authentication ? – abderrahmen Feb 12 '15 at 14:30
  • This is also a connection string. Have you tried this one with node? – rasso Feb 12 '15 at 15:10
  • @abderrahmen and yes it's due to the fact that you use win auth, you can choose to specify username and password. – rasso Feb 12 '15 at 15:17