Helma logo
helma.org » Home > Stories > getDBConnection()

getDBConnection()

Enables direct access to data sources without using Helma's object model.

The Direct DB interface allows the developer to directly access relational databases defined in the db.properties file without going through the Helma objectmodel layer.

var con = getDBConnection("db_source_name");

This returns a Connection object from the Helma connection pool that can be used as specified by the FESI DbAccess protocol, except that it is not necessary to call the connect() and disconnect() functions.

var rows = con.executeRetrieval("select title from dummy");
while (rows.next())
  res.writeln(rows.getColumnItem("title"));

var deletedRows = con.executeCommand("delete from foobar");
if(deletedRows){
  res.writeln(deletedRows + " rows successfully deleted");
}


... comment


Page last modified on 2003-09-07 00:40 by hns