Hi again,
It was easy after all to make it work with jruby. For those who might be
interested one day... here is the code...
require 'java'
java_import org.h2.Driver
java_import java.sql.DriverManager
java_import java.sql.PreparedStatement
conn = Java::JavaSql::DriverManager.getConnection('jdbc:h2:testdb','','')
stmt = conn.createStatement()
stmt.executeUpdate "DROP TABLE IF EXISTS TEST"
stmt.executeUpdate "CREATE TABLE TEST(ID INT PRIMARY KEY, NAME
VARCHAR(255))"
stmt.executeUpdate "INSERT INTO TEST VALUES(1, 'Hello')"
stmt.executeUpdate "INSERT INTO TEST VALUES(2, 'Goodbye')"
stmt.executeUpdate "INSERT INTO TEST VALUES(3, 'World')"
prep = conn.prepareStatement "DELETE TEST WHERE ID = ?"
prep.setInt(1,2)
prep.executeUpdate()
conn.close()
Thanks again for the google hints and this great db!
--
Christian
On Friday, March 30, 2012 11:07:53 PM UTC+2, Christian MICHON wrote:
>
> Thanks guys. As I'm actually using jruby (and not really java), this will
> be interesting to code...
>
> I still find it strange no one ever posted any tutorial on H2 db + jdbc
> preparedstatement...
>
> I will experiment and come back to this group if I meet issues.
>
> --
> Christian
>
>
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/h2-database/-/3Hg5Gpf3rpcJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.