Example #1
0
import pycorda as pyc

url = 'jdbc:h2:tcp://localhost:52504/node'
username = '******'
password = ''
node = pyc.Node(url, username, password)
print(node.get_node_infos())
node.close()

h2 = pyc.H2Tools()
ver = h2.get_latest_version()
print(ver)
h2.download_h2jar(
)  # downloads latest h2 jar and stores in local folder as h2.jar
Example #2
0
# Flask app

from flask import Flask, render_template, Response
import pycorda as pyc

app = Flask(__name__)
partyA = pyc.Node('jdbc:h2:tcp://localhost:55555/node','sa','')
node_info = partyA.get_node_infos().to_html()

@app.route('/')
def display_node_info():
    return Response(node_info)
Example #3
0
def new_node(config):
    db_url = config['db_url']
    default_driver_path = os.path.join(tests_dir(), 'h2-1.4.200.jar')
    client_driver_path = config.get('client_driver_path', default_driver_path)
    return pycorda.Node(db_url, "sa", "", client_driver_path)
Example #4
0
# Quick start


url = 'jdbc:h2:tcp://localhost:55555/node'
partyA = pyc.Node(url,’sa’,’’)
print(partyA.get_node_infos())

# Download H2 JDBC driver
pyc.H2Tools().download_h2jar()

# Exploring a node

username = '******'
password = ''
url = 'jdbc:h2:tcp://localhost:55555/node'
partyA = pyc.Node(url,username,password)

node_infos = partyA.get_node_infos()
print(node_infos)

type(node_infos)

print(node_infos.shape)

messaging_ports = partyA.get_node_info_hosts()
print(messaging_ports)
print(messaging_ports['host_name'])

print(node_infos.columns)

print(messaging_ports[messaging_ports['PORT'] > 10006])
Example #5
0
 def test_invalid_driver(self):
     config = get_config()
     with self.assertRaises(OSError):
         pycorda.Node(config['db_url'], 'sa', '', 'fake_driver_path.jar')