Try this if you setup datasource in JMC.

InitialContext c = new InitialContext();
DataSource ds = (DataSource)c.lookup("java:comp/env/jdbc/mySource");
Connection con = ds.getConnection();

ResourceManager is an proprietary way of getting Connections from
datasources specified for EJBs.

--
Clement Wong
JRun Engineer
< a l l a i r e >


-----Original Message-----
From: Klebanov, Gregory [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 12, 2001 7:38 AM
To: JRun-Talk
Subject: RE: Connection Pooling Problem in jRun 3.0 Enterprise Edition


Hey,

Have you had any luck to to resolve this error? I'm having the same problem
and can't figure out what I'm doing wrong.

Thanks,

Greg Klebanov

-----Original Message-----
From: amit_rana [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 09, 2001 9:54 PM
To: JRun-Talk
Subject: Connection Pooling Problem in jRun 3.0 Enterprise Edition


Hi!!,
        I am unable to access the JDBC Data Source that i created using JMC.
my default server's local.properties has following lines for the data source
(These lines were added after creating the DataSource).
----local.properties-----
jdbc.mySource.display-name=mySource
jdbc.mySource.driver=sun.jdbc.odbc.JdbcOdbcDriver
jdbc.mySource.url=jdbc:odbc:MyDsn
jdbc.mySource.description=
jdbc.mySource.pooling=true
jdbc.mySource.timeout=
jdbc.mySource.interval=
jdbc.mySource.param.user=
jdbc.mySource.param.password=

The test for this Data Source is successfull. ( through test button in JDBC
Data Source in JMC )

I am accessing this data source in a servlet using the following code...

1.      Connection con =
ResourceManager.getConnection("java:comp/env/jdbc/mySource"); //i even tried
with mySource only

i also tried accessing it using JNDI

2.      Properties h = new Properties();
        h.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"allaire.ejipt.ContextFactory");
        h.setProperty(Context.PROVIDER_URL, "ejipt://localhost:2323");

        Context context = new InitialContext(h);
        DataSource source =
(DataSource)context.lookup("java:comp/env/jdbc/mySource"); //i even tried
with mySource only
        Connection con = source.getConnection();

In case 1., the function runs successfully but using connection gives a
NullPointerException.
In case 2., it gives java.Naming.NameNotFound Exception.
Kindly Help.

Thanks and Regards,
Amit Rana.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to