本文整理汇总了Java中com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException类的典型用法代码示例。如果您正苦于以下问题:Java MySQLSyntaxErrorException类的具体用法?Java MySQLSyntaxErrorException怎么用?Java MySQLSyntaxErrorException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MySQLSyntaxErrorException类属于com.mysql.jdbc.exceptions.jdbc4包,在下文中一共展示了MySQLSyntaxErrorException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insert_no_permission
import com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException; //导入依赖的package包/类
public void insert_no_permission() throws Exception {
tearDown();
connnect(USER_NAME, USER_PASS);
try {
String sql = " INSERT INTO db1.mytable1 (id,title,tags,author) VALUES \n" +
"(1,'baidu',['aaa','bbb'],{name='gaopan',age=26})";
int affectRows = stmt.executeUpdate(sql);
} catch (Exception e) {
assertTrue(e instanceof MySQLSyntaxErrorException);
}
}
示例2: createTable_no_permission
import com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException; //导入依赖的package包/类
public void createTable_no_permission() throws Exception {
tearDown();
connnect(USER_NAME, USER_PASS);
try {
String sql = " create table db1.mytable2(id integer primary key)";
int affectRows = stmt.executeUpdate(sql);
} catch (Exception e) {
assertTrue(e instanceof MySQLSyntaxErrorException);
}
}
示例3: main
import com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException; //导入依赖的package包/类
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException, SQLException {
GuiNome guiNome = new GuiNome();
CreateDb createDb = new CreateDb();
boolean controllo = false;
try{
controllo = createDb.FirstAccess();
}catch(MySQLSyntaxErrorException ex){
}
if(controllo){
createDb.toJavaFromDbSale();
createDb.toJavaFromDbPortate();
createDb.toJavaFromDbNome();
createDb.toJavaFromDbPrenotazioni();
GuiPrincipale guiProva = new GuiPrincipale();
guiProva.refreshNumber();
guiProva.setLocationRelativeTo(null);
guiProva.setVisible(true);
}else
guiNome.setVisible(true);
}
示例4: isDatabaseNameTooLongException
import com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException; //导入依赖的package包/类
/**
* Indicates whether an exception is a result of a particular database
* identifier being too long . Error codes for MySQL can be found here:
* http://dev.mysql.com/doc/refman/5.6/en/error-messages-server.html
*/
public static boolean isDatabaseNameTooLongException(Exception e) {
return e instanceof MySQLSyntaxErrorException
&& ((MySQLSyntaxErrorException) e).getErrorCode() == MYSQL_DB_NAME_TOO_LONG_ERROR_CODE;
}
示例5: isDatabaseDoesNotExistException
import com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException; //导入依赖的package包/类
/**
* Indicates whether an exception is a result of a particular database or table not
* existing in the MySQL instance. Error codes for MySQL can be found here:
* http://dev.mysql.com/doc/refman/5.6/en/error-messages-server.html
*/
public static boolean isDatabaseDoesNotExistException(Exception e) {
return e instanceof MySQLSyntaxErrorException
&& ((MySQLSyntaxErrorException) e).getErrorCode() == MYSQL_DB_DOESNT_EXIST_ERROR_CODE;
}