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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:19:26+00:00 2026-05-31T08:19:26+00:00

i have an sql file of the following form: CREATE VIEW dbo.SomeView AS select

  • 0

i have an sql file of the following form:

CREATE VIEW dbo.SomeView
AS select * from SomeTable
GO

ALTER TABLE [SomeTable] ADD CONSTRAINT [...] PRIMARY KEY CLUSTERED ([..],[TIME_STAMP],[..])
GO

and so on.. it contains only update queries.
i want to run it on an sql server that is situated on a remote machine. I’m using java and i read it is not possible to execute a file through jdbc.
i read this related post:
How to execute sql-script file in java?

my question is, how can i execute that file if the server is on a remote machine and not on my machine (i don’t have mssql server installed on my machine)?

P.S it would be nice to know if there is a solution to this problem in other languages (just a reference will do)

EDIT: the file is on the local machine.

thank ppl!

  • 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-31T08:19:27+00:00Added an answer on May 31, 2026 at 8:19 am

    Do you have developer access to the remote machine? I.e., can you open ports?
    You can use a simple socket and a remote shell to execute the queries (both sides can be Java but anything else will do).

    If you have no administrative privileges, you might use some SSH API to login and execute a script.

    If you have installed the SQL tools on your machine, you can still run them on the remote (if it is enabled and there are no firewall restrictions, for instance, but some additional configuration might be necessary). With MySQL, you may use something like this:

     mysql -u dbuser –h remote.host.name –p < script.sql
    

    You can even do this from Java with the script you linked.

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

Sidebar

Related Questions

Have a Sql Script file name spCreation.sql with the following contents. CREATE PROCEDURE dbo.usp_select_customers
I have the following error when trying to import .sql file into MYSQL from
I have the following query in iSeries SQL which I output to a file.
I have a .sql file from a MySQL dump containing tables, definitions and data
I have sql server 2008 db table FILE_DETAILS in following format. ID FileName Filesize_in_MB
I have an SQL Express file with a single table People. People has six
I have following HTML table: <form method=post action=update-table.php> <table class=table-data style=width: 960px;> <thead> <tr>
I have a 400MB *.sql file which is a dump from a MySQL database.
I have a sql file generated by mysqldump --all-databases . There are many databases
I have a SQL dump file consisting of incorrectly stored Cyrillic Russian ( WINDOWS-1251

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.