You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by kidong <Ki...@public.uni-hamburg.de> on 2001/04/16 18:35:33 UTC

mysql db connection null!

hello,

i think, it is a basical problem with connecting db, mysql.
here is my code to implement criteria like "order by" sql:

Criteria crit = new Criteria();
crit.add( BaseIssuePeer.KS, data.getParameters().getInt("product") );
Vector v = BaseIssuePeer.doSelect( crit );

exception is thrown: db connection null!

when the code is changed like follows:

Criteria crit = new Criteria();
crit.add( BaseIssuePeer.KS, data.getParameters().getInt("product") );
Vector v = BaseIssuePeer.doSelect( crit, GetDBConnection.getDBConnection() );

and then turbine know which db connection is. it is ok.
But the following code brings it to error.

Criteria crit = new Criteria();
crit.add( BaseIssuePeer.KS, data.getParameters().getInt("product") );
crit.addOrderByColumn( IssuePeer.REPORTEDBY );
Vector v = BaseIssuePeer.doSelect( crit, GetDBConnection.getDBConnection() );

i got such a exception like this:

java.lang.NullPointerException

at org.apache.turbine.om.peer.BasePeer.createQueryString(BasePeer.java:1004)

at org.apache.turbine.om.peer.BasePeer.doSelect(BasePeer.java:1114)

at org.apache.turbine.BaseIssuePeer.doSelectVillageRecords(BaseIssuePeer.java:243)

at org.apache.turbine.BaseIssuePeer.doSelect(BaseIssuePeer.java:204)

I think, i have configured default db setting in TurbineResources.properties file correctly as follows:

database.default.driver=org.gjt.mm.mysql.Driver
database.default.url=jdbc:mysql://127.0.0.1/bugtracker?user=root
database.default.username=root
database.default.password=

database.adaptor=DBMM
database.adaptor.DBMM=org.gjt.mm.mysql.Driver

...

does somebody have idea about how to configure mysql db setting ?

thanks, kidong






Re: mysql db connection null!

Posted by Jason van Zyl <jv...@apache.org>.
> kidong wrote:
> 
> hello,
> 
> i think, it is a basical problem with connecting db, mysql.
> here is my code to implement criteria like "order by" sql:
> 

If I could read your email maybe I could help. Stop sending HTML
email. 

-- 
jvz.

Jason van Zyl
jvanzyl@apache.org

http://jakarta.apache.org/velocity
http://jakarta.apache.org/turbine
http://tambora.zenplex.org

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


Re: mysql db connection null!

Posted by Jon Stevens <jo...@latchkey.com>.
Turn off HTML email!

on 4/16/01 9:35 AM, "kidong" <Ki...@public.uni-hamburg.de> wrote:

> Criteria crit = new Criteria();
> crit.add( BaseIssuePeer.KS, data.getParameters().getInt("product") );
> Vector v = BaseIssuePeer.doSelect( crit, GetDBConnection.getDBConnection() );
> 
> and then turbine know which db connection is. it is ok.
> But the following code brings it to error.
> 
> Criteria crit = new Criteria();
> crit.add( BaseIssuePeer.KS, data.getParameters().getInt("product") );
> crit.addOrderByColumn( IssuePeer.REPORTEDBY );
> Vector v = BaseIssuePeer.doSelect( crit, GetDBConnection.getDBConnection() );

You should never reference the Base* classes directly. Always refer to the
generated container classes.

You also don't mention if the TurbineConfig class is being properly called
in order to define the location to your TR.props file.

-jon


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