Hy!
 
I would like to know  if it is an obligation to use ESQL and the connection pool provided by Cocoon2 to connect to a database.
By example, isn't it possible just to write the following code, by which a simply connection should be executed with the 'logs' database?
I've tried it and it doesn't work but I don't know if there's an error on the code or if anyway, it could never run.
Some of you can help me, please?
Thanks in advance,
Cyril.
 
<?xml version="1.0" encoding="iso-8859-1"?>
<xsp:page language="java"
          xmlns:xsp="http://apache.org/xsp">
 
<xsp:structure>
<xsp:include>java.sql*</xsp:include>
</xsp:structure>
 
<Promotion auteur="Jules">
 
<xsp:logic>
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:localhost:8080/c:\Mes_documents\JAVA\JDBC\logs");
Statement stmt = conn.createStatement();
ResultSet resultat = stmt.executeQuery("select * from visit where userid='cyril'");
</xsp:logic>
 
<Description>Nous proposons une réduction de 25%, restreinte à la période de Septembre 20001 à OCtobre 20001</Description>
 
<row>
<userid><xsp:expr>resultat.getString (1)</xsp:expr></userid>
<sessionid><xsp:expr>resultat.getString (2)</xsp:expr></sessionid>
<visitdate><xsp:expr>resultat.getString (3)</xsp:expr></visitdate>
<referrer><xsp:expr>resultat.getString (4)</xsp:expr></referrer>
<page><xsp:expr>resultat.getString (5)</xsp:expr></page>
</row>
 
</Promotion>
</xsp:page>

Reply via email to