Codota Logo
MySQLSyntaxErrorException
Code IndexAdd Codota to your IDE (free)

How to use
MySQLSyntaxErrorException
in
com.mysql.jdbc.exceptions.jdbc4

Best Java code snippets using com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException (Showing top 3 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: wycm/zhihu-crawler

public static Connection createConnection(){
  String host = Config.dbHost;
  String user = Config.dbUsername;
  String password = Config.dbPassword;
  String dbName = Config.dbName;
  String url="jdbc:mysql://" + host + ":3306/" + dbName + "?characterEncoding=utf8";
  Connection con=null;
  try{
    con = DriverManager.getConnection(url,user,password);//建立mysql的连接
    logger.debug("success!");
  } catch(MySQLSyntaxErrorException e){
    logger.error("数据库不存在..请先手动创建创建数据库:" + dbName);
    e.printStackTrace();
  } catch(SQLException e2){
    logger.error("SQLException",e2);
  }
  return con;
}
public static void main(String [] args) throws Exception{
origin: pinterest/pinlater

/**
 * 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;
}
origin: pinterest/pinlater

/**
 * 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;
}
com.mysql.jdbc.exceptions.jdbc4MySQLSyntaxErrorException

Most used methods

  • getErrorCode
  • printStackTrace

Popular in Java

  • Reading from database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onRequestPermissionsResult (Fragment)
  • putExtra (Intent)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Path (java.nio.file)
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now