Forum OpenACS Development: Re: Re: Connecting with SQLServer
7: Re: Re: Connecting with SQLServer (response to 5)
Posted by Andrew Piskorski on 08/02/05 09:15 AM
Hamilton, the example config file in your link is using the obsolete "AvailablePool" syntax, which pre-dates and does not support the -dbn feature. It also never gives the "ns_param database_names" config line at all, which (as far as I recall) means that the -dbn feature can't possibly work with that config file. Are those the real config settings you actually used, or did you leave some out?
Also, your code example then does something really weird:
If that code works at all, it's totally by accident. When using the -dbn switch you should never be calling "ns_db gethandle" at all. Actually, when using any of the OpenACS db_* API you should not be calling "ns_db gethandle". Also, for the -dbn feature to work you need to pass a database_name to the -dbn switch, not a database pool.set handle [ns_db gethandle "pool4" ] db_1row -dbn "pool4" "test" "select user_id from ecwork.dbo.users"
Steve Manning's example above is the right way to do it.