permaculture playing cards*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java + SQLCMD error " Watch "Java + SQLCMD error " New topic
Author

Java + SQLCMD error

Sandeep Bhoyar
Greenhorn

Joined: May 17, 2010
Posts: 17

Hi,
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'.


$andybo
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 1035
    
  10

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
Greenhorn

Joined: May 17, 2010
Posts: 17

Thanks Richard.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java + SQLCMD error
 
Similar Threads
accessing a "main" variable from within a class method
why am i getting a null value on fetching from map
Calling command prompt from java
A[nother] question about tracking down memory leaks
Error while calling sqlcmd (sql server 2008 R2) from Java 7