Comments (15)
Hey Bill. It might be a few things. First, I have never tested anything lower than tds version 7. Remember too that FreeTDS compile time default is moot. When we talk about tds version, we should only focus on what is in your freetds.conf file and or what you tell TinyTDS to use.
When you pass connection options to the TinyTds::Client, the :tds_version defaults to 80, it gets confusing if you were to look at the constants in that class and these changed in FreeTDS too. It get's even more complicated when you read their code on compile time tds version vs what a conf can take in 0.82 vs 0.91.rc, I always stick with the default and let the client set things, if you stray from that path, you may have to juggle some things in both your :tds_version connection option (which I have never really tested) and what is in your conf. You could be hitting an odd bug. Test with the tsql utility if you can too since it has a version setter too I think.
The second thing you want to look at is that I think some of the features that we rely on for having no conf file and utilizing :host and :port, rely on the latest 0.91.rc version of FreeTDS. You may want to go with :dataserver only to simplify your debugging.
from tiny_tds.
Ok, you are correct that the version constant shows weirdness I didn't expect. I can stay with a dataserver defined in freetds.conf, but for some reason I get "Adaptive Server is unavailable or does not exist" when I attempt to use it from TinyTds, but from tsql it works every time. Here is the relevant entry from freetds.conf, pseudo code for TinyTds and the command line that works for tsql. Maybe it will help illustrate my issue. Also, is there a way to get more debug info from connection issues via TinyTds?
freetds.conf:
[PrimaryOS]
host = mnsos1.host.dom
port = 4100
tds version = 5.0
tsql command:
[wpratt@billp ~]$ tsql -U wpratt -P -S PrimaryOS
locale is "en_US"
locale charset is "ISO-8859-1"
1> exit
TinyTds:
irb(main):002:0> TinyTds::Client.new(:dataserver => 'PrimaryOS', :username => 'wpratt', :password => '')
TinyTds::Error: Unable to connect: Adaptive Server is unavailable or does not exist
from /usr/lib/ruby/gems/1.8/gems/tiny_tds-0.4.4/lib/tiny_tds/client.rb:64:in connect' from /usr/lib/ruby/gems/1.8/gems/tiny_tds-0.4.4/lib/tiny_tds/client.rb:64:in
initialize'
from (irb):2:in `new'
from tiny_tds.
Try adding these to the TinyTds::Client.new to see which one works.
:tds_version => '70'
:tds_version => '42'
:tds_version => '100'
:tds_version => '46'
:tds_version => 'unknown'
from tiny_tds.
Ok, I turned on debugging for freetds in freetds.conf and I see that when connecting via TinyTds, it's seeing the dataserver, but for some reason it's overriding the port I have specified in freetds.conf and defaulting it back to 1433. I'm not sure why but I'm looking into that now. Here is the info from the dump file in case you are curious:
[wpratt@billp Download]$ cat /tmp/freetds.dump
log.c:190:Starting log file for FreeTDS 0.82
on 2011-05-18 17:07:44 with debug flags 0x4fff.
iconv.c:363:iconv to convert client-side data to the "UTF-8" character set
iconv.c:516:tds_iconv_info_init: converting "UTF-8"->"UCS-2LE"
net.c:210:Connecting to 172.16.4.31 port 1433 (TDS version 5.0)
net.c:264:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:299:getsockopt(2) reported: Connection refused
util.c:334:tdserror(0x8ead6d8, 0x8eca9b8, 20009, 115)
dblib.c:7782:dbperror(0x8eca208, 20009, 115)
dblib.c:7835:20009: "Unable to connect: Adaptive Server is unavailable or does not exist"
dblib.c:5627:dbgetuserdata(0x8eca208)
dblib.c:5627:dbgetuserdata(0x8eca208)
from tiny_tds.
Ok, strangely enough, even with it specified in the conf, the port is ignored and set to 1433 (odd since the default to 5.0 is 5000). If I specify the :port option as 4100 along with the dataserver, it works and I am now connected. It still does not work with raw host , port options.
I think this is a bug, but I haven't really looked that the source yet to see if I can trace it down.
-Bill
from tiny_tds.
Very odd, perhaps there is a TDSPORT env set? About the only thing I can think of.
from tiny_tds.
Fyi, TDSPORT is not set:
[wpratt@billp ~]$ echo $TDSPORT
[wpratt@billp ~]$
from tiny_tds.
Btw, bug or not, I greatly appreciate how rapidly you respond. It's refreshing :)
from tiny_tds.
Thanks, it is always good to know people are using these tools too! Let me know if you find anything else. One thing I found out recently too is that I had dns entries in my etc/hosts file for names of my dataserver. FreeTDS does all this crazy stuff and I think, if it finds a DNS entry for a name, then it never even get's to a conf file. Hence, why you could have gotten a default port. In that case a :dataserver of "PrimaryOS:4100" may work too.
- Ken
from tiny_tds.
Since it would be nice to not require users of my tool to have a freetds.conf file, I was playing with the dataserver set to host:port. It's almost working. I'm testing the various tds_version options and when I try '70' it completely crashes irb. I tried wrapping it in a begin / rescue block but no good. It just go boom :(
from tiny_tds.
I just noticed that the end of the dump file has this line just before it crashes. I didn't notice it because my terminal was scrolled up:
[wpratt@billp Download]$ cat /tmp/freetds.dump
log.c:190:Starting log file for FreeTDS 0.82
on 2011-05-18 17:58:04 with debug flags 0x4fff.
iconv.c:197:names for ISO-8859-1: ISO-8859-1
iconv.c:197:names for UTF-8: UTF-8
iconv.c:197:names for UCS-2LE: UCS-2LE
iconv.c:197:names for UCS-2BE: UCS-2BE
iconv.c:363:iconv to convert client-side data to the "UTF-8" character set
iconv.c:516:tds_iconv_info_init: converting "UTF-8"->"UCS-2LE"
net.c:210:Connecting to 172.16.4.31 port 4100 (TDS version 6.0)
net.c:264:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:303:tds_open_socket() succeeded
util.c:162:Changed query state from DEAD to IDLE
login.c:551:Unknown protocol version!
from tiny_tds.
Use 0.91 (currently in 0.91RC2) if you want to use host/port or dataserver with host name. You can build your own static lib of TinyTDS with FreeTDS/libicon using the Miniportile system, see project README. This process also by default includes 0.91RC2 now too.
As far as connecting to sybase, that should be resolved since I did ticket #30. So please use master branch 0.5.0 release.
from tiny_tds.
Note, I just saw this come across on the FreeTDS mailing list, is it related?
http://lists.ibiblio.org/pipermail/freetds/2011q4/027476.html
--- dblib.c.ori Thu Aug 18 02:54:40 2011
+++ dblib.c Thu Nov 10 13:45:56 2011
@@ -936,6 +936,9 @@ dbsetlversion (LOGINREC * login, BYTE ve
case DBVER60:
login->tds_login->tds_version = 0x700;
return SUCCEED;
+ case DBVERSION_100:
+ tds_set_version(login->tds_login, 5, 0);
+ return SUCCEED;
case DBVERSION_71:
tds_set_version(login->tds_login, 7, 1);
return SUCCEED;
from tiny_tds.
It's been a little while since I've looked into this. Let me review this again and I'll let you know. Thanks for the heads up.
-Bill
On Nov 10, 2011, at 6:05 AM, Ken Collins wrote:
Note, I just saw this come across on the FreeTDS mailing list, is it related?
http://lists.ibiblio.org/pipermail/freetds/2011q4/027476.html--- dblib.c.ori Thu Aug 18 02:54:40 2011 +++ dblib.c Thu Nov 10 13:45:56 2011 @@ -936,6 +936,9 @@ dbsetlversion (LOGINREC * login, BYTE ve case DBVER60: login->tds_login->tds_version = 0x700; return SUCCEED; + case DBVERSION_100: + tds_set_version(login->tds_login, 5, 0); + return SUCCEED; case DBVERSION_71: tds_set_version(login->tds_login, 7, 1); return SUCCEED;
Reply to this email directly or view it on GitHub:
#22 (comment)
Sincerely,
William Pratt
Mobile: 925.785.1106
AIM: aggriv80r
Yahoo!: wallrat1975
Skype: william.r.pratt
Web: billpratt.net
Photography: flickr.com/williampratt
Photographers deal in things which are continually vanishing and when they have vanished there is no contrivance on earth which can make them come back again.
--Henri Cartier Bresson
from tiny_tds.
Cool, thanks. I created #62 that talks specifically to this too.
from tiny_tds.
Related Issues (20)
- Guidance on how to use with password-less login with Azure Service Principal or Managed Identity HOT 1
- Ruby 3.2 warning: undefining the allocator of T_DATA class TinyTds::Result HOT 1
- results.each(:symbolize_keys => true) not working HOT 1
- Oracle Enterprise Linux installtion instruction HOT 1
- Unable to connect when upgrade to Rials 6 HOT 3
- Segmentation fault after closing connection and asking for `dead?` HOT 3
- tiny_tds don't compile on ruby 3.1.3 on W10 HOT 2
- Compatibility with OpenSSL v3 HOT 2
- When connection fails, a hanging anonymous inode is left open in the system
- Reading data error
- Prepare tiny_tds gem for Ruby v3.1 on Windows HOT 3
- How to build for use in AWS-LAMBDA HOT 1
- Unable to change debug flags in freetds.conf
- TinyTds::Error: Bad numbytes parameter passed to dbstrcpy HOT 2
- TinyTds::Error: Adaptive Server connection failed - but works via tsql directly HOT 4
- Crashes (SIGABRT) Under Test Automation HOT 6
- Compatibility Inquiry: tiny_tds 2.1.7 with Ruby 3.3.0 HOT 2
- tiny_tds v3 HOT 1
- [URGENT] An error occurred while installing tiny_tds (2.1.7), and Bundler cannot continue in Ruby-3.2.1 HOT 1
- ruby 3.3.0 -> 3.3.1 new error "machine stack overflow in critical region (fatal)" HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tiny_tds.