Cant connect to local database
Environment
Operating System
C:\Users\danie>systeminfo | findstr /C:OS OS Name: Microsoft Windows 10 Home OS Version: 10.0.17134 N/A Build 17134 OS Manufacturer: Microsoft Corporation OS Configuration: Standalone Workstation OS Build Type: Multiprocessor Free BIOS Version: Insyde Corp. V1.19, 24/04/2018
TinyTDS Version and Information
I have 'tiny_tds' version of 0.7.0, in my Gemfile and works (see below)
Description
I have been using Azure Portal recently where I was hosting my databases on their servers. I used Azure just to test their platform as my work uses it, and I wanted to get a feel for it. Now I want to move my database to my local server, which I have done so correctly, fully operational within Microsoft SQL Server Management Studio and can connect to my local server without issue. In order to create a connection, I must create an instance of Tiny TDS Client object, which I had done so successfully when using Azure:
client = TinyTds::Client.new(:dataserver => 'planner.database.windows.net',
:port => 1433,
:database => 'DEV',
:username => 'myusername',
:password => 'mypassword',
:azure => true)
Now for my local server/database on my machine, I use this:
client = TinyTds::Client.new(:dataserver => 'LAPTOP-DF86KL64\DANIELDENHARTOG',
:port => 1433,
:database => 'DEV',
:username => 'dani',
:password => '') <-- 'yes this is an empty string'
I run 'rackup' and, the error I get is:
2019-01-23 22:06:20 - TinyTds::Error - Unable to connect: Adaptive Server is unavailable or does not exist (LAPTOP-DF54JL64\DANIELDENHARTOG):
When i use these params and run rackup:
client = TinyTds::Client.new(:dataserver => 'LAPTOP-DF86KL64\DANIELDENHARTOG',
:port => 1433,
:database => 'DEV',
:username => 'DANIELDENHARTOG',
:password => 'potentialpassword') <-- 'a potential password associated to account if thats my username'
I get errors like this:
TinyTds::Error - Server name not found in configuration files:
Now, I have tried:
- only using LAPTOP-DF86KL64
- using :host instead of :dataserver
- using my windows email as the username
- not providing username and password.
- using the username displayed in the Log In box when connecting to server in SSMS: LAPTOP-DF54JL64\dani (i do not think this issue is due to username or password problems anyways, as I am sure the error would be different to the one I'm getting)
- using LAPTOP-DF54JL64\SQLEXPRESS (all the above failed in connecting)
Perhaps I need to adjust settings in SSMS? If this may be a username/password issue, theyre reffering to my username which can be found in SSMS? https://imgur.com/a/P8TuRRr I mean, what other username/password would I use? https://imgur.com/a/lYyrarU https://imgur.com/a/tFc49Dl
I hope this is ok to post here, i have been researching this for 5 days now. Thanks
velvet
I have the same issue
Any ideas? @tiny_tds , @rosspe
Me too
this is what I setup :
require "tiny_tds"
client = TinyTds::Client.new host: '127.0.0.1', port: 1433, database: 'XXBars', username: 'philip', password: 'password'
I think I also changed a setting on the database unhelpfully I can't remember what it was. I am SQLServer authentication rather than windows
mine works now of course, I forget to say that
thanks you, I got it to work definig dataserver instead of host and adding tds_version: to 8.0, because the server are sql server 2000
this still does not work for me. i am still in testing and do not want to be paying for online dbs. pls, any help on settings and params to connect to a local db with tiny tds
for me it looks like tiny_dns uses tcp/ip which is not possible with localdb. so you could use sqlexpress instead, where you can enable tcp/ip. Download: https://www.microsoft.com/en-US/download/details.aspx?id=101064
its free and limited till 10 GB of data. do not forget to activate tcp/ip in sqlexpress by using "sql server configuration manager". it is part of sqlexpress installation package. Look at the screenshot, right click on tcp/ip and configure Port 1433 for ipall.

