cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <ba...@webslingerZ.com>
Subject Re: SQL-Null-Pointer-Exception!!!!!!!!!
Date Thu, 01 Jun 2000 16:21:32 GMT
On Thu, 1 Jun 2000, Michele Bianchi wrote:

>    <sql:execute-query>
>     <eguru:db/>
>     <sql:row-element>property</sql:row-element>
>       
>     <sql:query>SELECT  prop_desc.name,prop_desc.weight,prop_desc.id,prop_group.name
FROM prop_desc,prop_group WHERE  prop_desc.id!=0 AND prop_desc.grp=prop_group.id ORDER BY
prop_desc.name</sql:query>
>    </sql:execute-query>
> 
> where <eguru:db/> is:
> 
>  <xsl:template match="eguru:db">
>   <sql:driver>postgresql.Driver</sql:driver>
>   <sql:dburl>jdbc:postgresql://localhost/eguru</sql:dburl>
>   <sql:username>mic</sql:username>
>   <sql:password></sql:password>
>  </xsl:template>
> 
> that helps me to have a more compact and easy to change definition of db.  and
> e.g. for java code i use the tag <eguru:db-raw>:
> 
>  <xsl:template match="eguru:db-raw">
>   Class.forName ("postgresql.Driver");
>   Connection db = DriverManager.getConnection ("jdbc:postgresql://localhost/eguru", "mic",
"");
>  </xsl:template>

FYI, I use this technique extensively. Instead of saying something like
this:

<sql:execute-query>
 ... blah blah driver etc blah ...
 <sql:query>select id,name from employee_table</sql:query>
</sql:execute-query>

i say something like this:

<employees:list/>

and use XSLT to transform the simple, literate tags into the nitty gritty
sql. it's obviously much more useful with more complex queries with
parameters and such, but you get the gist.

- donald


Mime
View raw message