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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:33:55+00:00 2026-05-27T00:33:55+00:00

How would I execute a sql script on a remote db2 server? In MySQL

  • 0

How would I execute a sql script on a remote db2 server?

In MySQL I would have done something like this:

mysql -uroot -proot -h localhost < resources/db_scripts/drop_mysql.sql >> logs/drop_my.log

I would also like to do the same for MSSQL and Sybase.

  • 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-05-27T00:33:56+00:00Added an answer on May 27, 2026 at 12:33 am

    You can do that type of operation in DB2 with the “Data Server client” (it had other names in previous DB2 versions, for example “DB2 Administration client”). This application has a set of tools that permit you to control a local or remote database. The most appropriated tool for your case is called the “Command Window”.

    In order to start working with remote database via the Command Window, you have to “see” the remote databases, and for this, you catalog a remote machine (catalog admin node), a remote instance (catalog node) and then the database (catalog database). It looks complicated, and to prevent this problem, there is a graphical tool called the DB2 Configure assistant (db2ca) that permits you to configure the DB2 environment.

    db2 catalog admin tcpip node NODENAME remote SERVERNAME SYSTEM SERVERNAME
    db2 catalog tcpip node INSTNAME remote SERVERNAME server PORTNUM remote_instance INSTANCE system SERVERNAME;
    db2 catalog database DBNAME as ALIAS at node INSTNAME
    

    Once you have catalog your remote database, you can do

    db2 -tvf resources/db_scripts/drop_mysql.sql -z logs/drop_my.log
    

    As part of your script file, you should have the connection statement (db2 connect to ALIAS user USERNAME using PASSWORD) or you have to establish the connection before call the execution of the script file.

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

Sidebar

Related Questions

I have this sql script that I would like to execute in a java
I execute SQL scripts to change the database schema. It looks something like this:
I have a script in T-SQL that goes like this: create table TableName (...)
I would like to store lengthy .sql scripts in my solution and execute them
I would like to execute an OS command from my ruby script but I
Do I have to parse the SQL-script manually and execute each statement separately or
I have many table creation scripts (sql files), which I would like to run,
I would like to ask couple of questions regarding SQL Server Locking mechanism If
Possible Duplicate: How to execute an .SQL script file using c# How would I
I would like to write the following SQL in HQL so it executes as

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.