File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Java + SQLCMD error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java + SQLCMD error " Watch "Java + SQLCMD error " New topic

Java + SQLCMD error

Sandeep Bhoyar

Joined: May 17, 2010
Posts: 17

I am trying to execute sqlcmd from java.but I am getting error,Please check the below given code and let me know what I am doing wrong.

While running sqlcmd from sqlclient its working fine but from Java 7 I am getting error:

Msg 4145, Level 15, State 1, Server SUNIL-PC, Line 1 An expression of non-boolean type specified in a context where a condition is expected, near 'employeeId'.

Richard Tookey

Joined: Aug 27, 2012
Posts: 1166

You would probably do better using the exec() method that takes an array of String as argument. For example

Note - you will need to check that I have interpreted your code correctly since it looks like the last part of your posted command has been chopped.

You should also read and implement ALL the recommendations. Failure to do so will almost certainly cause you more grief.
Sandeep Bhoyar

Joined: May 17, 2010
Posts: 17

Thanks Richard.
I agree. Here's the link:
subject: Java + SQLCMD error
It's not a secret anymore!