[opencms-dev] need SQL connection example

Christoph P. Kukulies kuku at physik.rwth-aachen.de
Fri Feb 29 09:24:46 CET 2008


On Fri, Feb 29, 2008 at 09:03:12AM +0100, Pere Torrodellas wrote:
> 
> ----- Original Message ----- 
> From: "Christoph P. Kukulies" <kuku at physik.rwth-aachen.de>
> To: <opencms-dev at opencms.org>
> Sent: Thursday, February 28, 2008 6:17 PM
> Subject: [opencms-dev] need SQL connection example
> 
> 
> >How would one start with a database application in OpenCms?
> >
> You just have to build your application as an OpenCms module. See the 
> documentation that comes with OpenCms to learn how to create a module.
> OpenCms has its own tables and definitions, and you build your own DB and 
> application.

Creating a module is not my problem. My problem is how I keep the
connection state during the session.
> 
> >How is a database context kept during a session?
> >
> >Would one use a bean?
> >
> You can do the same as  in any other Java application.
> 
> >Which API would one use?
> >
> Plain java.sql.*, unless you decide to use some framework (Ibatis, 
> Hibernate,...)
> 
> >I need a starting point and a bit of code. Advice welcome.


I picked a snippet out of from the archive:
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<sql:setDataSource
    driver="org.gjt.mm.mysql.Driver"
    url="jdbc:mysql://localhost:3306/steuer?autoReconnect=true"
    user="root"
    password="mysqlb3"
    scope="page"
    var="dir" />

Or would I better use java.sql.* and code it in java?
As said, I have no idea at the moment, what happens, when my code is
in a jsp template and the page reloads. How would be the technique to
store the fact that a connection is already made to the database?

I'm not yet familar with that technique despite of oving done some
java examples with a single jdbc request running in a self contained
java application.


> >
> The included documentation provides information and examples.

Also on SQL programming? I saw very little on this also in the 
list archives.

--
Chris Christoph P. U. Kukulies kukulies (at) rwth-aachen.de



More information about the opencms-dev mailing list