Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java + SQLCMD error

 
Sandeep Bhoyar
Greenhorn
Posts: 17
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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'.

 
Richard Tookey
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Richard.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic