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

  • SEARCH
  • Home
  • 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 8020449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:41:45+00:00 2026-06-04T21:41:45+00:00

I need to connect 2 tables from 2 different servers. How can I do

  • 0

I need to connect 2 tables from 2 different servers.

How can I do that in C#?

This is what I have so far:

cmd = new MySqlCommand(String.Format("INSERT INTO {0} (a,b,c,d) SELECT (a,b,c,d) FROM {1}", ConfigSettings.ReadSetting("main_table"), ConfigSettings.ReadSetting("main_table")), con);

ConfigSettings.ReadSetting("main_table") for both of them is the same.

 con.ConnectionString = ConfigurationManager.ConnectionStrings["con1"].ConnectionString;
 con2.ConnectionString = ConfigurationManager.ConnectionStrings["con2"].ConnectionString

How to make this cmd to be workking with 2 different connection strings and with the same name for the table. Table name will change that’s why it is saved in config.

  • 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-04T21:41:48+00:00Added an answer on June 4, 2026 at 9:41 pm

    MySQL cannot dynamically link servers.

    If you want a direct copy between the databases, you would need to create a FEDERATED table on the target server which would point to the source server, and just issue this command:

    INSERT
    INTO    main_table (a, b, c, d)
    SELECT  a, b, c, d
    FROM    federated_main_table
    

    on the target server.

    If you have multiple source servers and / or tables, you should create a federated table for each of them.

    The other option would be selecting all data from the source server onto the client (into an array, persistent recordset etc.), then insert data cached on the client into the table on the target server.

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

Sidebar

Related Questions

I have a database that I need to connect to and select from. I
Hi I have two tables (users & friends) I need to connect to the
I need data from 3 different tables: Catergory table Scoretable 1 Scoretable 2 What
I need to connect to another web application using webservice. That web application uses
I need to connect Apache Axis 1.4 to a Webservice that uses NTLM authentication
I need to connect to a MongoDB instance from my EJB3 application, running on
i need to connect to another server we manage and have it's results (in
I need to connect two tables in SQL Server: Table A has a primary
I have 2 tables containing information that I want to search for, a main
Here's the situation: we have an Oracle database we need to connect to to

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.