-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 
Author Message
 Post subject: Cacho Resin JNDI & Hibernate
PostPosted: Thu Oct 02, 2003 2:44 am 
Newbie

Joined: Thu Sep 25, 2003 12:45 am
Posts: 14
Location: Hannover, Germany
Hi there,

i would like to use hibernate within my caucho resin connection pool. I
have defined the resin connection pool inside web.xml as following:

<!-- external static data which is needed by the application -->
<resource-ref>
<res-ref-name>jdbc/mpdb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<init-param driver-name="com.caucho.jdbc.mysql.Driver"/>
<init-param url="jdbc:mysql-caucho://127.0.0.1:3306/mpdb"/>
<init-param user="root"/>
<init-param password="xxxxxx"/>
<init-param max-connections="30"/>
<init-param max-idle-time="30"/>
</resource-ref>

and inside hibernate.properties with:

hibernate.connection.datasource java:comp/env/jdbc/mydb
hibernate.connection.username root
hibernate.connection.password xxxxxx


But it seems not to work. I allways get the message during hibernate
initialization that hibernate can't find the resource. Has anyone experience
with this topic or can provide me an example configuration for that topic?

net.sf.hibernate.HibernateException:
Could not find datasource: java:comp/env/jdbc/mydb

Thanky you for any help,

Andreas Bednarz

_________________
:-)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 02, 2003 3:43 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Try to configure Datasource in "resin.conf" file


Top
 Profile  
 
 Post subject: resin.conf
PostPosted: Thu Oct 02, 2003 5:52 am 
Newbie

Joined: Thu Sep 25, 2003 12:45 am
Posts: 14
Location: Hannover, Germany
Do you mean that configuring the JNDI name would be better inside resin.conf instead of web.xml?

_________________
:-)


Top
 Profile  
 
 Post subject: Caucho Resin JNDI still not working
PostPosted: Thu Oct 02, 2003 6:15 am 
Newbie

Joined: Thu Sep 25, 2003 12:45 am
Posts: 14
Location: Hannover, Germany
Hi,

I now tested to put the JNDI configuration to the resin.conf ... but hibernate still can not find it:

javax.naming.NameNotFoundException: jdbc/mpdb

Is it possible to use Resins connection pool inside hibernate? Any help is welcome.

Andreas Bednarz

_________________
:-)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 02, 2003 8:42 am 
Senior
Senior

Joined: Wed Aug 27, 2003 6:04 am
Posts: 161
Location: Linz, Austria
It's definitely possible, like with any other JNDI DataSource: You just need to get the JNDI registration right. As this isn't a Hibernate issue, try to look up the JNDI DataSource in your own application code like as follows and see if it works:

Code:
InitialContext ic = new InitialContext();
ic.lookup("java:comp/env/jdbc/mpdb");


If you manage to look it up in such a manual way, then Hibernate will work too.

Juergen


Top
 Profile  
 
 Post subject: Perfect
PostPosted: Thu Oct 02, 2003 8:54 am 
Newbie

Joined: Thu Sep 25, 2003 12:45 am
Posts: 14
Location: Hannover, Germany
Hurray,

it works perfectly. I've just changed my application and it now works the way I need. :-)

Thanky you very much,

Andreas Bednarz

_________________
:-)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 19, 2003 12:50 pm 
Regular
Regular

Joined: Sat Oct 18, 2003 11:53 am
Posts: 55
Can I ask how you fixed this, as I am going to switch to Resin's pool soon?


Top
 Profile  
 
 Post subject: Connection to resins Pool or proxool
PostPosted: Wed Nov 19, 2003 1:13 pm 
Newbie

Joined: Thu Sep 25, 2003 12:45 am
Posts: 14
Location: Hannover, Germany
Hi there,

I tried to use both ways (resin pool & proxool) and decided to finally use proxool, because it is more flexible and also usuable from my non servlet applications. We have over 4.000.000 sql requests a day and everything works fine even if we restart mysql.

My configuration hibernate.properties with mysql and automatic reconnection:


!! Important is the relaxAutoCommit=true for mysql

##############################
### MYSQL Config for 4x or 3x servers ###
##############################
hibernate.dialect net.sf.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.connection.url jdbc:mysql://127.0.0.1:3306/mpdb?relaxAutoCommit=true
hibernate.connection.username root
hibernate.connection.password ad12376
....
##############################
### Proxool Connection Pool###
##############################
## Properties for external configuration of Proxool
hibernate.proxool.house-keeping-sleep-time 30000
hibernate.proxool.house-keeping-test-sql select password("hallotest");
hibernate.proxool.maximum-connection-count 20
hibernate.proxool.maximum-connection-lifetime 4
hibernate.proxool.simultaneous-build-throttle 2
hibernate.proxool.maximum-active-time 500
hibernate.proxool.minimum-connection-count 4
hibernate.proxool.prototype-count 1
hibernate.proxool.statistics 1m,15m,1d

Andreas Bednarz
bednarz@id-on.de
http://www.id-on.de/noflash/index.html

_________________
:-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.