Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How to Execute sqlserver files in Unix machine

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to execute list of sqlserver(.sql) files in unix machine . Anyone give sample examble
 
Bartender
Posts: 3648
16
Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

MS SQL Server does not run on UNIX/Linux.
 
lowercase baba
Posts: 12870
62
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what EXACTLY do you want to do? i don't know what a "sqlserver(.sql)" file contains. if it is just a bunch of vanilla sql, you might be able to write a shell or perl script to run it, but that assumes you have a database you can connect to...which may or may not be on the local machine.

All these obstacle are surmountable, but we need to know what you are really trying to do.
 
Saloon Keeper
Posts: 22248
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fred, the problem is that every brand of database that I know of comes with a "native client" application. This is a command-line utility (sometimes also a GUI utility) that allows one to runs SQL statements either by typing them in directly or sourcing them as command files.

However, unlike virtually every other DBMS product, SQL Server only runs on the Windows OS, and Microsoft hasn't bothered to make a Unix/Linux native client app for it.

So it's true. You can execute SQL against SQL Server from Unix, but how you do so is up to you, because Microsoft isn't going to help you. You'd have to write your own SQL client app, whether it's using Perl:B, Java JDBC, Python (I presume there's a Python client package, but I don't know), or whatever.
 
Marshal
Posts: 69752
277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Find a tutorial for any database. Download and install a free version of MySQL for example and you should be able to run the SQL on that.

Duplicated in our databases forum.
 
Tim Holloway
Saloon Keeper
Posts: 22248
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Find a tutorial for any database. Download and install a free version of MySQL for example and you should be able to run the SQL on that.

Duplicated in our databases forum.



No you won't. The MySQL client expects to talk to a MySQL server. The target DBMS mentioned is Microsoft SQL Server.

The client programs don't use JDBC. They use internal protocols and mechanisms that are unique to themselves. In fact, SQL Server requires extra configuration to be able to work with JDBC at all.
 
fred rosenberger
lowercase baba
Posts: 12870
62
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if the OP has sqlserver files, i assume there is a sqlserver database somewhere. Why they are on a unix box is another topic...

but could you wrap the in a script and make a call to the windows box running the db? a sort of remote execution call? of course, there is an argument to be made that the file isn't RUNNING on the unix box, but simply being stored/edited there, then handed to the windows box to run.

Again, I'm just trying to make random suggestions in a attempt to help, but until the OP tell us what they really want, this is really all just supposition/a thought experiment.
 
Tim Holloway
Saloon Keeper
Posts: 22248
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't think that there was that much ambiguity. The question was "I want to execure sqlserver files in unix machine".

Obviously the Unix machine isn't going to be able to run SQL Server. There's no such thing as SQL Server for Linux.

On the other hand, many of the other DBMS's allow running SQL scripts via vendor-supplied client utility programs where the script references a database on another machine/OS. MySQL or DB2, for example. Not Microsoft SQL Server, however. SQL Server's client can execute scripts from a remote machine, but only if both client and server machines are running Windows.
    Bookmark Topic Watch Topic
  • New Topic