setCatalog to more than one database

Posted on 2006-04-06
Last Modified: 2008-01-09
Is there any way to load more than one database into a Connection?

setCatalog seems to only allow one database to be loaded at a time.

Question by:jerelw
    LVL 2

    Accepted Solution

    Each connection to a database in MySQL is an independent entity represented as a resource link. You can obviously connect to multiple databases, however each connection can only be to one database.

    I assume you are referring to the JDBC method setCatalog. I'm not really familiar with JDBC, but after some quick googling, it seems that the Connection object itself can only reference one database. I assume that--as in most db api's--connecting to another database would require instantiating another Connection object.

    More detail (or possible correction) is going to have to come from a true JDBC expert. =)

    Hope this helps,

    LVL 3

    Author Comment

    Thank you.

    I'm looking for something similar to SYSTEM naming on the AS/400, where libraries can be assigned to each user based on the user id and can be accessed without the db_name. prefix.

    Is SYSTEM naming unique to IBM?

    LVL 3

    Author Comment

    Is there anything similar to SYSTEM naming for MySQL?
    LVL 2

    Expert Comment

    Unfortunately, I'm aware of no such functionality in MySQL. All my experience suggests that a connection must be explicitly made for each database involved.

    Sorry. =)


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
    Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL ( several years ago, it seemed like now was a good time to updat…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now