[unixODBC-support] Re: unixODBC-support Digest, Vol 31, Issue 14

magic hat magic_hat60622 at yahoo.com
Tue Mar 27 16:43:22 BST 2007


Hi, Thanks for the thoughts. 

The query actually works fine with slightly different parameters (i.e., ccc.Table.Field1=2). Maybe I'm losing a connection or timing out? I don't know... 



Amit Kapila <amit.kapila at oracle.com> wrote: Hi,

I think you can start with manipulating your query to check first of all 
what query returns proper data through linux.

 >>SELECT TOP 20 * FROM ccc.Table WHERE (ccc.Table.Field1 = 3 AND 
(ccc.Table.Field2>0)) ORDER BY Field3 desc

What will happen if you remove TOP 20 clause from your query and then 
run it?
SELECT * FROM ccc.Table WHERE (ccc.Table.Field1 = 3 AND 
(ccc.Table.Field2>0)) ORDER BY Field3 desc

Incase above doesn't work then try using field names or just check for 
COUNT(*) in query instead of '*'.

With Regards,
Amit Kapila.

unixodbc-support-request at easysoft.com wrote:

>Send unixODBC-support mailing list submissions to
> unixodbc-support at easysoft.com
>
>To subscribe or unsubscribe via the World Wide Web, visit
> http://mail.easysoft.com/mailman/listinfo/unixodbc-support
>or, via email, send a message with subject or body 'help' to
> unixodbc-support-request at easysoft.com
>
>You can reach the person managing the list at
> unixodbc-support-owner at easysoft.com
>
>When replying, please edit your Subject line so it is more specific
>than "Re: Contents of unixODBC-support digest..."
>
>
>Today's Topics:
>
>   1. query failing (magic hat)
>   2. Connect to local linux ms access jet database via odbc from
>      php or java (Mirko Scurk)
>
>
>----------------------------------------------------------------------
>
>Message: 1
>Date: Mon, 26 Mar 2007 11:19:09 -0700 (PDT)
>From: magic hat 
>Subject: [unixODBC-support] query failing
>To: Support for the unixODBC project 
>Message-ID: <978919.52156.qm at web60915.mail.yahoo.com>
>Content-Type: text/plain; charset="iso-8859-1"
>
>Hi everyone. 
>
>I'm connecting to MS SQLServer 2005 with unixodbc and freetds. I'm running a query on my linux box that is returning no data. However, when I run it from SQLServer's admin interface, it returns several rows. 
>
>In other situations, the odbc setup works perfectly. 
>
>Wondering if anyone's encountered this before or has suggestions on where to start debugging. 
>
>Here's the query:
>
>
>SELECT TOP 20 * FROM ccc.Table WHERE (ccc.Table.Field1 = 3 AND (ccc.Table.Field2>0))  ORDER BY Field3 desc 
>
>
> 
>---------------------------------
>Don't be flakey. Get Yahoo! Mail for Mobile and 
>always stay connected to friends.
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: http://mail.easysoft.com/pipermail/unixodbc-support/attachments/20070326/401f384b/attachment-0001.html
>
>------------------------------
>
>Message: 2
>Date: Mon, 26 Mar 2007 22:59:43 +0200 (CEST)
>From: "Mirko Scurk" 
>Subject: [unixODBC-support] Connect to local linux ms access jet
> database via odbc from php or java
>To: unixodbc-support at easysoft.com
>Message-ID:
> <37809.193.198.166.241.1174942783.squirrel at webmail.sfsb.hr>
>Content-Type: text/plain;charset=iso-8859-2
>
>Hi!
>
>I spent some time googling and trying to establish connections from linux
>pc to local mdb file but had no luck. Here is my configuration:
>
>Ubuntu edgy 2.6.17-10-generic #2 SMP
>
>unixodbc 2.2.11-13
>unixodbc-bin 2.2.11-13
>libmdbodbc 0.5.99.0.6pre1.0.20051109-3
>libmdbtools 0.5.99.0.6pre1.0.20051109-3
>mdbtools 0.5.99.0.6pre1.0.20051109-3
>mdbtools-gmdb 0.5.99.0.6pre1.0.20051109-3
>
># cat /etc/odbc.ini
>[ODBC]
>Trace=yes
>Tracefile=/tmp/trc.log
>
>[LOIR]
>Description = MicrosoftAccessDatabaseofLOIR
>Driver = MDBToolsODBC
>Database = /var/www/storage.mdb
>Server = localhost
>Username = ""
>Password = ""
>
># cat /etc/odbcinst.ini
>[MDBToolsODBC]
>Description             = MDBToolsODBCdrivers
>Driver          = /usr/lib/libmdbodbc.so.0
>UsageCount              = 1
>FileUsage               = 1
>
>
># ls -la /var/www
>-rw-r--r--  1 www-data www-data      193 2007-03-25 16:01 .odbc.ini
>-rw-r--r--  1 www-data www-data 48791552 2007-03-24 02:04 storage.mdb
>
># cat /etc/passwd
>www-data:x:33:33:www-data:/var/www:/bin/sh
>
>
># cat /var/www/access.php
>
>
>
>>$conn=odbc_connect('LOIR','','');
>if (!$conn)
>  {exit("Connection Failed: " . $conn);}
>$sql="SELECT CITY_NAME, CITY_ZIPCODE FROM CITIES";
>$rs=odbc_exec($conn,$sql);
>if (!$rs)
>  {exit("Error in SQL");}
>echo "";
>echo "CITY_NAME";
>echo "CITY_ZIPCODE";
>while (odbc_fetch_row($rs))
>{
>  $compname=odbc_result($rs,"CITY_NAME");
>  $conname=odbc_result($rs,"CITY_ZIPCODE");
>  echo "$compname";
>  echo "$conname";
>}
>odbc_close($conn);
>echo "";
>?>
>
>
>
>
>phpinfo function returns
>
>odbc
>ODBC Support enabled
>Active Persistent Links  0
>Active Links  0
>ODBC library  unixODBC
>ODBC_INCLUDE  -I/usr/include
>ODBC_LFLAGS  -L/usr/lib
>ODBC_LIBS  -lodbc
>
>Directive Local Value Master Value
>odbc.allow_persistent On On
>odbc.check_persistent On On
>odbc.default_db no value no value
>odbc.default_pw no value no value
>odbc.default_user no value no value
>odbc.defaultbinmode return as is return as is
>odbc.defaultlrl return up to 4096 bytes return up to 4096 bytes
>odbc.max_links Unlimited Unlimited
>odbc.max_persistent Unlimited Unlimited
>
>When I load page access.php nothing happens. No error just message
>"Waiting for localhost..."
>
>I tried with isql and everything is working fine:
>
># isql LOIR
>+---------------------------------------+
>| Connected!                            |
>|                                       |
>| sql-statement                         |
>| help [tablename]                      |
>| quit                                  |
>|                                       |
>+---------------------------------------+
>SQL> select DIN from CITIES
>+-----------+
>| DIN       |
>+-----------+
>| 1         |
>| 112       |
>| 126       |
>| 130       |
>| 151       |
>| 160       |
>| 163       |
>| 181       |
>| 185       |
>| 222       |
>| 258       |
>| 331       |
>| 1210      |
>| 1222      |
>| 1245      |
>| 1365      |
>| 2127      |
>| 2185      |
>| 2204      |
>| 2213      |
>| 2218      |
>| 2963      |
>| 2975      |
>| 2977      |
>| 2980      |
>| 3814      |
>| 3822      |
>| 4728      |
>| 5141      |
>| 6323      |
>| 6828      |
>| 6830      |
>| 7187      |
>| 7828      |
>+-----------+
>SQLRowCount returns 34
>34 rows fetched
>
>What am I doing wrong?
>Is it even possible to connect from php to mdb?
>Do I have to buy some drivers?
>Is it possible to connect from netbeans to this odbc dns via jdbc-odbc
>without some special additional drivers?
>
>Thanks!
>
>  
>

_______________________________________________
unixODBC-support mailing list
unixODBC-support at easysoft.com
http://mail.easysoft.com/mailman/listinfo/unixodbc-support


 
---------------------------------
The fish are biting.
 Get more visitors on your site using Yahoo! Search Marketing.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20070327/fa23c596/attachment.html>


More information about the unixODBC-support mailing list