Connecting to Splice Machine with Python via JDBC

This topic shows you how to connect to a Splice Machine database using our JDBC driver with Python, using these steps:

  1. Install the JayDeBeApi python library

     $ pip install JayDeBeApi
    
  2. Start the Python interpreter

    $ python
    
  3. Connect to a running instance of Splice Machine

    >>> import jaydebeapi
    >>> conn = jaydebeapi.connect("com.splicemachine.db.jdbc.ClientDriver",
    "jdbc:splice://asdsaccount-qatest4.splicemachine-qa.io:1527/splicedb",
    {'user': "yourUserId", 'password': "yourPassword", 'ssl': "basic"},
    "/Users/admin/Downloads/db-client-2.6.1.1736.jar")
    >>> curs = conn.cursor()
    >>> curs.execute('select count(1) from sys.systables')
    >>> n = curs.fetchall()
    >>> n
    [(<jpype._jclass.java.lang.Long object at 0x11fd61ad0>,)]
    >>> int(n[0][0].value)
    43