datasource:

        <data-source
                class="com.evermind.sql.ConnectionDataSource"
                name="Sybase"
                location="jdbc/SybaseCoreDS"
                xa-location="jdbc/xa/SybaseXADS"
                ejb-location="jdbc/SybaseDS"
                pooled-location="jdbc/SybasePDS"
                connection-driver="com.sybase.jdbc2.jdbc.SybDriver"
                schema="c:\orion\config\database-schemas\sybase.xml"
                username="username"
                password="password"
                url="jdbc:sybase:Tds:Host:Port/Database"
                min-connections="5"
                max-connections="10"
                max-connect-attempts="2"
                inactivity-timeout="30"
                wait-timeout="0"
                connection-retry-interval="3" />

sample of use:

java.sql.Connection conn=null;
try {
        javax.naming.Context ic = new javax.naming.InitialContext();

        javax.sql.DataSource ds = (javax.sql.DataSource)
ic.lookup("java:comp/env/jdbc/SybasePDS");

        //acquire conn
        if (conn==null) conn = ds.getConnection();

        ...
        //use connection
        ...
} catch (Exception e) {
//handle error
...
} finally {
        //close conn
        if (conn!=null) conn.close();
        conn = null;
}

The try-catch-finally is there to ensure errors don't leave connections
hanging loose(they would not be returned to the pool, but finally fail due
to timeout)

HTH

JP


> -----Original Message-----
> From: Boris Erukhimov [mailto:[EMAIL PROTECTED]]
> Sent: Miércoles, 04 de Julio de 2001 3:51
> To: Orion-Interest
> Subject: Data source for Sybase with Jconnect 5.2
> 
> 
> I'm trying to ask it second time.
> 
> Does anyone use Jconnect 5.2 ?
> If so could you please share your data-source.xml and access code.
> I'm particularly interested to see how "pooled-location" works, not
> "ejb-location".
> 
> Thanks
> ~boris
> 

Reply via email to