Add an example for db connection properties
parent
11ffde4504
commit
8bf5576780
|
|
@ -46,6 +46,7 @@ install:
|
||||||
script:
|
script:
|
||||||
- if [ -z "$JYTHON" ]; then PY="coverage run --source jaydebeapi"; else PY="python" ;fi
|
- if [ -z "$JYTHON" ]; then PY="coverage run --source jaydebeapi"; else PY="python" ;fi
|
||||||
- $PY test/testsuite.py $TESTNAME
|
- $PY test/testsuite.py $TESTNAME
|
||||||
|
- $PY -m doctest README.rst
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- if [ -z "$JYTHON" ]; then coveralls ;fi
|
- if [ -z "$JYTHON" ]; then coveralls ;fi
|
||||||
|
|
|
||||||
21
README.rst
21
README.rst
|
|
@ -88,10 +88,10 @@ environment.
|
||||||
Here is an example:
|
Here is an example:
|
||||||
|
|
||||||
>>> import jaydebeapi
|
>>> import jaydebeapi
|
||||||
>>> conn = jaydebeapi.connect('org.hsqldb.jdbcDriver',
|
>>> conn = jaydebeapi.connect("org.hsqldb.jdbcDriver",
|
||||||
... 'jdbc:hsqldb:mem:.',
|
... "jdbc:hsqldb:mem:.",
|
||||||
... ['SA', ''],
|
... ["SA", ""],
|
||||||
... '/path/to/hsqldb.jar',)
|
... "/path/to/hsqldb.jar",)
|
||||||
>>> curs = conn.cursor()
|
>>> curs = conn.cursor()
|
||||||
>>> curs.execute('create table CUSTOMER'
|
>>> curs.execute('create table CUSTOMER'
|
||||||
... '("CUST_ID" INTEGER not null,'
|
... '("CUST_ID" INTEGER not null,'
|
||||||
|
|
@ -102,12 +102,23 @@ Here is an example:
|
||||||
>>> curs.execute("select * from CUSTOMER")
|
>>> curs.execute("select * from CUSTOMER")
|
||||||
>>> curs.fetchall()
|
>>> curs.fetchall()
|
||||||
[(1, u'John')]
|
[(1, u'John')]
|
||||||
|
>>> curs.close()
|
||||||
|
>>> conn.close()
|
||||||
|
|
||||||
|
An alternative way to establish connection using connection
|
||||||
|
properties:
|
||||||
|
>>> conn = jaydebeapi.connect("org.hsqldb.jdbcDriver",
|
||||||
|
... "jdbc:hsqldb:mem:.",
|
||||||
|
... {'user': "SA", 'password': "",
|
||||||
|
... 'other_property': "foobar"},
|
||||||
|
... "/path/to/hsqldb.jar",)
|
||||||
|
|
||||||
|
|
||||||
If you're having trouble getting this work check if your ``JAVA_HOME``
|
If you're having trouble getting this work check if your ``JAVA_HOME``
|
||||||
environmentvariable is set correctly. For example I have to set it on
|
environmentvariable is set correctly. For example I have to set it on
|
||||||
my Ubuntu machine like this ::
|
my Ubuntu machine like this ::
|
||||||
|
|
||||||
$ JAVA_HOME=/usr/lib/jvm/java-6-openjdk python
|
$ JAVA_HOME=/usr/lib/jvm/java-8-openjdk python
|
||||||
|
|
||||||
Supported databases
|
Supported databases
|
||||||
===================
|
===================
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue