wood burning stoves 2.0*
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 Spring in Action this week in the Spring 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
Ranch Hand

Joined: Aug 27, 2012
Posts: 1067

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 http://www.javaworld.com/jw-12-2000/jw-1229-traps.html 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: http://aspose.com/file-tools
subject: Java + SQLCMD error