Re: DBRepository problems

Florin PATRASCU <[email protected]> Sun, 15 Feb 2004 22:39:19 -0400
Newsgroups gmane.comp.java.jpublish.devel
Message-ID <6.0.1.1.2.20040215214714.020544b0@POP>
Hi Juan,

Please be sure the path to your hsqldb is correct. In my example below,=20
everything works smooth. Let us know if the example below was helpful.=20
Cheers - Florin

a. I am creating a sample HSQLD table and I am populating it with some data:

drop table CONTENIDO
create table contenido(
         path varchar(255) primary key,
         data longvarchar(1000) not null,
         LAST_MODIFIED BIGINT
)
select * from CONTENIDO
INSERT INTO CONTENIDO(path,data,last_modified) VALUES('/index.html',=20
'SALUD!', 2004)


b. On my Windows environment,  in jpublish.xml I have:
        <repository name=3D"db_repository"=20
classname=3D"org.jpublish.repository.db.DBRepository">
             <driver>org.hsqldb.jdbcDriver</driver>
            =
 <url>jdbc:hsqldb:E:\jboss\server\default\data\hypersonic\jpublish</url>
             <username>sa</username>
             <password></password>
             <content-query>select data from contenido where path =3D=20
?</content-query>
             <last-modified-query>select last_modified from contenido where=
=20
path =3D ?</last-modified-query>
             <paths-query>select * from contenido where path like=20
?</paths-query>
         </repository>

c. starting up JBOSS (I know you have TOMCAT, but it should work at your=20
side as well:)
and after calling: http://localhost/jpdb/index.html

I see:
SALUD!

...

QED :)
As I've said, let us now if you need more help!

-Florin



At 15/02/2004 20:26, you wrote:
>Hello..
>I'm trying to run the jpublish-example with the
>content stored in a HSQLDB database, but I receive
>this message (in the browser) when I try to read the
>page: "Error: null".
>It seems there isn't a problem with the SQL statement.
>I think it's a problem with the connection, because I
>can't see any signal from the org.hsqldb.Server when I
>do the $db_repository.get($page.Path) from the
>template. I've the hsqldb.jar in the /lib directory.
>
>This is my db configuration in the jpublish.xml
>(similar to the jpublish-example)
>
><repository name=3D"db_repository"
>classname=3D"org.jpublish.repository.db.DBRepository">
>             <driver>org.hsqldb.jdbcDriver</driver>
>             <url>jdbc:hsqldb:hsql://localhost:9001</url>
>             <username>sa</username>
>             <password></password>
>             <content-query>select body from contenido where
>path =3D ?</content-query>
>             <last-modified-query>select last_modified from
>contenido where path =3D ?</last-modified-query>
>             <paths-query>select * from contenido where path
>like ?</paths-query>
>         </repository>
>
>
>The table in my database is "contenido" and has the
>same attributes I've seen in the jpublish-example...
>The server is running ok, because I've connected to it
>from the hsqldb DatabaseManager...
>=BFWhat I'm doing wrong?
>
>Please apologize me if it's a basic question, but I
>need some help.
>
>Thanks a lot...
>
>           Juan Pablo
>
>PD: I'm using JPublish 2.0, Tomcat 4.1.24 and HSQLDB 1.7
>
>------------
>Los mejores usados y las m=E1s tentadoras
>ofertas de 0km est=E1n en Yahoo! Autos.
>Compr=E1 o vend=E9 tu auto en
>http://autos.yahoo.com.ar
>
>
>-------------------------------------------------------
>SF.Net is sponsored by: Speed Start Your Linux Apps Now.
>Build and deploy apps & Web services for Linux with
>a free DVD software kit from IBM. Click Now!
>http://ads.osdn.com/?ad_id=3D1356&alloc_id=3D3438&op=3Dclick
>_______________________________________________
>Jpublish-developer mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/jpublish-developer




-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click