Connecting to a Database (Synchronously) ======================================== Connect to a database called **sandbox** using a vnode called **loathing**. Because OpenAPI functions generally return before the requested operation is complete, this example illustrates the use of "busy wait" loops to prevent the application from proceeding too soon. :download:`Download <./examples/connect-sync.py>` .. LITERALINCLUDE:: ./examples/connect-sync.py :linenos: Once the connection is established the application can start sending SQL statements to be executed, fetching query results, and controlling the session behaviour (e.g. committing transactions, setting lockmodes, changing display formats.) All of these operations will need to be protected with busy-wait loops too. :download:`Download <./examples/connect-sync.py>`