skaterdav85 Posted June 4, 2010 Share Posted June 4, 2010 I'm having trouble calling a stored procedure in java. This is my error:SQL Exception: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near 'CALL'.However, when I do the exact same query by hardcoding the statement, it works.This one doesnt work String sql = "CALL addDocument(?,?);";CallableStatement stmt = this.conn.prepareCall(sql);stmt.setString(1, this.documentNumber);stmt.setString(2, this.documentTitle); This one works String sql = "INSERT INTO document (documentNumber, documentTitle) VALUES (?,?);";PreparedStatement stmt = this.conn.prepareStatement(sql);stmt.setString(1, this.documentNumber);stmt.setString(2, this.documentTitle);stmt.executeUpdate(); Anyone have an idea of why this might not work? I know my SP works fine because i tested it in sql server management studio.FIXED. Apparently you cant use a semi colon in the call statement. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.