diff --git a/README.rst b/README.rst index 2ac8730..87e33b3 100644 --- a/README.rst +++ b/README.rst @@ -85,8 +85,9 @@ in memory database on my Ubuntu machine I'm starting Python by running :: Now I have to configure JPype >>> import jpype ->>> jar = '/path/to/my/driver/hsqldb.jar' +>>> jar = r'/path/to/my/driver/hsqldb.jar' >>> args='-Djava.class.path=%s' % jar +>>> jvm_path = jpype.getDefaultJVMPath() >>> jpype.startJVM(jvm_path, args) or in Jython I have to @@ -101,12 +102,35 @@ Supported databases In theory every database with a suitable JDBC driver should work. It is known to work with the following databases: -* `SQLite 3 `_ using `SqliteJDBC - `_ v056 -* `Hypersonic SQL (HSQLDB) `_ 1.8.1.3 -* `IBM DB2 `_ for z/OS using - JDBC type 4 drivers. - ++-----------------------------------------+------------------------------------------------+---------------+----------------------+ +|Database |JDBC driver |Supported |Remarks | ++=========================================+================================================+===============+======================+ +|`SQLite |`SqliteJDBC |Good |Can't interpret | +|`_ |`_ v056 | |selected BLOBs | +|3 | | |correctly. | ++-----------------------------------------+------------------------------------------------+---------------+----------------------+ +| |`Sqlite Java Wrapper |Medium |Weird type handling. | +| |`_ | | | +| |javasqlite-20110106-win32 | | | ++-----------------------------------------+------------------------------------------------+---------------+----------------------+ +|`Hypersonic SQL (HSQLDB) |Builtin |Very Good |No BLOB support | +|`_ 1.8.1.3 | | |by database. | +| | | | | ++-----------------------------------------+------------------------------------------------+---------------+----------------------+ +|`Hypersonic SQL (HSQLDB) |Builtin |Medium |Weird decimal | +|`_ 2 | | |type | +| | | |conversions. No | +| | | |BLOB support. | ++-----------------------------------------+------------------------------------------------+---------------+----------------------+ +|`IBM DB2 |JDBC type 4 drivers from IBM (``db2jcc.jar``) |Medium. |Not thoroughly tested | +|`_| | |but seems to work | +|for z/OS | | |without problems. | ++-----------------------------------------+------------------------------------------------+---------------+----------------------+ +|Oracle 11g |Oracle Thin Driver |Medium |Not thooughly | +| | | |testst. No support for| +| | | |rading of timestamps | +| | | |yet. | ++-----------------------------------------+------------------------------------------------+---------------+----------------------+ Contributing ============ diff --git a/src/jaydebeapi/dbapi2.py b/src/jaydebeapi/dbapi2.py index 7edaba0..378b65c 100644 --- a/src/jaydebeapi/dbapi2.py +++ b/src/jaydebeapi/dbapi2.py @@ -291,6 +291,8 @@ class Cursor(object): for col in range(1, self._meta.getColumnCount() + 1): sqltype = self._meta.getColumnType(col) # print sqltype + # TODO: Oracle 11 will read a oracle.sql.TIMESTAMP + # which can't be converted to string easyly v = self._rs.getObject(col) if v: converter = _converters.get(sqltype) diff --git a/src/test/data/create.sql b/src/test/data/create.sql index b372a6f..e47ca90 100644 --- a/src/test/data/create.sql +++ b/src/test/data/create.sql @@ -6,7 +6,7 @@ create table Account ( "DBL_COL" DOUBLE, "OPENED_AT" DATE, "VALID" BOOLEAN, -"PRODUCT_NAME" VARCHAR, +"PRODUCT_NAME" VARCHAR(50), "STUFF" BLOB, primary key ("ACCOUNT_ID") ); diff --git a/src/test/integration_test.py b/src/test/integration_test.py index d36036e..b45e8eb 100644 --- a/src/test/integration_test.py +++ b/src/test/integration_test.py @@ -91,12 +91,15 @@ class IntegrationTest(TestCase): # 'jdbc:hsqldb:mem', 'SA', '') # conn = jaydebeapi.connect('com.ibm.db2.jcc.DB2Driver', # 'jdbc:db2://4.100.73.81:50000/db2t', - # getpass.getuser(), - # getpass.getpass()) + # user, passwd) # driver from http://www.ch-werner.de/javasqlite/ seems to be # crap as it returns decimal values as VARCHAR type # conn = jaydebeapi.connect('SQLite.JDBCDriver', # 'jdbc:sqlite:/:memory:') + # Oracle Thin Driver + # conn = jaydebeapi.connect('oracle.jdbc.OracleDriver', + # 'jdbc:oracle:thin:@//hh-cluster-scan:1521/HH_TPP', + # user, passwd) return jaydebeapi, conn def setUp(self):