db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hicnar_torque_l...@o2.pl
Subject The bookstore example
Date Mon, 09 Feb 2004 17:18:20 GMT
Hi all,

I'm trying to learn Torque, but the more I try, the more frustrated
I get :(. I've started with the bookstore example. Everything was
going smoothly untill I tried to run the example.

I'm getting an exception that starts as follows.

<cut>
[WARN] IDBroker - -IDBroker is being used with db 'bookstore', which
does not support transactions. IDBroker attempts to use transactions
to limit the possibility of duplicate key generation.  Without
transactions, duplicate key generation is possible if multiple JVMs
are used or other means are used to write to the database.
[DEBUG] Transaction - -called safeRollback with null argument
java.sql.SQLException: The url cannot be null
	at java.sql.DriverManager.getConnection(DriverManager.java:489)
	at java.sql.DriverManager.getConnection(DriverManager.java:171)
	at
org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS.getPooledConnection(DriverAdapterCPDS.java:205)
	at
org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS.getPooledConnection(DriverAdapterCPDS.java:175)
	at
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.testCPDS(InstanceKeyDataSource.java:753)
	at
org.apache.commons.dbcp.datasources.SharedPoolDataSource.registerPool(SharedPoolDataSource.java:234)
	at
org.apache.commons.dbcp.datasources.SharedPoolDataSource.getPooledConnectionAndInfo(SharedPoolDataSource.java:203)
	at
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:681)
	at
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:665)
	at
org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:743)
	at org.apache.torque.Torque.getConnection(Torque.java:306)
	at
org.apache.torque.util.Transaction.beginOptional(Transaction.java:118)
	at org.apache.torque.util.Transaction.begin(Transaction.java:100)
	at com.hicnar.db.BasePublisher.save(BasePublisher.java:484)
	at com.hicnar.db.BasePublisher.save(BasePublisher.java:465)
	at com.hicnar.runtime.TestIt.main(TestIt.java:27)
rethrown as org.apache.torque.TorqueException: The url cannot be null
	at
org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:755)
	at org.apache.torque.Torque.getConnection(Torque.java:306)
	at
org.apache.torque.util.Transaction.beginOptional(Transaction.java:118)
	at org.apache.torque.util.Transaction.begin(Transaction.java:100)
	at com.hicnar.db.BasePublisher.save(BasePublisher.java:484)
	at com.hicnar.db.BasePublisher.save(BasePublisher.java:465)
	at com.hicnar.runtime.TestIt.main(TestIt.java:27)
Caused by: java.sql.SQLException: The url cannot be null
	at java.sql.DriverManager.getConnection(DriverManager.java:489)
	at java.sql.DriverManager.getConnection(DriverManager.java:171)
	at
org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS.getPooledConnection(DriverAdapterCPDS.java:205)
	at
org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS.getPooledConnection(DriverAdapterCPDS.java:175)
	at
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.testCPDS(InstanceKeyDataSource.java:753)
	at
org.apache.commons.dbcp.datasources.SharedPoolDataSource.registerPool(SharedPoolDataSource.java:234)
	at
org.apache.commons.dbcp.datasources.SharedPoolDataSource.getPooledConnectionAndInfo(SharedPoolDataSource.java:203)
	at
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:681)
	at
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:665)
	at
org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:743)
	... 6 more

I use PostgreSQL 7.3 on Fedora Core 1. The JDK is 1.4_02.
AFAIK PostgreSQL supports transactions, so what does the line
"[WARN] IDBroker - -IDBroker is being used with db 'bookstore',
which does not support transactions." mean?? Have I misconfigured
anything??

Do you know anybody who succeeded running the example armed only
with the knowledge from
http://db.apache.org/torque/tutorial/index.html ?? 

For instance.. the Torque.properties init lines taken from the
tutorial page should be like these:

log4j.rootCategory = DEBUG, default
log4j.appender.default = org.apache.log4j.FileAppender
log4j.appender.default.file = ./torque.log
log4j.appender.default.layout = org.apache.log4j.SimpleLayout

torque.database.default = bookstore
torque.database.bookstore.driver = org.gjt.mm.mysql.Driver
torque.database.bookstore.url = jdbc:mysql://127.0.0.1/bookstore
torque.database.bookstore.username = user
torque.database.bookstore.password = password

and there's nothing about the params for dsfactory!!??

Fortunately Göschl Siegfried mentioned this in his post at
http://www.mail-archive.com/torque-user@db.apache.org/msg01869.html
helping me to go one step forward.

My "Torque.properties" looks like follows

log4j.rootCategory = DEBUG, default
log4j.appender.default = org.apache.log4j.FileAppender
log4j.appender.default.file = ./torque.log
log4j.appender.default.layout = org.apache.log4j.SimpleLayout

torque.database.default = bookstore

torque.database.bookstore.adapter=postgresql

torque.dsfactory.bookstore.factory=
org.apache.torque.dsfactory.SharedPoolDataSourceFactory
torque.dsfactory.bookstore.pool.defaultMaxConnections=10
torque.dsfactory.bookstore.pool.maxExpiryTime=3600
torque.dsfactory.bookstore.pool.connectionWaitTimeout=10
torque.dsfactory.bookstore.pool.testOnBorrow=true

torque.database.bookstore.driver = org.postgresql.Driver
torque.database.bookstore.url = jdbc:postgresql://127.0.0.1/bookstore
torque.database.bookstore.username = hicnar
torque.database.bookstore.password = mypass

I'll be gratefull for any suggestions that might help me to run the
example.

Chris

PS. In my oppinion such simple examples are intended for folks like
me - who want a quick start in a new tech, but if they're incomplete
or not working... well that's the best way to bias a novice against
even a very interesting piece of tech.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message