One way to setup your connection (if your running within a webapp
context) is with a JNDI datasource. This can be setup using whatever
pooled connections etc are available for your app server and just let
ojb receive connections from this system. 

For example, I'm running Macromedia JRun with MS SQL server.
The jrun configuration interface lets me setup a pooled datasource. I
then set ojb to use this with the following entry in
repository_database.xml:

<!-- Datasource example -->
    <jdbc-connection-descriptor
        jcd-alias="default"
        default-connection="true"
                platform="mssql"
                jdbc-level="2.0"
                jndi-datasource-name="yourName"
                username="yourUser"
                password="yourPassword"
                eager-release="false"
        batch-mode="false"
        useAutoCommit="0"
        ignoreAutoCommitExceptions="false"
   >
        <sequence-manager
 
className="org.apache.ojb.broker.util.sequence.SequenceManagerMSSQLGuidI
mpl "
        />


   </jdbc-connection-descriptor>  
 
With  this setup I believe it's the appserver (jrun) that's handling
maintaining the database connection. 


Details on tomcat datasources can be found here:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples
-howto.html


hope this helps...

 
-----Original Message-----
From: Hinnerk Feldwisch [mailto:[EMAIL PROTECTED] 
Sent: 12 February 2004 12:38
To: [EMAIL PROTECTED]
Subject: Problem with database connection

Hello altogether,

I developed a jsp/struts/ojb- project which runs fine on my private
server;
but after approximately two days the database connection fails on the
real
server where the website shall be accessible.
At the end I will post the error- message.

For me the problem seams to be that there's some connection error on the
server (I don't know why), and OJB doesn't try to establish a new JDBC-
Connection; is this right? Is there any way to do so?

All other projects on this internet server do run fine - but they don't
use
OJB.

Would be glad for any hint!,
thanks,
Hinnerk

-------
javax.servlet.jsp.JspException: Exception accessing property
latestNews[0].daughtersSize
for bean messageManager:
org.apache.ojb.broker.PersistenceBrokerSQLException:
Communication link failure: java.net.SocketException
at
org.apache.struts.taglib.logic.CompareTagBase.condition(CompareTagBase.j
ava:233)
at org.apache.struts.taglib.logic.EqualTag.condition(EqualTag.java:90)
at
org.apache.struts.taglib.logic.ConditionalTagBase.doStartTag(Conditional
TagBase.java:218)
at
org.apache.struts.taglib.nested.logic.NestedEqualTag.doStartTag(NestedEq
ualTag.java:96)
at
_WEB_22dINF._jsp._viewshortnews__jsp._jspService(/WEB-INF/jsp/viewshortn
ews.jsp:38)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.subservice(Page.java:485)
(...)


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to