SQL Invalid characters Execute SQL statement error solution _mssql

Source: Internet
Author: User
Ashamed to say, always make some small mistakes, tangled half a day, this should not be a semicolon of the thing toss for a long time!
Error when executing the SQL statement, the information is as follows:
Java code
[Default] [2012-11-22 11:35:58,552] [ERROR]
Java code
[com.primeton.common.connection.impl.synchronization.traceloggerstatementsynchronization:49]
Java code
Sql[insert into Ase_system_log (logid,userid,username,logintime) VALUES (?,?,?,?);] Execute error.
java.sql.sqlexception:ora-00911: Invalid character
The program code is as follows:
Java code
Copy Code code as follows:

String sql= "INSERT into Ase_system_log (logid,userid,username,logintime) VALUES (?,?,?,?);";
con = This.getdatasource (). getconnection ();
Ptt=con.preparestatement (SQL);
Ptt.setlong (1, Logid);
Ptt.setlong (2, userId);
Ptt.setstring (3,username);
Ptt.setstring (4, logindate);
Ptt.executeupdate ();

When executing the Ptt.excuteupdate () method, report the above error directly.
Think that there is a problem with the parameter assignment in SQL, but the SQL statement directly to the implementation of the Plsql, but no problem, tangled up for a long time, the original is
Copy Code code as follows:

"INSERT into Ase_system_log (logid,userid,username,logintime) VALUES (?,?,?,?);"

One more ";" No, hang-ah, this thing, I immediately have no words!!!
Well, if there is a report of the abnormal character of the basin friends can refer to, there will never be no more such a low-level error!
Caution Oneself One word: not careful is to do bad procedure.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.