Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Sybase > How to get the ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 2434 of 2504
Post > Topic >>

How to get the DB URL string using Sybase JNDI/LDAP?

by Snootus.Maximus@[EMAIL PROTECTED] Apr 1, 2008 at 07:49 PM

I'm new to Sybase/JConnect, and would appreciate some help.
I'm sure what I want to do is very simple, though I can't seem to get
my mind around it.

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
 




 1 Posts in Topic:
How to get the DB URL string using Sybase JNDI/LDAP?
Snootus.Maximus@[EMAIL PR  2008-04-01 19:49:44 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 6 0:33:51 CDT 2008.