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 8609319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:51:33+00:00 2026-06-12T03:51:33+00:00

Basically I need to run the following query through jdbc. Both databases are MySQL

  • 0

Basically I need to run the following query through jdbc. Both databases are MySQL and on the same server.

SELECT * FROM DB1.ACCOUNT a
JOIN DB2.ITEM i ON a.AccountID = i.AccountID

My jdbc connection is set up like this:

Class.forName("com.mysql.jdbc.Driver").newInstance();
DB1 = DriverManager.getConnection("jdbc:mysql://serverloc.com:3300/DB1", "username", "password");
DB2 = DriverManager.getConnection("jdbc:mysql://serverloc.com:3300/DB2", "username", "password");

This is where I run into problems. I can now create a statement against DB1 or DB2, but I can’t find a way to JOIN against both databases. I’ve tried running my query against one of the databases (below) but that returns null.

Statement statement = DB1.createStatement();
ResultSet resultSet = statement.executeQuery(" QUERY HERE ");

I’ve seen that you can use UnityJDBC to run JOIN queries across DB’s, but I’m looking for a free/open source option.

Thanks!

  • 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-12T03:51:34+00:00Added an answer on June 12, 2026 at 3:51 am

    1) Yes, you can “join” between two different databases in mySQL.

    2) No, you don’t need two different connections to do it.

    For example:

    • http://www.webhostingtalk.com/showthread.php?t=476982

      p2.upc_code FROM db1.products p1 LEFT OUTER JOIN db2.products p2 ON p1.prod_id=p2.prod_id";

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

Sidebar

Related Questions

I have a need to run multiple WCF services at the same time, from
I'm trying to do the following MySql query and when i go to run
Basically my issue comes down to this, I need to run code on a
I've run in to a problem and need your guidance. Basically i managed to
Basically I need to capture the video from videocamera do some processing on frames
Basically, I need to call a method in my AppDelegate from one of my
Basically I need to translate the following piece of JavaScript into CoffeeScript. location.href =
When I run ant debug from the command line, I get the following error
I have something roughly like the following. Basically I need to access the class
I have the following stored in a rake task. Basically I need it update

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.