Hi.
My code is:
import java.util.*;
import java.sql.*;
import javax.sql.*;
import javax.naming.*;

public class JDBCConnect {



    public JDBCConnect(){
    }

    static {


     new  sun.jdbc.odbc.JdbcOdbcDriver();
    }

    public  Connection  getConnectionForEJB() throws
NamingException,SQLException{
        // Get the JNDI context
       Context context = new InitialContext();

       // Lookup the datasource
       DataSource ds = (DataSource) context.lookup("java:comp/env/jdbc/" +
"SQLPool");

       // Get the connection from the datasource
       Connection  con = ds.getConnection();
     //System.out.println("Connection    == "+con);
     return con;
    }

SQLPool is my DSN. It is working fine.
regards,

Uday Kumar Bhatt
System Engineer
Acefusion.Com
750 A TechnoPark Chai Chee
Singapore.
-------------------------------------------------------------------------------------

The First Priciple: Truth Can't be said, if said it becomes false.:-OSHO
AE  said: Nature has intelligence of such superiority that human
intelligence becomes utterly insignificant before it.

------------------------------------------------------------------------------
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the 
body.

Reply via email to