You are using pypyodbc, not pyodbc.
 
These are completely different projects. I would suggest using pyodbc
instead, which we have packaged in yum.
 

----- Original message -----
From: Quintin Holmberg <qholmberg@xxxxxxxxxxxxxxxx>
Sent by: "OpenSource" <opensource-bounces@xxxxxxxxxxxxxxxxxx>
To: IBMi Open Source Roundtable <opensource@xxxxxxxxxxxxxxxxxx>
Cc:
Subject: [EXTERNAL] Re: [IBMiOSS] Could not SQLPrepare
Date: Tue, Jun 9, 2020 12:47 PM
 
I got the isql sturff working and tested it with the SQL Richard
suggested as well as a simple SQL stawement hitting one of our primary
files.

Now, when I go to run my Python script I get the following ...
Traceback (most recent call last):
  File "/QOpenSys/pkgs/lib/python3.6/site-packages/pypyodbc.py", line
428, in <module>
    ODBC_API = ctypes.cdll.LoadLibrary('libodbc.so')
  File "/QOpenSys/pkgs/lib/python3.6/ctypes/__init__.py", line 426, in
LoadLibrary
    return self._dlltype(name)
  File "/QOpenSys/pkgs/lib/python3.6/ctypes/__init__.py", line 348, in
__init__
    self._handle = _dlopen(self._name, mode)
OSError: Could not load module /QOpenSys/pkgs/lib/libodbc.so.
        The module has an invalid magic number.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "dayRog_pypyodbc.py", line 7, in <module>
    import pypyodbc as db2
  File "/QOpenSys/pkgs/lib/python3.6/site-packages/pypyodbc.py", line
440, in <module>
    raise OdbcNoLibrary('ODBC Library is not found. Is LD_LIBRARY_PATH
set?')
pypyodbc.OdbcNoLibrary: 'ODBC Library is not found. Is LD_LIBRARY_PATH
set?'

Mr Googlepants tells me I needed to install the python3-pyodbc package
which I did but it did not resolve the issue. The pypyodbc package is
installed via PIP as well.

Any ideas on getting over this next hurdle?

-----Original Message-----
From: OpenSource <opensource-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Richard Schoen
Sent: Friday, June 5, 2020 10:51 AM
To: opensource@xxxxxxxxxxxxxxxxxx
Subject: Re: [IBMiOSS] Could not SQLPrepare

Also if you can share the query you're running that might be
interesting.

I always test with:  select * from qiws.qcustcdt

Regards,
Richard Schoen
Web: [1]http://www.richardschoen.net ;
Email: richard@xxxxxxxxxxxxxxxxx
Phn: (612) 315-1745
----------------------------------------------------------------------

message: 2
date: Thu, 4 Jun 2020 18:45:58 +0000
from: "Kevin Adler" <kadler@xxxxxxxxxx>
subject: Re: [IBMiOSS] Could not SQLPrepare

   You'll get more detailed error messages if you enable verbose mode
(-v) on
   isql: isql -v '*LOCAL'
   ?
   ?

     ----- Original message -----
     From: Quintin Holmberg <qholmberg@xxxxxxxxxxxxxxxx>
     Sent by: "OpenSource" <opensource-bounces@xxxxxxxxxxxxxxxxxx>
     To: IBMi Open Source Roundtable <opensource@xxxxxxxxxxxxxxxxxx>
     Cc:
     Subject: [EXTERNAL] [IBMiOSS] Could not SQLPrepare
     Date: Thu, Jun 4, 2020 1:32 PM
     ?
     I'm running through some instructions on setting up unixODBC and
the ACS
     ODBC provider on my IBMi. I've got through it without much of an
issue.
     At this point I can successfully connect to the system through
isql.
     When I go to run a simple SQL statement through it, though, I get
...

     [ISQL]ERROR: Could not SQLPrepare

     Mr. Googlepants was not much help. Where do I look next for an
answer?

     Thanks,
     Quintin Holmberg

--
This is the IBMi Open Source Roundtable (OpenSource) mailing list To
post a message email: OpenSource@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: [2]https://lists.midrange.com/mailman/listinfo/opensource ;
or email: OpenSource-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
[3]https://archive.midrange.com/opensource ;.

Help support midrange.com by shopping at amazon.com with our affiliate
link: [4]https://amazon.midrange.com ;

NOTICE – this email and any attached file (“Information”) may contain
technical data subject to the U.S. International Traffic in Arms
Regulation (“ITAR”) 22 CFR parts 120-130. The Information may not be
shared with any Foreign Person, as that term is defined in ITAR. The
Information is sent only for the use of the intended recipient and may
contain legally privileged and/or confidential information. If you are
not the intended recipient, you are notified that any dissemination or
copying of the Information is prohibited. If you received the
Information in error you must notify the sender immediately and destroy
the Information without printing or saving it.
--
This is the IBMi Open Source Roundtable (OpenSource) mailing list
To post a message email: OpenSource@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: [5]https://lists.midrange.com/mailman/listinfo/opensource ;
or email: OpenSource-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at [6]https://archive.midrange.com/opensource ;.

Help support midrange.com by shopping at amazon.com with our affiliate
link: [7]https://amazon.midrange.com ;
 

 

References

Visible links
1. http://www.richardschoen.net/
2. https://lists.midrange.com/mailman/listinfo/opensource
3. https://archive.midrange.com/opensource
4. https://amazon.midrange.com/
5. https://lists.midrange.com/mailman/listinfo/opensource
6. https://archive.midrange.com/opensource
7. https://amazon.midrange.com/

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.