當前位置: 首頁>>代碼示例>>Java>>正文


Java MySQLSyntaxErrorException類代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:13,代碼來源:JDBCTest.java

示例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);
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:11,代碼來源:JDBCTest.java

示例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);
   
   
}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-N,代碼行數:31,代碼來源:Main.java

示例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;
}
 
開發者ID:pinterest-attic,項目名稱:pinlater,代碼行數:10,代碼來源:MySQLBackendUtils.java

示例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;
}
 
開發者ID:pinterest-attic,項目名稱:pinlater,代碼行數:10,代碼來源:MySQLBackendUtils.java


注:本文中的com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。