[jboss-user] [JNDI/Naming/Network] - Datasource is null

badam571 do-not-reply at jboss.com
Tue Aug 5 10:48:47 EDT 2008


Hi there, I have the following problem, I am trying to connect to database via Jndi but I get datasource is null, here is my codes:
try {
ic = new InitialContext();
ds = (DataSource)ic.lookup("java:/SybaseDS");
conn = ds.getConnection();
				
}
catch(NamingException ne)
{
 logger.debug("Naming Exception thrown: " +ne.getMessage());
}
catch(Exception e){
logger.error("Other connection Exception thrown: " +e.getMessage());
  }
return conn;
}

the jndi name on sybase-ds.xml is (I am using Sybase)

<local-tx-datasource>
    <jndi-name>SybaseDS</jndi-name>

the database url:
<connection-url>jdbc:sybase:Tds:wi3db1.caci.com:5000/SQ3XX</connection-url>
   <driver-class>com.sybase.jdbc2.jdbc.SybDataSource</driver-class>

and the mapping is:

         <type-mapping>Sybase</type-mapping>
      


other config files uses java:/SybaseDS as data-source name
here jbobssjaws.xml:

   java:/SybaseDS
   <type-mapping>Sybase</type-mapping>
   false

here is standardjbosscmp-jdbc.xml:

      java:/SybaseDS
-------------------------------------

is there anything I making wrong

Best Regards




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4168780#4168780

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4168780



More information about the jboss-user mailing list