A module for connecting to HyperSQL using JDBC, based on JayDeBeApi
Project description
This project is based on JayDeBeApi and contains modifications to support sqlalchemy-hsqldb, an SQLAlchemy dialect for HyperSQL 2.0.
Installation
A package for installing jaydebeapi-hsqldb from pypi.org will soon be available To install jaydebeapi-hsqldb from pypi.org, open a command prompt and type:
pip install jaydebeapi-hsqldb
Alternatively the module can be downloaded from its repository on GitHub:
Use the ‘pip install <path>’ syntax to install, where <path> points to where your local copy is installed, e.g.
pip install ./jaydebeapi-hsqldb
Post-install Configuration
Your system needs to know where the Java Runtime Environment is. If not detected automatically you may need to add ‘JAVA_HOME’ or ‘JRE_HOME’ to your environment variables.
set "JAVA_HOME=C:\Program Files\Java\jre-1.8\bin"
Getting Started
The code example found in this section is provided as a quick hint on how to connect to a HyperSQL server. You will need to update the parameters passed to the connect method to reflect your system’s configuration.
The ‘jclassname’ parameter, a.k.a. classpath, should be set to HyperSQL’s JDBCDriver class, i.e. ‘org.hsqldb.jdbc.JDBCDriver’
The ‘url’ parameter will depend on your HyperSQL server’s configuration. This can be fairly complex, and rather explain it here I’ll direct you to the JDBCConnection documentation on hsqldb.org
The ‘driver_args’ parameter can be a sequence or dictionary, as described in the documentation for the jaydebeapi.connect method.
The ‘jars’ parameter needs to include the location of your HSQLDB jar file,
import jaydebeapi_hsqldb as jaydebeapi
jclassname = 'org.hsqldb.jdbc.JDBCDriver' # driver path
url = 'jdbc:hsqldb:hsql://localhost/db1' # connection string
driver_args = ['SA', ''] # username and password
jars = ('/PROGS/HSQLDB/hsqldb-osgi-jdk8.jar',) # location of HSQLDB jar
try:
conn = jaydebeapi.connect(
jclassname,
url,
driver_args,
jars
)
curs = conn.cursor()
curs.execute('VALUES(DATABASE_VERSION())')
version = curs.fetchone()[0]
print(f'\nSuccessfully connected!\nHSQLDB version: {version}\n')
curs.close()
conn.close()
except Exception as e:
# Connection failed...
print(f'\n{repr(e)}\n{str(e)}\n')
Troubleshooting
This project was coded and tested on a 64-bit Windows system. It should work on other platforms too, but you may find the code examples and docs need adapting.
If you’re struggling to get jaydebeapi-hsqldb working, here are a few things you can try:
Avoid mixing 32-bit and 64-bit software components
If the Java Runtime Environment (JRE) is not automatically detected you may need to add ‘JAVA_HOME’ or ‘JRE_HOME’ to your environment variables.
If you suspect a permissions issue, try installing and running with an administrator account.
If you suspect a firewall issue, temporarily disable the firewall to see if this is the case.
If you suspect some other configuration issue, ensure all paths specified are correct. Use back slashes or forward slashes as appropriate for your OS. Do they need escaping?
- Submit a question via StackOverflow!
It’s quite possible others have already encountered the same issue and SO can often provide a quick response. Tag your question with an appropriate tag, such as ‘jaydebeapi-hsqldb’, which I can then monitor.
If you think you’ve found a bug please feel welcome to submit a report via GitHub:
Known Issues
This release contains debug code and may halt unexpectedly when new datatypes are encountered.
Changelog
0.0.3 Added support for more data types. 0.0.1 Initial release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jaydebeapi_hsqldb-0.0.3.tar.gz.
File metadata
- Download URL: jaydebeapi_hsqldb-0.0.3.tar.gz
- Upload date:
- Size: 35.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea84d2c2a31e1b7aecfd6c8cf2f954b615da0da685cf863b80e2085ead13b0ac
|
|
| MD5 |
c7e9c2f3c43d2d39b9da6ed09f503a69
|
|
| BLAKE2b-256 |
0016ee2c3373180b98739661444c2eca3203b362d71c9cf1be04a2ed713e018d
|
File details
Details for the file jaydebeapi_hsqldb-0.0.3-py3-none-any.whl.
File metadata
- Download URL: jaydebeapi_hsqldb-0.0.3-py3-none-any.whl
- Upload date:
- Size: 29.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8da43e1fc2c2a7b877a4d1b696271f3816735667062fe6e31f96b898127f532
|
|
| MD5 |
93608d220b0f054a0af03b1a98778081
|
|
| BLAKE2b-256 |
1334dbaadaf17e09efbe218a619d031cb9cd0279a0b8bbb9576f7624100e1707
|