views:

573

answers:

3

I'm working on a Java program that is calling sqlcmd. It works perfectly on a computer with SQL server installed, but not at all on a computer that doesn't. I want to include the necessary exe and dll files to run this command in my jar. Anyone know which ones I need? I already included batchparser90.dll, sqlcmd.exe, and sqlcmd.dll. It still didn't work.

Any suggestions are appreciated. Thanks in advance!

+1  A: 

You can only run sqlcmd from a computer that has the SQL Server client tools installed. Afaik sqlcmd is not freely redistributable and embeding it in your application would likely violate the license. You can either require your users to buy a SQL Server license and install the SQL Server client tools, you can limit yourself to features available in the redistributable API SDKs (ie. JDBC), you can choose an API SDK that does have the required features for development like SmoApplication.EnumAvailableSqlServers or you can go all out and add the missing features int he API you use, ie. implement the sql browsing udp 1434 protocol yourself in Java. Pick your poison.

Remus Rusanu
+1  A: 

Although it's probably too late for the original poster, for future reference, SQLCMD is freely downloadable, so it's not necessary to purchase SQL Server explicitly for this purpose. Presumably the user has SQL Server with CALs or they wouldn't need SQLCMD in the first place.

In any event, the 2008 R2 download as of my typing this is here:

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=ceb4346f-657f-4d28-83f5-aae0c5c83d52

Microsoft updates the Feature Pack every so often so this may not be current when you read this.

MikeBaz
A: 

You can download SQLCMD and run as a standalone application. Follow the link.

Feature Pack for Microsoft SQL Server 2005 - Nov 2005

Naeem Sarfraz