Check a few things: 1. If this code lies inside a servlet, there should be a corresponding <env-entry> in the web.xml 2. If this code lies inside a ejb, there should be a corresponding <env-entry> in the ejb-jar.xml 3. If this code lies on a stand alone client, it should not be using "java:comp/env" at all 4. Check if the datasource is bound to the jndi tree in the first place.
Regards sanjeev -----Original Message----- From: JavaSoft [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 12:51 PM To: [EMAIL PROTECTED] Subject: Database Connection Problem Hi guys I have a problem connecting to database using datasource. I am trying to make simple application ( with j2se ). The program only list a table when i run it. Thats all. This is the method to create connection. private void makeConnection() { try { InitialContext ic = new InitialContext(); System.out.println("LOOKUP"); DataSource ds = (DataSource) ic.lookup( "java:comp/env/jdbc/corePool" ); System.out.println("DSS " + ds); Connection con = ds.getConnection(); } catch(Exception e) {} } There's no error .. but DataSource object is null. This simple program running together with SUN j2EE server in my local computer. Is there any setting that i should do ? === thx, a Java Addicted =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help". =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
