Re: Using GROUP BY and COUNT

Jeremy Livingston <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <CACAKNbtn7g8f47=sF4p-dBeXNXU0-aNari9VKpsNDcdV99VJrA@mail.gmail.com>
The only reason that I asked about the driver is because that is the error
that I am receiving when I try to run my query with bsqlodbc:

bsqlodbc -S {server} -U {user} -P {pass} -D {db} <<< 'select count
(productCode) from Membership'

bsqlodbc: error -1: SQLConnect: SQL_ERROR: failed "[unixODBC][Driver
Manager]Data source name not found, and no default driver specified"

I'm not sure if there's configuration that I'm missing or what...but when I
connect with a DSN from the same server via the web, I don't have this
issue.


On Wed, Dec 19, 2012 at 3:51 PM, James K. Lowden <[email protected]>wrote:

> On Wed, 19 Dec 2012 13:38:06 -0500
> Jeremy Livingston <[email protected]> wrote:
>
> > Pardon my ignorance, but I'm not sure how to specify that driver that
> > I'd like to use using bsqlodbc.
>
> Look again at my example.  :-)  It's not a driver I'm using.  bsqlodbc
> is a FreeTDS command-line utility; it's found in src/apps and should
> have been installed somewhere like /usr/local/bin when you installed
> FreeTDS.
>
> The point is to determine if the problem you're seeing is in the
> FreeTDS ODBC driver (which the utility uses), or in the PHP module, or
> in your application.  I think you'll find bsqlodbc runs your query just
> fine, which suggests the problem in not in the driver.
>
> > For example: "SELECT COUNT(MiddleName) FROM Person"
> > where MiddleName contains all null values will throw the error.
>
> You might try these, too:
>
> $ echo 'select count(t) from (select cast(NULL as int) as t) as T' \
>         | bsqlodbc -U$U -P$P -S$S
> ----------
>          0
> bsqlodbc: error 8153: 01003: [FreeTDS][SQL Server]Warning: Null value
> is eliminated by an aggregate or other SET operation.
>
> If I stack a guess on a few assumptions, the most likely problem is
> that the error message isn't handled correctly.  For example, if PHP
> stops processing the resultset when the message arrives, and then
> continues to use the connection without fetching or cancelling the
> pending results, you would see an invalid-cursor-state error on the
> next query.
>
> HTH.
>
> --jkl
> _______________________________________________
> FreeTDS mailing list
> [email protected]
> http://lists.ibiblio.org/mailman/listinfo/freetds
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.