Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

argument out of range for datetime fields on linux (similar to issue #55) #58

Closed
gardwired opened this issue Nov 6, 2011 · 63 comments
Closed

Comments

@gardwired
Copy link

hi, i am running into this same issue as #55, but on debian linux ruby 1.8.7p320, tiny_tds 0.5.0 and freetds 0.91 qyering against windows 2000/sqlserver 2000 virtual machine (vmware). ie ruby is all on linux. i was getting these "statement invalid...argument out of range" errors on any query that has a datetime field (so almost all of my queries fail because of updated_at/created_at). this is a real show stopper. am really wanting to dump odbc. other details are that i compiled freetds without odbc, default tds 7.1 and enabling ms libs. the install all seemed to go fine (debian lenny doesnt have freetds 0.91 as yet).

i was getting the errors in rails 2.3.14 console so i then tried using TinyTds.client directly. same issue (argument out of range) when i try to iterate through result. fine if i dont select datetime fields.

please advise. am willing to help debug if needed. again, this doesn't appear to me to be a windows issue as these queries run fine on mssql query analyzer. it is only when you try to actually read the field in tds (convert string to Time?) that i pukes. i am not (and would prefer not to) use /etc/freetds/freetds.conf unless i have to to get this to work.

any ideas?

@gardwired
Copy link
Author

update. i uninstalled my gem compiled against freetds 0.91 (my new /usr/local) and installed the gem again using my debian freetds package 0.82-4 and it seems to work now. i removed my existing freetds.conf and even tried setting dates prior to 1970 all seems fine now. i guess i am confused about whether with sqlserver 2000 i should be trying to use freetds 0.91 (it seems like that is what the docs urge you to do). what am i missing by using 0.82? i looked through freetds changelog for 0.91, but it is raw commits so a bit hard to follow. really just looking for any major gotchas or other bugaboos i should be aware of.

thanks again for all your hard work on this.

@gardwired
Copy link
Author

ps since i have an older legacy stack, any advice about config for utf8 and tds ver would be appreciated.

@metaskills
Copy link
Contributor

Maybe it is just me, but there seems to be a ton of wild information and some of it contracting that makes your support request really confusing to follow along. Let me start off with some basics.

First, your issue is most likely related to a simple issue with how TinyTDS parses date/time structures. The previous ticket #55 related to windows because the C code we have written ties to be compatibility to older version of Ruby and in some cases specific platforms like Windows in what the native Ruby C types will hold for DateTime/Time classes in ruby core. This is compound too when you consider 32/64 bit version. It is why this test looks so crazy.

https://github.com/rails-sqlserver/tiny_tds/blob/master/test/schema_test.rb#L41

Now, your issue is not likely directly related to this one. There are some cases where you will see "out of range" errors. Because of a configuration problem. FreeTDS has this crazy notion of --enable-msdblib or --enable-sybase-compat flags for configuring. Many people are confused by what these are for. Then think they have to set these config arguments for FreeTDS to work with their database. This common misconception is one reason I wrote the "FreeTDS Compatibility & Configuration" in the project's README. Take a look over that and these.

http://www.freetds.org/userguide/config.htm
https://github.com/rails-sqlserver/tiny_tds/blob/master/ext/tiny_tds/tiny_tds_ext.h#L4-5

TL;DR is that these have nothing to do with
what people think and are only of concern to C interfaces and how the client, in this case TinyTDS wants C structures for said date/time values returned. But since we define our own compatibility in our headers. It is moot. No matter how people configure FreeTDS, it should be fine because of our headers. So we used to see errors like "out of range" when people configured FreeTDS one way and we did not be explicit on how we needed the values from the C structures and we were passing months to days and days to months to ruby. Long story that should not be the case now.

So... looking thru your comments I am not getting what you have done, you say you have used both 0.91 and 0.82-4 in the same sentence. Both should work fine, tho 0.91 is recommended. It allows us to use :host/:port correctly and I have bug fixes in 0.91 that allows us to work with azure too.

About your last questions, I use TinyTDS with a legacy stack too. Should be just fine. As the docs say, I test in ton everything from 2000 to Azure. If you have your datatypes on SQL Server set to some national/unicode type (like nvarchar) and you have FreeTDS compiled with libiconv and you do not trump our default UTF8 encoding, then you should get good results. Did you read the notes I made about tis version in ""FreeTDS Compatibility & Configuration" in the README?

@metaskills
Copy link
Contributor

You could also have a problem in your distribution of FreeTDS, I have no idea what 0.82-4 is. To give yourself a little more to go on, you can always run the tests. Our README covers how simple it is get the test running using a local only version of FreeTDS and libiconv. Basically a rake command and all is done for you. So read the "Development & Testing" section. That will download the released FreeTDS 0.91, compile and run the tests.

We even allow you to test the official patched level of 0.82 too using the TINYTDS_FREETDS_082 env var.

https://github.com/rails-sqlserver/tiny_tds/blob/master/tasks/ports.rake#L9

@gardwired
Copy link
Author

hmmm. i thought i was being clear. if not, then i apologize. i am reporting what appears to be either a bug or a configuration issue on my end. to clarify how i got the error:

  1. freetds 0.82-4 is just debian's package version for freetds 0.82.
  2. when i run tinytds 0.5.0 against freetds 0.91 it gives me out of range errors when i have datetime fields in the query.
  3. i compiled freetds with the following options:
    ./configure --prefix=/usr/local/lib/freetds/0.91 --with-tdsver=7.1 --disable-odbc --enable-msdblib
    make; make install; make clean
  4. i installed the tiny_tds gem like so:
    gem install tiny_tds -- --with-freetds-dir=/usr/local/libfreetds/0.91
  5. i checked the gem's mkmf file to verify that it compiled against 0.91.
  6. when i run queries either using activerecord-sqlserver-adapter 2.3.14 or tiny tds directly, i get out of range error.

will take a look at running test and your other suggestions.

@metaskills
Copy link
Contributor

Tho it should not make a difference, can you remove --enable-msdblib that config is not needed. Please do followup and see if local FreeTDS as downloaded by miniportile and rake-compiler pass the tests. I'd like to find out if this is a debian package issue or not.

@gardwired
Copy link
Author

i read through all of the relevant pages from freetds.org, activerecord-sqlserver-adapter github pages, and the various pages on your github. i paid partcular attention to your page which is why i started by compiling 0.91 because it seems to indicate that that is the current preferred version and we will be upgrading to rails3 at some point (but not that soon).

i tried this install twice. once with freetds 0.91 -- no joy. and now with 0.82 which does seem to work. i would like to use the more recent 0.91 code.

some questions:

  1. should i be using freetds.conf. i currently just have my db params set in database.yml for rails. but i saw the notes that you are having issues passing tds ver. when using odbc we set the following in freetds.conf

[global]
tds version = 8.0
client charset = UTF-8
text size = 99999

is this the only place i can set tds version with tiny_tds? i get it that if using the new 0.91 i should set tds ver to 7.1 but with the older version 0.82 is is 8.0.

i will play around with the 0.91 with freetds.conf. so, i have tried tiny_tds with two different versions and had issues with 0.91.

@metaskills
Copy link
Contributor

A freetds.conf file is the root of all evil and from my perspective, overly configured values and bug repots. With FreeTDS 0.91, you can totally ignore a freetds.conf file and use all the settings by passing them down to the client TinyTds::Client when connecting, which is what database.yml does. Everything in your example above is just not needed. Heck, we even have recent 2.3/3.0/3.1 adapter patches that allow you to set the text size too, see #configure_connection docs. I suspect if you get rid of it and the tds version then you will be much happier.

@gardwired
Copy link
Author

ok will give it another whirl and post back later...gg

@gardwired
Copy link
Author

hey, haven't forgotten about this. got hung up at work. i should be able to try later tonight....gg

@gardwired
Copy link
Author

ok. i recompiled freetds 0.91 two different times and reinstalled the gem with the --with-freetds-dir option pointint to my /usr/local/freetds/0.91 install. i removed the --enable-msdblib first. same result. the second time i also remove the ---with-tdsver also same. here is the stack trace:

ActiveRecord::StatementInvalid: ArgumentError: argument out of range: SELECT * FROM [practitioner] WHERE ([practitioner].[userkey] = 538)
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract_adapter.rb:227:in log' from /usr/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.3.24/lib/active_record/connection_adapters/sqlserver_adapter.rb:1004:inraw_select'
from /usr/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.3.24/lib/active_record/connection_adapters/sqlserver_adapter.rb:965:in select' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/database_statements.rb:7:inselect_all_without_query_cache'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in select_all' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:665:infind_by_sql'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:1582:in find_every' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:1617:infind_one'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:1603:in find_from_ids' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:620:infind_without_org_scope'
from /var/vhosts/ggard/app/models/abstract_database.rb:114:in find' from /var/vhosts/ggard/app/models/abstract_database.rb:120:incall'
from /var/vhosts/ggard/app/models/abstract_database.rb:120:in `find'

  1. as to debian packages for freetds, debian only has 0.82 available as a package (0.91 not even in unstable as yet). so that is why i am compiling 0.91 rather than using a debian package. unfortunately, it doesn't seem to be a package requirement that they document the exact configuration options that they used to compile the package so it is hard to know how they compiled their 0.82 package

  2. at this point, i can use tiny_tds with the debian 0.82 package and all seems to work, but i am concerned about using the older code, particularly around encoding and other bugs with the newer AR adapter.

  3. i dont have time right now but i will try the download portal and tests later tonight.

@gardwired
Copy link
Author

ps how do i pass tdsver in database.yml for rails.

@gardwired
Copy link
Author

correction, now 0.82 not working either. same error now as with 0.91. out of range error against sqlserver 2000.

@gardwired
Copy link
Author

works fine if i get rid of the datetime fields in the query. obviously, not a solution.

@metaskills
Copy link
Contributor

  1. Do no worry about tds_version, the default for TinyTDS will work fine for anything from 2000 to Azure.

  2. I have not seen anything about making your env more simple. In fact, your compiling FreeTDS 0.91 out side of a test setup, still using conf files and perhaps some ENV vars. I have a gut feeling (could be wrong) that your are playing with too many switches and getting things messed up.

  3. To that end, could you please do the testing that I talked about from a git repo check which downloads and compiles local project versions of FreeTDS/libiconv. Just please follow the directions on the README and let me know what passes fails, etc. Anything else is just really not helpful to me nor to you as I can not isolate your problem. Please, when doing this step, remove any freetds.conf files that may be in a standard place (usr/etc ~/.freetds, env setting) and unset any environment vars that may affect the current shell your running the tests in. This could be FREETDS, TDSVER, etc. Once you do this for the default 0.91 and report back to me, I can start to help. Thanks!

@gardwired
Copy link
Author

ok downloaded the repo and installed letting it pull in the remote freetds and iconv. i get "incorrect syntax near geometry" all over the place for the tests when i run:
TINYTDS_UNIT_HOST=db9 rake

  1. Error:
    test_0001_cast_nvarchar_max_(Casting SQL Server schema::for 2005 and up):
    TinyTds::Error: Line 90: Incorrect syntax near 'geometry:'.
    ./test/test_helper.rb:143:in cancel' ./test/test_helper.rb:143:inload_current_schema'
    ./test/schema_test.rb:9
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/spec.rb:177:in instance_eval' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/spec.rb:177:insetup'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:842:in run' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:683:in_run_suite'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:676:in map' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:676:in_run_suite'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:666:in _run_suites' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:666:inmap'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:666:in _run_suites' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:642:in_run_anything'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:804:in run_tests' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:791:insend'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:791:in _run' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:790:ineach'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:790:in _run' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:779:inrun'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:560:in `autorun'
    /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5

@gardwired
Copy link
Author

94 tests, 37 assertions, 0 failures, 78 errors, 1 skips
rake aborted!
Command failed with status (1): [/usr/bin/ruby1.8 -I"lib:test" "/usr/lib/ru...]

@gardwired
Copy link
Author

all the errors are the about incorrect syntax near geometry.

@gardwired
Copy link
Author

made sure that freetds.conf was moved out when ran rake test. there shouldnt be any other switches for your test right? i confess that we do have odbc, a packaged freetds, and my /usr/local/lib version of freetds on the system. this is on a development/utility server that does lots of things so i am reluctant to remove all that. can we solve the geometry issue first so that we can see the test results?

@gardwired
Copy link
Author

am knocking off for the day. back later this afternoon.

@metaskills
Copy link
Contributor

If you are on 2000, you forgot to specify the TINYTDS_SCHEMA=sqlserver_2000

@gardwired
Copy link
Author

TINYTDS_UNIT_HOST=cp9vm TINYTDS_SCHEMA=sqlserver_2000 rake test
(in /usr/src/tiny_tds)
rake-compiler must be configured first to enable cross-compilation
/usr/bin/ruby1.8 -I"lib:test" "/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/client_test.rb" "test/result_test.rb" "test/schema_test.rb"
Run options: --seed 23360

Running tests:

...F..F.F.......E..FFF.F.........E.....F...S..........F........F..F....................F

Finished tests in 9.125166s, 9.6437 tests/s, 30.3556 assertions/s.

  1. Failure:
    test_0011_cast_nchar(Casting SQL Server schema::for shared types) [./test/schema_test.rb:150]:
    Expected "123456\303\245\303\245 ", not "123456\303\245\303\245".

  2. Failure:
    test_0006_cast_decimal(Casting SQL Server schema::for shared types) [./test/schema_test.rb:116]:
    Expected 12345.01 to be an instance of BigDecimal, not Float.

  3. Failure:
    test_0003_cast_bit(Casting SQL Server schema::for shared types) [./test/schema_test.rb:31]:
    Expected nil, not false.

  4. Error:
    test_0012_cast_ntext(Casting SQL Server schema::for shared types):
    TinyTds::Error: Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier.
    ./test/test_helper.rb:173:in each' ./test/test_helper.rb:173:infind_value'
    ./test/schema_test.rb:155:in test_0012_cast_ntext' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:843:insend'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:843:in run' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:683:in_run_suite'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:676:in map' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:676:in_run_suite'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:666:in _run_suites' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:666:inmap'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:666:in _run_suites' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:642:in_run_anything'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:804:in run_tests' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:791:insend'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:791:in _run' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:790:ineach'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:790:in _run' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:779:inrun'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:560:in `autorun'
    /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5

  5. Failure:
    test_0005_cast_datetime(Casting SQL Server schema::for shared types) [./test/schema_test.rb:83]:
    Expected 1, not 31.

  6. Failure:
    test_0021_cast_uniqueidentifier(Casting SQL Server schema::for shared types) [./test/schema_test.rb:258]:
    Expected /\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/ to match "\234\035\370\257?H0A\225\260\243\260-\250\227\223".

  7. Failure:
    test_0013_cast_numeric(Casting SQL Server schema::for shared types) [./test/schema_test.rb:165]:
    Expected 191.0 to be an instance of BigDecimal, not Float.

  8. Failure:
    test_0016_cast_smalldatetime(Casting SQL Server schema::for shared types) [./test/schema_test.rb:215]:
    Expected 1, not 31.

  9. Error:
    test_0007_error_gracefully_with_incorrect_syntax_in_sp_executesql(Basic query and result::when shit happens):
    TinyTds::Error: Attempt to initiate a new Adaptive Server operation with results pending
    ./test/result_test.rb:646:in execute' ./test/result_test.rb:646:inassert_followup_query'
    ./test/result_test.rb:632:in test_0007_error_gracefully_with_incorrect_syntax_in_sp_executesql' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:843:insend'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:843:in run' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:683:in_run_suite'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:676:in map' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:676:in_run_suite'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:666:in _run_suites' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:666:inmap'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:666:in _run_suites' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:642:in_run_anything'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:804:in run_tests' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:791:insend'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:791:in _run' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:790:ineach'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:790:in _run' /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:779:inrun'
    /usr/lib/ruby/gems/1.8/gems/minitest-2.1.0/lib/minitest/unit.rb:560:in `autorun'
    /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5

  10. Failure:
    test_0009_fail_miserably_with_unknown_encoding_option(With in-valid options) [./test/client_test.rb:150]:
    expected a TinyTds::Error but none happened

  11. Skipped:
    test_0007_should_eventually_run_this_test_to_prove_we_account_for_dropped_connections(With in-valid options) [/usr/lib/ruby/gems/1.8/gems/mini_shoulda-0.3.0/lib/mini_shoulda/spec.rb:11]:
    Should eventually run this test to prove we account for dropped connections

  12. Failure:
    test_0003_have_a_getters_for_the_tds_version_information_brittle_since_conf_takes_precedence_(With valid credentials) [./test/client_test.rb:27]:
    Expected 9, not 4.

  13. Failure:
    test_0015_delete_and_update_with_affected_rows_support_and_insert_with_identity_support_in_native_sql(Basic query and result) [./test/result_test.rb:132]:
    native is numeric(38,0) for SCOPE_IDENTITY() function.
    Expected 342.0 to be an instance of BigDecimal, not Float.

  14. Failure:
    test_0018_have_an_insert_method_that_cancels_result_rows_and_returns_the_scope_identity_natively(Basic query and result) [./test/result_test.rb:174]:
    Expected 345.0, not 4644776920376934400.

  15. Failure:
    test_0019_return_bigint_for_insert_when_needed(Basic query and result) [./test/result_test.rb:189]:
    Expected 9223372036854775805, not 4890909195324358656.

88 tests, 277 assertions, 12 failures, 2 errors, 1 skips
rake aborted!
Command failed with status (1): [/usr/bin/ruby1.8 -I"lib:test" "/usr/lib/ru...]

@metaskills
Copy link
Contributor

Now we are getting somewhere, I just checked master, and all the tests pass under my SQL Server 2000 database in a quick check on ruby 1.8.7, 1.9.2, and 1.9.3. So why yours is not is the big question. Can you show me what you have in your conf file for cp9vm?

@gardwired
Copy link
Author

conf file? i am not using freetds.conf. cp9vm is a windows2000 server vmware instance running sqlserver 2000. so cp9vm is just the host.

@metaskills
Copy link
Contributor

Well, if you (1) have made sure that you are not setting any potential conflicting ivars SYBASE , TDSVER, FREETDS, etc http://www.freetds.org/userguide/envvar.htm or (2) you made sure that you compiled an official FreeTDS with the rake task and did not set TINYTDS_SKIP_PORTS... Then do you have any ideas why your SQL Server is failing?

All the failures to me look like they could be screwed up due to something crazy like from the above. Make sure you removed all that from the equation and see if you can look around to things like your DB version, some crazy DB configs, something? I'm at a loss.

@gardwired
Copy link
Author

will rerun all of it and post back later. as for sqlserver it is just the basic stuff with no oddball collations or other ms wierdness.

@gardwired
Copy link
Author

actually, we have a new datacenter stack that we are going to rollout relatively soon. i think i will try pulling all the odbc and other freetds stuff off of one of those servers. get it down to barebones and then run the gem testing from there. the sqlserver vm is the same. will let you know. might not be tonight tho.

@metaskills
Copy link
Contributor

Thanks, you really should not be having problems like this :( but it will be good to find out and close the loop.

@metaskills
Copy link
Contributor

Can you show me the output of this? Should show show the entire build and test process.

$ git clean -x -d -f
$ rake

@gardwired
Copy link
Author

ok will do. in the meantime i successfully ran tests against my sqlserver2000 vm on a different machine. i uninstalled all odbc and tds related packages, rebooted, and then cloned the repo and ran tests. all tests ran ok with one skipped (test_007 about dropped connections -- looks like that is intentional to skip). to be clear this s what i did to get the clean install/tests after uninstalling stuff and creating tinytdstest db:

git clone ...
cd tiny_tds
bundle install
TINYTDS_UNIT_HOST=dbhost TINYTDS_SCHEMA=sqlserver_2000 rake

going to try testing the gem with datetime fields now.

@metaskills
Copy link
Contributor

You are trying to shoe horn in rules for installing a gem that just do not simply apply if your are building your own native gem. A few helpful pointers.

  1. Remember the git clean -x -d -f command I had said above. That would have cleaned out the pkg directory too. A must command for getting a fresh clean repo.

  2. Follow the directions for building your own native gem on the readme. Pay special attention to the gem your installing. In the commands above, your install a gem that is not for your platform. It says:

  1. The native gem can be found in the pkg directory. The last command assumes "X" is version numbers and #{platform} will be your platform.
$ bundle install
$ rake compile
$ rake native gem
$ gem install pkg/tiny_tds-X.X.X-#{platform}.gem
  1. Once a platform gem is build, you DO NOT NEED -- ARGS when installing it. You simply just do that last line above. Remember, the build gem will have freetds/iconv linked inside the tiny_tds binary as static libraries.

@gardwired
Copy link
Author

i did EXACTLY what the directions for installing the native gem as they are specified on the readme.

rake compile
rake native gem
gem install pkg/tiny_tdsxxxx.gem

i just did this again and got the same errors. no free tds lib found.

note that when i run rake native gem it exits with the following error:

rm -f pkg/tiny_tds-0.5.1.rc1/test/test_helper.rb
ln test/test_helper.rb pkg/tiny_tds-0.5.1.rc1/test/test_helper.rb
rm -f pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/tiny_tds.so
ln lib/tiny_tds/tiny_tds.so pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/tiny_tds.so
WARNING: no rubyforge_project specified
mv tiny_tds-0.5.1.rc1.gem pkg/tiny_tds-0.5.1.rc1.gem
rake aborted!
Don't know how to build task 'pkg/tiny_tds-0.5.1.rc1-x86_64-linux'

(See full trace by running task with --trace)

does that have anything to do with this?

@luislavena
Copy link
Contributor

i did EXACTLY what the directions for installing the native gem as they are specified on the readme.

Seems not, you're omitting the information you provided now.

note that when i run rake native gem it exits with the following error:
Don't know how to build task 'pkg/tiny_tds-0.5.1.rc1-x86_64-linux'

See Issue #53 which contains a resolution for the problem (tl;dr -- update RubyGems and build again)

@metaskills
Copy link
Contributor

does that have anything to do with this?

Yes! It is pointless to continue till we find out that problem. I suggest using the --trace option. Also there is where @luislavena can help too if needed

@gardwired
Copy link
Author

right. so did git -x -d -f and reran all this again. same inability to build the platform gem. looking into #53.

@gardwired
Copy link
Author

so i do have gem -v = 1.3.7. will upgrade and try again. might be good to have a note in the readme on this.

@luislavena
Copy link
Contributor

so i do have gem -v = 1.3.7. will upgrade and try again. might be good to have a note in the readme on this.

Indeed, opening an issue about that.

@gardwired
Copy link
Author

sorry hit the wrong button to close.

another question. will this static gem still read /etc/freetds/freetds.conf i am hoping not. in my freetds.conf i have options:

tds version = 8.0
client charset = UTF-8
text size = 99999
encryption = off

i have other sites that are still using freetds 8.4 with odbc so i can't remove the freetds.conf file without breaking those. they will get converted to this new driver in short order but it'd be nice to test this driver a bit before forcing it on all of my dev sites.

@gardwired
Copy link
Author

ok upgraded to gem 1.5.0 using

gem upgrade --system 1.5.0

did clean git clone and bundle install. now i get this:

rake compile
/usr/bin/rake:19:in `load': no such file to load -- rake (LoadError)
from /usr/bin/rake:19

@gardwired
Copy link
Author

gem -v verfies as 1.5.0

@gardwired
Copy link
Author

downgraded to gems 1.4.2 and now get same rake error. don't know how to build tiny_tds platform gem. i run rails 2.3.11 on some sites and redmine so i can't just upgrade to the current gem. is there a legacy gem version that you recommend?

@gardwired
Copy link
Author

tried again with gem 1.4.0 with rake native gem --trace:

rake native gem --trace
(in /usr/src/tiny_tds)
rake-compiler must be configured first to enable cross-compilation
** Invoke native (first_time)
** Invoke native:x86_64-linux (first_time)
** Invoke native:tiny_tds:x86_64-linux (first_time)
** Invoke lib/tiny_tds/tiny_tds.so (first_time, not_needed)
** Invoke copy:tiny_tds:x86_64-linux:1.8.7 (first_time)
** Invoke lib/tiny_tds (first_time, not_needed)
** Invoke tmp/x86_64-linux/tiny_tds/1.8.7/tiny_tds.so (first_time, not_needed)
** Invoke tmp/x86_64-linux/tiny_tds/1.8.7/Makefile (first_time, not_needed)
** Invoke tmp/x86_64-linux/tiny_tds/1.8.7 (first_time, not_needed)
** Invoke ext/tiny_tds/extconf.rb (first_time, not_needed)
** Invoke ext/tiny_tds/client.c (first_time, not_needed)
** Invoke ext/tiny_tds/result.c (first_time, not_needed)
** Invoke ext/tiny_tds/tiny_tds_ext.c (first_time, not_needed)
** Execute copy:tiny_tds:x86_64-linux:1.8.7
install -c tmp/x86_64-linux/tiny_tds/1.8.7/tiny_tds.so lib/tiny_tds/tiny_tds.so
** Execute native:tiny_tds:x86_64-linux
** Execute native:x86_64-linux
** Execute native
** Invoke gem (first_time)
** Invoke pkg/tiny_tds-0.5.1.rc1.gem (first_time)
** Invoke pkg (first_time)
** Execute pkg
mkdir -p pkg
** Invoke pkg/tiny_tds-0.5.1.rc1 (first_time)
** Invoke .gitignore (first_time, not_needed)
** Invoke CHANGELOG (first_time, not_needed)
** Invoke Gemfile (first_time, not_needed)
** Invoke MIT-LICENSE (first_time, not_needed)
** Invoke NOTES (first_time, not_needed)
** Invoke README.md (first_time, not_needed)
** Invoke Rakefile (first_time, not_needed)
** Invoke ext/tiny_tds/client.c (not_needed)
** Invoke ext/tiny_tds/client.h (first_time, not_needed)
** Invoke ext/tiny_tds/extconf.rb (not_needed)
** Invoke ext/tiny_tds/result.c (not_needed)
** Invoke ext/tiny_tds/result.h (first_time, not_needed)
** Invoke ext/tiny_tds/tiny_tds_ext.c (not_needed)
** Invoke ext/tiny_tds/tiny_tds_ext.h (first_time, not_needed)
** Invoke lib/tiny_tds.rb (first_time, not_needed)
** Invoke lib/tiny_tds/client.rb (first_time, not_needed)
** Invoke lib/tiny_tds/error.rb (first_time, not_needed)
** Invoke lib/tiny_tds/result.rb (first_time, not_needed)
** Invoke lib/tiny_tds/version.rb (first_time, not_needed)
** Invoke tasks/ports.rake (first_time, not_needed)
** Invoke test/benchmark/query.rb (first_time, not_needed)
** Invoke test/benchmark/query_odbc.rb (first_time, not_needed)
** Invoke test/benchmark/query_tinytds.rb (first_time, not_needed)
** Invoke test/client_test.rb (first_time, not_needed)
** Invoke test/result_test.rb (first_time, not_needed)
** Invoke test/schema/1px.gif (first_time, not_needed)
** Invoke test/schema/sqlserver_2000.sql (first_time, not_needed)
** Invoke test/schema/sqlserver_2005.sql (first_time, not_needed)
** Invoke test/schema/sqlserver_2008.sql (first_time, not_needed)
** Invoke test/schema/sqlserver_azure.sql (first_time, not_needed)
** Invoke test/schema_test.rb (first_time, not_needed)
** Invoke test/test_helper.rb (first_time, not_needed)
** Invoke lib/tiny_tds/tiny_tds.so (not_needed)
** Execute pkg/tiny_tds-0.5.1.rc1
mkdir -p pkg
mkdir -p pkg/tiny_tds-0.5.1.rc1
rm -f pkg/tiny_tds-0.5.1.rc1/.gitignore
ln .gitignore pkg/tiny_tds-0.5.1.rc1/.gitignore
rm -f pkg/tiny_tds-0.5.1.rc1/CHANGELOG
ln CHANGELOG pkg/tiny_tds-0.5.1.rc1/CHANGELOG
rm -f pkg/tiny_tds-0.5.1.rc1/Gemfile
ln Gemfile pkg/tiny_tds-0.5.1.rc1/Gemfile
rm -f pkg/tiny_tds-0.5.1.rc1/MIT-LICENSE
ln MIT-LICENSE pkg/tiny_tds-0.5.1.rc1/MIT-LICENSE
rm -f pkg/tiny_tds-0.5.1.rc1/NOTES
ln NOTES pkg/tiny_tds-0.5.1.rc1/NOTES
rm -f pkg/tiny_tds-0.5.1.rc1/README.md
ln README.md pkg/tiny_tds-0.5.1.rc1/README.md
rm -f pkg/tiny_tds-0.5.1.rc1/Rakefile
ln Rakefile pkg/tiny_tds-0.5.1.rc1/Rakefile
mkdir -p pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds
rm -f pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/client.c
ln ext/tiny_tds/client.c pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/client.c
rm -f pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/client.h
ln ext/tiny_tds/client.h pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/client.h
rm -f pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/extconf.rb
ln ext/tiny_tds/extconf.rb pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/extconf.rb
rm -f pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/result.c
ln ext/tiny_tds/result.c pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/result.c
rm -f pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/result.h
ln ext/tiny_tds/result.h pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/result.h
rm -f pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/tiny_tds_ext.c
ln ext/tiny_tds/tiny_tds_ext.c pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/tiny_tds_ext.c
rm -f pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/tiny_tds_ext.h
ln ext/tiny_tds/tiny_tds_ext.h pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/tiny_tds_ext.h
mkdir -p pkg/tiny_tds-0.5.1.rc1/lib
rm -f pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds.rb
ln lib/tiny_tds.rb pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds.rb
mkdir -p pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds
rm -f pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/client.rb
ln lib/tiny_tds/client.rb pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/client.rb
rm -f pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/error.rb
ln lib/tiny_tds/error.rb pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/error.rb
rm -f pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/result.rb
ln lib/tiny_tds/result.rb pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/result.rb
rm -f pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/version.rb
ln lib/tiny_tds/version.rb pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/version.rb
mkdir -p pkg/tiny_tds-0.5.1.rc1/tasks
rm -f pkg/tiny_tds-0.5.1.rc1/tasks/ports.rake
ln tasks/ports.rake pkg/tiny_tds-0.5.1.rc1/tasks/ports.rake
mkdir -p pkg/tiny_tds-0.5.1.rc1/test/benchmark
rm -f pkg/tiny_tds-0.5.1.rc1/test/benchmark/query.rb
ln test/benchmark/query.rb pkg/tiny_tds-0.5.1.rc1/test/benchmark/query.rb
rm -f pkg/tiny_tds-0.5.1.rc1/test/benchmark/query_odbc.rb
ln test/benchmark/query_odbc.rb pkg/tiny_tds-0.5.1.rc1/test/benchmark/query_odbc.rb
rm -f pkg/tiny_tds-0.5.1.rc1/test/benchmark/query_tinytds.rb
ln test/benchmark/query_tinytds.rb pkg/tiny_tds-0.5.1.rc1/test/benchmark/query_tinytds.rb
rm -f pkg/tiny_tds-0.5.1.rc1/test/client_test.rb
ln test/client_test.rb pkg/tiny_tds-0.5.1.rc1/test/client_test.rb
rm -f pkg/tiny_tds-0.5.1.rc1/test/result_test.rb
ln test/result_test.rb pkg/tiny_tds-0.5.1.rc1/test/result_test.rb
mkdir -p pkg/tiny_tds-0.5.1.rc1/test/schema
rm -f pkg/tiny_tds-0.5.1.rc1/test/schema/1px.gif
ln test/schema/1px.gif pkg/tiny_tds-0.5.1.rc1/test/schema/1px.gif
rm -f pkg/tiny_tds-0.5.1.rc1/test/schema/sqlserver_2000.sql
ln test/schema/sqlserver_2000.sql pkg/tiny_tds-0.5.1.rc1/test/schema/sqlserver_2000.sql
rm -f pkg/tiny_tds-0.5.1.rc1/test/schema/sqlserver_2005.sql
ln test/schema/sqlserver_2005.sql pkg/tiny_tds-0.5.1.rc1/test/schema/sqlserver_2005.sql
rm -f pkg/tiny_tds-0.5.1.rc1/test/schema/sqlserver_2008.sql
ln test/schema/sqlserver_2008.sql pkg/tiny_tds-0.5.1.rc1/test/schema/sqlserver_2008.sql
rm -f pkg/tiny_tds-0.5.1.rc1/test/schema/sqlserver_azure.sql
ln test/schema/sqlserver_azure.sql pkg/tiny_tds-0.5.1.rc1/test/schema/sqlserver_azure.sql
rm -f pkg/tiny_tds-0.5.1.rc1/test/schema_test.rb
ln test/schema_test.rb pkg/tiny_tds-0.5.1.rc1/test/schema_test.rb
rm -f pkg/tiny_tds-0.5.1.rc1/test/test_helper.rb
ln test/test_helper.rb pkg/tiny_tds-0.5.1.rc1/test/test_helper.rb
mkdir -p pkg
rm -f pkg/tiny_tds-0.5.1.rc1/.gitignore
ln .gitignore pkg/tiny_tds-0.5.1.rc1/.gitignore
rm -f pkg/tiny_tds-0.5.1.rc1/CHANGELOG
ln CHANGELOG pkg/tiny_tds-0.5.1.rc1/CHANGELOG
rm -f pkg/tiny_tds-0.5.1.rc1/Gemfile
ln Gemfile pkg/tiny_tds-0.5.1.rc1/Gemfile
rm -f pkg/tiny_tds-0.5.1.rc1/MIT-LICENSE
ln MIT-LICENSE pkg/tiny_tds-0.5.1.rc1/MIT-LICENSE
rm -f pkg/tiny_tds-0.5.1.rc1/NOTES
ln NOTES pkg/tiny_tds-0.5.1.rc1/NOTES
rm -f pkg/tiny_tds-0.5.1.rc1/README.md
ln README.md pkg/tiny_tds-0.5.1.rc1/README.md
rm -f pkg/tiny_tds-0.5.1.rc1/Rakefile
ln Rakefile pkg/tiny_tds-0.5.1.rc1/Rakefile
rm -f pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/client.c
ln ext/tiny_tds/client.c pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/client.c
rm -f pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/client.h
ln ext/tiny_tds/client.h pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/client.h
rm -f pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/extconf.rb
ln ext/tiny_tds/extconf.rb pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/extconf.rb
rm -f pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/result.c
ln ext/tiny_tds/result.c pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/result.c
rm -f pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/result.h
ln ext/tiny_tds/result.h pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/result.h
rm -f pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/tiny_tds_ext.c
ln ext/tiny_tds/tiny_tds_ext.c pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/tiny_tds_ext.c
rm -f pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/tiny_tds_ext.h
ln ext/tiny_tds/tiny_tds_ext.h pkg/tiny_tds-0.5.1.rc1/ext/tiny_tds/tiny_tds_ext.h
rm -f pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds.rb
ln lib/tiny_tds.rb pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds.rb
rm -f pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/client.rb
ln lib/tiny_tds/client.rb pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/client.rb
rm -f pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/error.rb
ln lib/tiny_tds/error.rb pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/error.rb
rm -f pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/result.rb
ln lib/tiny_tds/result.rb pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/result.rb
rm -f pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/version.rb
ln lib/tiny_tds/version.rb pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/version.rb
rm -f pkg/tiny_tds-0.5.1.rc1/tasks/ports.rake
ln tasks/ports.rake pkg/tiny_tds-0.5.1.rc1/tasks/ports.rake
rm -f pkg/tiny_tds-0.5.1.rc1/test/benchmark/query.rb
ln test/benchmark/query.rb pkg/tiny_tds-0.5.1.rc1/test/benchmark/query.rb
rm -f pkg/tiny_tds-0.5.1.rc1/test/benchmark/query_odbc.rb
ln test/benchmark/query_odbc.rb pkg/tiny_tds-0.5.1.rc1/test/benchmark/query_odbc.rb
rm -f pkg/tiny_tds-0.5.1.rc1/test/benchmark/query_tinytds.rb
ln test/benchmark/query_tinytds.rb pkg/tiny_tds-0.5.1.rc1/test/benchmark/query_tinytds.rb
rm -f pkg/tiny_tds-0.5.1.rc1/test/client_test.rb
ln test/client_test.rb pkg/tiny_tds-0.5.1.rc1/test/client_test.rb
rm -f pkg/tiny_tds-0.5.1.rc1/test/result_test.rb
ln test/result_test.rb pkg/tiny_tds-0.5.1.rc1/test/result_test.rb
rm -f pkg/tiny_tds-0.5.1.rc1/test/schema/1px.gif
ln test/schema/1px.gif pkg/tiny_tds-0.5.1.rc1/test/schema/1px.gif
rm -f pkg/tiny_tds-0.5.1.rc1/test/schema/sqlserver_2000.sql
ln test/schema/sqlserver_2000.sql pkg/tiny_tds-0.5.1.rc1/test/schema/sqlserver_2000.sql
rm -f pkg/tiny_tds-0.5.1.rc1/test/schema/sqlserver_2005.sql
ln test/schema/sqlserver_2005.sql pkg/tiny_tds-0.5.1.rc1/test/schema/sqlserver_2005.sql
rm -f pkg/tiny_tds-0.5.1.rc1/test/schema/sqlserver_2008.sql
ln test/schema/sqlserver_2008.sql pkg/tiny_tds-0.5.1.rc1/test/schema/sqlserver_2008.sql
rm -f pkg/tiny_tds-0.5.1.rc1/test/schema/sqlserver_azure.sql
ln test/schema/sqlserver_azure.sql pkg/tiny_tds-0.5.1.rc1/test/schema/sqlserver_azure.sql
rm -f pkg/tiny_tds-0.5.1.rc1/test/schema_test.rb
ln test/schema_test.rb pkg/tiny_tds-0.5.1.rc1/test/schema_test.rb
rm -f pkg/tiny_tds-0.5.1.rc1/test/test_helper.rb
ln test/test_helper.rb pkg/tiny_tds-0.5.1.rc1/test/test_helper.rb
rm -f pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/tiny_tds.so
ln lib/tiny_tds/tiny_tds.so pkg/tiny_tds-0.5.1.rc1/lib/tiny_tds/tiny_tds.so
** Invoke .gitignore (not_needed)
** Invoke CHANGELOG (not_needed)
** Invoke Gemfile (not_needed)
** Invoke MIT-LICENSE (not_needed)
** Invoke NOTES (not_needed)
** Invoke README.md (not_needed)
** Invoke Rakefile (not_needed)
** Invoke ext/tiny_tds/client.c (not_needed)
** Invoke ext/tiny_tds/client.h (not_needed)
** Invoke ext/tiny_tds/extconf.rb (not_needed)
** Invoke ext/tiny_tds/result.c (not_needed)
** Invoke ext/tiny_tds/result.h (not_needed)
** Invoke ext/tiny_tds/tiny_tds_ext.c (not_needed)
** Invoke ext/tiny_tds/tiny_tds_ext.h (not_needed)
** Invoke lib/tiny_tds.rb (not_needed)
** Invoke lib/tiny_tds/client.rb (not_needed)
** Invoke lib/tiny_tds/error.rb (not_needed)
** Invoke lib/tiny_tds/result.rb (not_needed)
** Invoke lib/tiny_tds/version.rb (not_needed)
** Invoke tasks/ports.rake (not_needed)
** Invoke test/benchmark/query.rb (not_needed)
** Invoke test/benchmark/query_odbc.rb (not_needed)
** Invoke test/benchmark/query_tinytds.rb (not_needed)
** Invoke test/client_test.rb (not_needed)
** Invoke test/result_test.rb (not_needed)
** Invoke test/schema/1px.gif (not_needed)
** Invoke test/schema/sqlserver_2000.sql (not_needed)
** Invoke test/schema/sqlserver_2005.sql (not_needed)
** Invoke test/schema/sqlserver_2008.sql (not_needed)
** Invoke test/schema/sqlserver_azure.sql (not_needed)
** Invoke test/schema_test.rb (not_needed)
** Invoke test/test_helper.rb (not_needed)
** Execute pkg/tiny_tds-0.5.1.rc1.gem
cd pkg/tiny_tds-0.5.1.rc1
Successfully built RubyGem
Name: tiny_tds
Version: 0.5.1.rc1
File: tiny_tds-0.5.1.rc1.gem
mv tiny_tds-0.5.1.rc1.gem ..
cd -
** Invoke pkg/tiny_tds-0.5.1.rc1-x86_64-linux.gem (first_time)
** Invoke pkg (not_needed)
rake aborted!
Don't know how to build task 'pkg/tiny_tds-0.5.1.rc1-x86_64-linux'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1728:in []' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:605:ininvoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in each' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:ininvoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in invoke_with_call_chain' /usr/lib/ruby/1.8/monitor.rb:242:insynchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:ininvoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in each' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:ininvoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in invoke_with_call_chain' /usr/lib/ruby/1.8/monitor.rb:242:insynchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:ininvoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in invoke_task' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in each' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:intop_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in run' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in run' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31 /usr/bin/rake:19:inload'
/usr/bin/rake:19

@gardwired
Copy link
Author

ps here is the git clean and rake compile that i did immediately before the above native gem call.

git clean -x -d -f
Removing Gemfile.lock
Removing lib/tiny_tds/tiny_tds.so
Removing pkg/
Removing ports/
Removing tmp/
root@cp8:/usr/src/tiny_tds# rake compile --trace
(in /usr/src/tiny_tds)
rake-compiler must be configured first to enable cross-compilation
** Invoke compile (first_time)
** Invoke ports:freetds (first_time)
** Invoke ports (first_time)
** Execute ports
mkdir -p ports
** Invoke ports:libiconv (first_time)
** Invoke ports (not_needed)
** Execute ports:libiconv
Downloading libiconv-1.13.1.tar.gz (100%)
Extracting libiconv-1.13.1.tar.gz into tmp/x86_64-linux/ports/libiconv/1.13.1... OK
Running 'configure' for libiconv 1.13.1... OK
Running 'compile' for libiconv 1.13.1... OK
Running 'install' for libiconv 1.13.1... OK
touch ports/.libiconv.1.13.1.x86_64-linux.timestamp
Activating libiconv 1.13.1 (from ports/x86_64-linux/libiconv/1.13.1)...
** Execute ports:freetds
Downloading freetds-0.91.tar.gz (100%)
Extracting freetds-0.91.tar.gz into tmp/x86_64-linux/ports/freetds/0.91... OK
Running 'configure' for freetds 0.91... OK
Running 'compile' for freetds 0.91... OK
Running 'install' for freetds 0.91... OK
touch ports/.freetds.0.91.x86_64-linux.timestamp
Activating freetds 0.91 (from ports/x86_64-linux/freetds/0.91)...
** Invoke compile:x86_64-linux (first_time)
** Invoke compile:tiny_tds:x86_64-linux (first_time)
** Invoke copy:tiny_tds:x86_64-linux:1.8.7 (first_time)
** Invoke lib/tiny_tds (first_time, not_needed)
** Invoke tmp/x86_64-linux/tiny_tds/1.8.7/tiny_tds.so (first_time)
** Invoke tmp/x86_64-linux/tiny_tds/1.8.7/Makefile (first_time)
** Invoke tmp/x86_64-linux/tiny_tds/1.8.7 (first_time)
** Execute tmp/x86_64-linux/tiny_tds/1.8.7
mkdir -p tmp/x86_64-linux/tiny_tds/1.8.7
** Invoke ext/tiny_tds/extconf.rb (first_time, not_needed)
** Execute tmp/x86_64-linux/tiny_tds/1.8.7/Makefile
cd tmp/x86_64-linux/tiny_tds/1.8.7
/usr/bin/ruby1.8 -I. ../../../../ext/tiny_tds/extconf.rb
looking for library directory /usr/src/tiny_tds/ports/x86_64-linux/freetds/0.91/lib ... yes
checking for main() in -liconv... yes
checking for main() in -lsybdb... yes
looking for include directory /usr/src/tiny_tds/ports/x86_64-linux/freetds/0.91/include ... yes
checking for sybfront.h... yes
checking for sybdb.h... yes
creating Makefile
cd -
** Invoke ext/tiny_tds/client.c (first_time, not_needed)
** Invoke ext/tiny_tds/result.c (first_time, not_needed)
** Invoke ext/tiny_tds/tiny_tds_ext.c (first_time, not_needed)
** Execute tmp/x86_64-linux/tiny_tds/1.8.7/tiny_tds.so
cd tmp/x86_64-linux/tiny_tds/1.8.7
make
cc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I../../../../ext/tiny_tds -DHAVE_SYBFRONT_H -DHAVE_SYBDB_H -I/usr/src/tiny_tds/ports/x86_64-linux/freetds/0.91/include -I/usr/src/tiny_tds/ports/x86_64-linux/freetds/0.91/include -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -c ../../../../ext/tiny_tds/client.c
cc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I../../../../ext/tiny_tds -DHAVE_SYBFRONT_H -DHAVE_SYBDB_H -I/usr/src/tiny_tds/ports/x86_64-linux/freetds/0.91/include -I/usr/src/tiny_tds/ports/x86_64-linux/freetds/0.91/include -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -c ../../../../ext/tiny_tds/result.c
cc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I../../../../ext/tiny_tds -DHAVE_SYBFRONT_H -DHAVE_SYBDB_H -I/usr/src/tiny_tds/ports/x86_64-linux/freetds/0.91/include -I/usr/src/tiny_tds/ports/x86_64-linux/freetds/0.91/include -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -c ../../../../ext/tiny_tds/tiny_tds_ext.c
cc -shared -o tiny_tds.so client.o result.o tiny_tds_ext.o -L. -L/usr/lib -L/usr/src/tiny_tds/ports/x86_64-linux/freetds/0.91/lib -L. -rdynamic -Wl,-export-dynamic -L/usr/src/tiny_tds/ports/x86_64-linux/freetds/0.91/lib -lruby1.8 -lsybdb -liconv -lpthread -lrt -ldl -lcrypt -lm -lc
cd -
** Execute copy:tiny_tds:x86_64-linux:1.8.7
install -c tmp/x86_64-linux/tiny_tds/1.8.7/tiny_tds.so lib/tiny_tds/tiny_tds.so
** Execute compile:tiny_tds:x86_64-linux
** Execute compile:x86_64-linux
** Execute compile

@gardwired
Copy link
Author

this appears to be the issue. the gem is getting created without the -x86_64-linux suffix and rake native gem looks for the gem + platform.gem path which doesn't exist. exploring some workarounds including trying to figure out which gem version this gets fixed.

#28226] Gem::PackageTask gem_dir incorrect

Date:
2010-05-20 16:42 Priority:
3
Submitted By:
Nick Sieger (nicksieger) Assigned To:
Eric Hodel (drbrain)
Category:
None State:
Closed
Summary:
Gem::PackageTask gem_dir incorrect

Detailed description

The local variable "gem_dir" in Gem::PackageTask as added in r2471 incorrectly includes the platform (via
gem_spec.full_name) when the parent is only expecting name-version. For gems that have platform names, this results
in a bad rake prerequisite, since the actual directory is named without the '-java'.

Don't know how to build task 'pkg/activerecord-jdbc-adapter-0.9.7-java'

I think the intention is to just depend on the #package_dir_path name instead. Patch attached.

@gardwired
Copy link
Author

ok, found a workaround on the old rubyforge ticket for this (apparently this ticket didn't get transferred to github when they moved rubygems tickets this past june to github):

http://rubyforge.org/tracker/index.php?func=detail&aid=28226&group_id=126&atid=577

there is a post for this workaround by david kellum:

class Gem::PackageTask
def package_name
gem_spec.full_name
end
end

i added this to the tiny_tds rake file just above the Gem::Package.new call. i now get a platform gem generated.

gem -x86_64-linux.gem installed perfectly. finally!

ok going to test.

@gardwired
Copy link
Author

umm. problems with trying this with bundler Gemfile. illformed requirement. Gem::Version::VERISION_PATTERN doesn't appear to like the dash delimited -x86_64-linux suffix. so we have a gem that doesn't have a valid version for Gemfile/bundler.

@gardwired
Copy link
Author

ok. i removed the specific version requirement in my gemfile and now just have gem "tiny_tds" and i am now ... wait for it ... able to get queries that have dates out of my sql server. amazing. i confirmed that the FooModel.connection :mode => :dblib and not :odbc. so i am pretty certain this is running through the right adapter.

so some things to finally wrap this up:

  1. can we do native gem without the platform -x86_64-linux or install platform gem with just 0.5.1.rc1 as the version? would like to be able to put versions in my gemfile and be able to install multiple versions etc for testing.

  2. does this static gem still read /etc/freetds/freetds.conf?

  3. do i need to bother with seetting freetds options like text size? i am hoping that this would just work with any size text field.

  4. i assume that this is sending an unencrypted, utf-8 encoded request to my sqlserver.

thanks for all the help on this. and i apologize for any brain vacumn on my end....gg

@metaskills
Copy link
Contributor

can we do native gem without the platform -x86_64-linux

I doubt it. It sounds like your using something in your ruby/rails stack that is causing that. It is not an issue of TinyTDS or rake-compiler/miniportile. We have a guy on our team that has a native gem of TinyTDS and it works great with our bundler, old rails 2.3 stack etc. Find out what is in your stack causing the issue and fix or upgrade.

does this static gem still read /etc/freetds/freetds.conf?

FreeTDS will look in some standard places, google their site for which. It even allows you to specific a FREETDS env var to point it to one. We recommend removing conf files unless you have a specific need for one and if that is the case, make sure it is setup right.

do i need to bother with seetting freetds options like text size

Like I said, you could if you want if you maintain the conf file. My advice is to use the sqlserver adapter for things like that. Checkout the README on it, we have ways that you can use #configure_connection hooks for things like this. That feature is in the 2-3-stable and 3-0-stable and master branches. These are just general support questions that you can find by always checking the latest READMEs or subscribing to the google list or watching the CHANGELOG of each project.

i assume that this is sending an unencrypted, utf-8 encoded request to my sqlserver.

Yes, I explained this in the TinyTDS read me and a few other places. Building FreeTDS with OpenSSL is an exercise left to you if that is needed. But it does work and I have tested it since that is the only way Azure let's you connect.

CLOSING THIS ISSUE!

@gardwired
Copy link
Author

ok. i am sorry that this is frustrating for you. it is frustrating for me as well. fwiw, i do think that you have a problem on debian linux with the Gem::PackageTask not building the gem with the -x86_64-linux extension. i had to hack your rake file to get that to work. sure, it might just be me, but it might not. looking through the tickets it appears that you have other linux related issues.

thanks for all your work on this. i appreciate your time and effort and i understand fully what a pain in the butt dealing with sqlserver can be. so thanks for taking this on.

@luislavena
Copy link
Contributor

ok. i am sorry that this is frustrating for you. it is frustrating for me as well. fwiw, i do think that you have a problem on debian linux with the Gem::PackageTask not building the gem with the -x86_64-linux extension.

That is build by Gem::PackageTask when including binaries, you should not be modifying the normal gem package.

Anyhow, the main issue associated to the native gem not being generated is due the version of RubyGems.

@gardwired
Copy link
Author

i tried gems 1.3.7, 1.4,0, 1,4,2, `,5,0 all were unable to build the
platform gem.

On Wed, Dec 7, 2011 at 1:29 PM, Luis Lavena <
reply@reply.github.com

wrote:

ok. i am sorry that this is frustrating for you. it is frustrating for
me as well. fwiw, i do think that you have a problem on debian linux with
the Gem::PackageTask not building the gem with the -x86_64-linux extension.

That is build by Gem::PackageTask when including binaries, you should not
be modifying the normal gem package.

Anyhow, the main issue associated to the native gem not being generated is
due the version of RubyGems.


Reply to this email directly or view it on GitHub:
#58 (comment)

greg gard, psyd
http://gardwired.com

@gardwired
Copy link
Author

sorry 1.5.0 writing this on my phone.

On Wed, Dec 7, 2011 at 1:37 PM, Greg Gard greg@gardwired.com wrote:

i tried gems 1.3.7, 1.4,0, 1,4,2, `,5,0 all were unable to build the
platform gem.

On Wed, Dec 7, 2011 at 1:29 PM, Luis Lavena <
reply@reply.github.com

wrote:

ok. i am sorry that this is frustrating for you. it is frustrating for
me as well. fwiw, i do think that you have a problem on debian linux with
the Gem::PackageTask not building the gem with the -x86_64-linux extension.

That is build by Gem::PackageTask when including binaries, you should not
be modifying the normal gem package.

Anyhow, the main issue associated to the native gem not being generated
is due the version of RubyGems.


Reply to this email directly or view it on GitHub:
#58 (comment)

greg gard, psyd
http://gardwired.com

greg gard, psyd
http://gardwired.com

@luislavena
Copy link
Contributor

i tried gems 1.3.7, 1.4,0, 1,4,2, `,5,0 all were unable to build the platform gem.

You didn't try 1.7.2, build the gem and revert your system back to 1.3.7

@gardwired
Copy link
Author

no i didn't. it didn't occur to me to do that. is the gem_spec.full_name
issue resolved in 1.7.2? or starting with 1.7.x series. if so, then maybe
add this little trick to the compat note you opened the issue on. here is a
link to upgrading/downgrading gems you could include:

http://rubygems.rubyforge.org/rubygems-update/UPGRADING_rdoc.html

On Wed, Dec 7, 2011 at 1:40 PM, Luis Lavena <
reply@reply.github.com

wrote:

i tried gems 1.3.7, 1.4,0, 1,4,2, `,5,0 all were unable to build the
platform gem.

You didn't try 1.7.2, build the gem and revert your system back to 1.3.7


Reply to this email directly or view it on GitHub:
#58 (comment)

greg gard, psyd
http://gardwired.com

@luislavena
Copy link
Contributor

no i didn't. it didn't occur to me to do that. is the gem_spec.full_name
issue resolved in 1.7.2? or starting with 1.7.x series.

Yes, starting RubyGems 1.7.2, rake native gem works properly.

@gardwired
Copy link
Author

it's nice to have some clarity on that thank you. if all goes well, i will
be putting this static gem into production soon. we have around 200k hits a
day so will let you know if i run into other oddities. on a different
ticket :)

On Wed, Dec 7, 2011 at 2:07 PM, Luis Lavena <
reply@reply.github.com

wrote:

no i didn't. it didn't occur to me to do that. is the gem_spec.full_name
issue resolved in 1.7.2? or starting with 1.7.x series.

Yes, starting RubyGems 1.7.2, rake native gem works properly.


Reply to this email directly or view it on GitHub:
#58 (comment)

greg gard, psyd
http://gardwired.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants