Solved

H2 with python

Posted on 2016-07-15
6
126 Views
Last Modified: 2016-09-23
Hi,

I have a h2 database that i need to manipulate with python 2.7.

I saw in google that this is indirectly possible by setting up a postgre sql instance but i didn't understand what i should do after installing postgre server.

Any help?

Br.
0
Comment
Question by:jazzIIIlove
  • 4
6 Comments
 
LVL 26

Expert Comment

by:Zberteoc
ID: 41714536
Is it H2 or PostgresSQL you are trying to connect to?
0
 
LVL 12

Author Comment

by:jazzIIIlove
ID: 41724989
It is h2
0
 
LVL 26

Assisted Solution

by:Zberteoc
Zberteoc earned 500 total points
ID: 41725001
Apparently Python doesn't have a H2 driver to be able to connect directly but there is a way to use Java ODBC driver from Python but you have to setup few things. Here is a module that will allow you to use a Java drive in order to connect to an H2 database. I have never used H@ but it is rare that Python doesn't have a module for a database product because if it did the way to work with it would be the same to any other db product.

https://pypi.python.org/pypi/JayDeBeApi/
0
 
LVL 26

Assisted Solution

by:Zberteoc
Zberteoc earned 500 total points
ID: 41725007
This might be useful if you choose Postgess:

https://statyili.wordpress.com/2010/02/27/in-memory-db-h2-and-python/
0
 
LVL 26

Accepted Solution

by:
Zberteoc earned 500 total points
ID: 41725010
I found a reference that say that the use the psycopg2 module in Python but then you have to setup the H2 to run in Psotgress mode:

https://pypi.python.org/pypi/psycopg2

You need to install that module in Python then setup H2 in postgress mode and then you should be able to connect to it.

http://queforum.com/postgresql/836561-postgresql-there-python-module-supports-h2-database-%5B-hold%5D.html
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Read about achieving the basic levels of HRIS security in the workplace.
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now