wood burning stoves 2.0*
The moose likes Linux / UNIX and the fly likes Execute SQL scripts in Unix Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Execute SQL scripts in Unix" Watch "Execute SQL scripts in Unix" New topic

Execute SQL scripts in Unix

Abhishek Kanchan
Ranch Hand

Joined: May 10, 2007
Posts: 32

I have a requirement in my project where I am supposed to execute SQL scripts on Unix server and the SQL server is hosted on a different windows M/C. We are looking for a suitable bridge / driver that can be installed on Unix so that the scripts can be executed.
Also, Is it possible to install the SQL client on Unix server ?


SCJP 1.5<br />SCWCD 5.0
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

I guess you need to give more details. Do you want a unix user to type SQL commands into a command prompt or something more? What do you want to happen after the scripts are executed? Is it good enough to have them output to the screen?
And then I think the steps would be different for each database vendor. What are you using? SQL Server? Check this out: http://stackoverflow.com/questions/149395/what-are-some-ways-of-accessing-microsoft-sql-server-from-linux

Abhishek Kanchan
Ranch Hand

Joined: May 10, 2007
Posts: 32
Thanks Tim for you reply.

Yes, we just want to fetch data through SQL queries and the output on the screen is fine.

Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

Are you planning to use Java for this ?

What kind of database do you want to connect to?
Peter Johnson

Joined: May 14, 2008
Posts: 5812

You still did not say what database you are using. When you type "SQL server", do you mean the product called Microsoft SQL Server? If so, there is a type-4 JDBC driver that runs just fine on Linux. As far as command line tools go, I don't know of any Linux command line tools that work with SQL Server (though doing a search for "SQL Server" in your distro's package manager might bring something up). But once you have the JDBC driver, then just about any Java-based tools should let you make those queries.

JBoss In Action
I agree. Here's the link: http://aspose.com/file-tools
subject: Execute SQL scripts in Unix
Similar Threads
Telnet client from webapp [was: Help needed in jsp and beans]
Execute .sql file using java
Migrating from Ms Sql Server(T-SQL) to Oracle database 10g(PL-SQL)
JDBC Type 4 Drivers
Looking for Software developement job in Atlanta GA- 4 Yrs Experience