Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8122259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:46:45+00:00 2026-06-06T05:46:45+00:00

public static void main(String Data[]) { ConnectionPoolDataSource dps; try { cnt=new InitialContext(); cnt.rebind(java:comp/env/jdbc/pool/dragon, dps);

  • 0
public static void main(String Data[])
{  
        ConnectionPoolDataSource dps;
        try 
        {
            cnt=new InitialContext();
            cnt.rebind("java:comp/env/jdbc/pool/dragon", dps);
        } '
        catch (NamingException ex) 
        {
            Logger.getLogger(Database.class.getName()).log(Level.SEVERE, null, ex);
        }
}

Following is my program to bind a ConnectionPoolDataSource object connect a database in mysql using JNDI.
On compiling it, i’ve got an error:

Exception in thread “main” java.lang.IllegalArgumentException: RegistryContext: object to bind must be Remote, Reference, or Referenceable

Now i’ve got the following doubts:

  1. How can i create a remote object for connecting to mysql database ?
  2. How can i assign the database name…etc…to that remote object ?

the ConnectionPoolDataSource does not provide method for setting server name, database name, etc.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T05:46:47+00:00Added an answer on June 6, 2026 at 5:46 am

    It seems like u r trying to bind it using JNDI naming……

    i suggest you something…
    try c3p0 pooling….which would be easier for u…..
    u can avoid using JNDI naming…..

    read the tutorials from the following link and u can download the jar file…..

    http://www.mchange.com/projects/c3p0/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class Main { public static void main(String[] args){ Class2 class2Object = new Class2();
public class Loopname{ public static void main (String [] args){ String files []= new
public static void main(String[] args) throws IOException { String st3[]=new String[]{сто, двести, триста, sdf,
public static void main(String[] args) throws IOException, URISyntaxException,TransformerException { TransformerFactory factory = TransformerFactory.newInstance(); String
public class b { public static void main(String[] args) { byte b = 1;
public class Sample { public static void main(String[] args) { int year = 2012;
public class I { public static void main(String args[]) { int i=0,j=1,k=2; i=i++ -
Example: public class TestClass { public static void main(String[] args) { TestClass t =
Suppose public class Program { public static void Main(string[] args) { Program p =
Here is my code : public static void main(String[] args) { // System.setProperty( //

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.