I need to write Java code to dynamically (at run time), look up the
complete URL string of a DB using Sybase JNDI/LDAP. Here's what I have
so far:
SybDataSource dataSource = new SybDataSource() ;
Properties props = new Properties();
props.put(Context.OBJECT_FACTORIES,
"com.sybase.jdbc2.jdbc.SybObjectFactory");
props.put(Context.PROVIDER_URL, "ldap://
sybaseldap.usa.company.net:4897/dc=sybase,dc=company,dc=com");
props.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
try
{
Context ctx = new InitialContext(props);
dataSource = (SybDataSource)
ctx.lookup("sybaseServername=SERVERNAME");
}
catch (Exception e)
{
return;
}
System.out.print("DataSource reference obtained.\n");
Question is, now what? From this, how do I get the complete URL of the
DB? I need the DB URL to pass to another Java program that's making
the JDBC connection.
Apologies for the dumb question.
TIA.
-sm