Jupyter Notebook is a web-based interactive application that enables users to create notebook documents that feature live code, interactive plots, widgets, equations, images etc., and share these documents easily. It is also quite versatile as it can support many programming languages via kernels such as Julia, Python, Ruby, Scala, Haskell and R.
How can users connect to their databases using standards-based connectivity like ODBC or JDBC from various applications? In this tutorial, we will walk through on how you can query your Oracle database using Progress DataDirect Oracle ODBC driver. Note that you can use similar procedure to query/access your other databases using Progress DataDirect suite of ODBC drivers which includes drivers for Relational, Big Data, NoSQL and Cloud data sources.
sudo apt-get install unixodbc-dev unixodbc-bin unixodbcpip install pyodbc
tar -xvf PROGRESS_DATADIRECT_ODBC_ORACLE_LINUX_64.tar.Z -C /path/to /directory/
sudo apt-get install ksh
./unixmi.ksh
[Oracle Wire Protocol]Driver=/home/progress/Progress/DataDirect/Connect64_for_ODBC_71/lib/ddora27.soDescription=DataDirect 7.1 Oracle Wire ProtocolAlternateServers=ApplicationUsingThreads=1AccountingInfo=Action=ApplicationName=ArraySize=60000AuthenticationMethod=1BulkBinaryThreshold=32BulkCharacterThreshold=-1BulkLoadBatchSize=1024BulkLoadFieldDelimiter=BulkLoadRecordDelimiter=CachedCursorLimit=32CachedDescLimit=0CatalogIncludesSynonyms=1CatalogOptions=0ClientHostName=ClientID=ClientUser=ConnectionReset=0ConnectionRetryCount=0ConnectionRetryDelay=3DataIntegrityLevel=0DataIntegrityTypes=MD5,SHA1DefaultLongDataBuffLen=1024DescribeAtPrepare=0EditionName=EnableBulkLoad=0EnableDescribeParam=0EnableNcharSupport=0EnableScrollableCursors=1EnableStaticCursorsForLongData=0EnableTimestampWithTimeZone=0EncryptionLevel=0EncryptionMethod=0EncryptionTypes=AES128,AES192,AES256,DES,3DES112,3DES168,RC4_40,RC4_56,RC4_128,RC4_256FailoverGranularity=0FailoverMode=0FailoverPreconnect=0FetchTSWTZasTimestamp=0GSSClient=nativeHostName=<Host name of your database>HostNameInCertificate=InitializationString=KeyPassword=KeyStore=KeyStorePassword=LoadBalanceTimeout=0LoadBalancing=0LocalTimeZoneOffset=LockTimeOut=-1LoginTimeout=15LogonID=<LoginID>MaxPoolSize=100MinPoolSize=0Module=Password=<password>Pooling=0PortNumber=<Port Number>ProcedureRetResults=0ProgramID=QueryTimeout=0ReportCodePageConversionErrors=0ReportRecycleBin=0ServerName= <Remove this line>ServerType=0ServiceName=SID=XETimestampeEscapeMapping=0TNSNamesFile=<tnsnames.ora_filename>TrustStore=TrustStorePassword=UseCurrentSchema=1ValidateServerCertificate=1WireProtocolMode=2
##Importing pyodbc module import pyodbc##connecting to your database through ODBCcnxn = pyodbc.connect('DSN=Oracle Wire Protocol;UID=<user>;PWD=<password>', autocommit=True)cursor = cnxn.cursor()##Executing a simple query and printing the recordscursor.execute("SELECT * FROM GDP ORDER BY YEAR")for row in cursor.fetchall(): print (row)
pip install plotly
##importing modulesimport pyodbc;import plotly.plotly as pyimport plotly.graph_objs as go##Signing into Plotly to use the APIpy.sign_in(username='saiteja09', api_key='9aoJRKWK4z8NYoTpb2Tv');##Establishing connectioncnxn = pyodbc.connect('DSN=Oracle Wire Protocol;UID=pets;PWD=progress', autocommit=True)cursor = cnxn.cursor()years = []ind_gdp = []wor_gdp = []us_gdp = []chn_gdp = []uk_gdp = []##Executing query and appending the data in to respective listscursor.execute("SELECT * FROM GDP ORDER BY YEAR")for row in cursor.fetchall(): years.append(row[4]) ind_gdp.append(row[1]) wor_gdp.append(row[2]) us_gdp.append(row[3]) chn_gdp.append(row[5]) uk_gdp.append(row[6])##Setting X and Y axis, and the name of tracetrace0 = go.Scatter(x=years, y=ind_gdp,name='India')trace1 = go.Scatter(x=years, y=wor_gdp,name='World')trace2 = go.Scatter(x=years, y=us_gdp,name='US')trace3 = go.Scatter(x=years, y=chn_gdp,name='China')trace4 = go.Scatter(x=years, y=uk_gdp,name='UK')##The Plotdata = [trace0, trace1, trace2, trace3, trace4]py.iplot(data, filename='basic-line-plot')

GDP Plot for various countries
We hope this tutorial helped you to understand on how you can connect to your database using Progress DataDirect Oracle ODBC driver and visualize the data in your Jupyter Notebooks. Feel free to try other Progress DataDirect ODBC drivers for your data analysis and visualization purposes on your Jupyter notebooks. Also learn about how DataDirect drivers are more viable in than open source drivers with regards to licensing complexity, open source risk, legal risk, product quality and support.
Note: Progress DataDirect ODBC drivers are not certified with the unixODBC Driver Manager and reported issues must be reproducible with a supported version of the DataDirect ODBC Driver Manager for Unix/Linux.