How to form connection between HSQLDB and C# .net? -
how form connection between hsqldb , c# .net ? have looked @ sharphsql , h2sharp not able connect hsqldb.
try this: make sure you've add hsqldb.dll, ikvm.openjdk.core.dll, ikvm.openjdk.jdbc.dll reference. if don't have ikvm library, can download here.
at c#:
using java.sql; //add this.
for create connection:
private connection getconnection() { drivermanager.registerdriver(new org.hsqldb.jdbcdriver()); connection conn = drivermanager.getconnection("jdbc:hsqldb:hsql://[host]/[db name]", "[username]", "[password]"); return conn; }
how use it:
public void loadsetting(string userid) { connection conn = null; try { //connect it! conn = getconnection(); string query = "select a.* table a"; preparedstatement ps = conn.preparestatement(query); resultset rs = ps.executequery(); while (rs.next()) { //get query result console.writeln(rs.getstring("col1")); console.writeln(rs.getstring("col2")); } } //close connection { if (conn != null && !conn.isclosed()) { conn.close(); conn = null; } } }
hope help.
cheers...
Comments
Post a Comment