Is it possible to access a Pervasive 8 (not Pervasive SQL) database from python?
Asked
Active
Viewed 2,726 times
2 Answers
2
I'm not familiar with Pervasive, but from a quick web search it looks like people are using some kind of ODBC driver to access Pervasive 8.
ODBC databases can be used from python in Windows using PyODBC: http://code.google.com/p/pyodbc/

rakslice
- 8,742
- 4
- 53
- 57
-
pyodbc is cross-platform. It is the Pervasive 8 driver that seems to be windows-only, not pyodbc. – nosklo Sep 09 '09 at 17:36
2
yes you can. here is the working code
import os
import sys
import pyodbc
def main():
conn_str = 'Driver={Pervasive ODBC Interface};server=localhost;DBQ=DATABASENAME'
db = pyodbc.connect(conn_str)
c = db.cursor()
c.execute("SELECT COUNT(*) FROM TABLENAME")
row = c.fetchone()
if row:
print(row)
return 0
if __name__ == "__main__":
sys.exit(main())

SAMI UL HUDA
- 171
- 7