91

Вопрос по playframework, ebean, playframework-2.0, java – Шаги, необходимые для использования базы данных MySQL с Play Framework 2.0

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

  • Error: User Rate Limit Exceededsudo apt-get install mysql-client; sudo apt-get install libmysql-javaError: User Rate Limit Exceededexport CLASSPATH=/usr/share/java/mysql-connector-java.jarError: User Rate Limit Exceeded/etc/environmentError: User Rate Limit Exceededhelp.ubuntu.com/community/JDBCAndMySQLError: User Rate Limit Exceeded

    от
  • Error: User Rate Limit ExceededlocalhostError: User Rate Limit Exceeded127.0.0.1Error: User Rate Limit ExceededMariaDBError: User Rate Limit Exceededskip-networkingError: User Rate Limit Exceededmy.cnfError: User Rate Limit ExceededlocalhostError: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceededjava.sql.SQLException: No suitable driver found for mysql://....

    от
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceededgithub.com/playframework/playframework/blob/2.2.x/documentation/…Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от Veera
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit ExceededlibraryDependencies ++= Seq(jdbc,anorm,cache,"mysql" % "mysql-connector-java" % "5.1.27")

    от
  • Error: User Rate Limit Exceeded

    от
10 ответов
  • 1

    Code:

    For me this work ,Add this below line into your Dependencies
    
    **"mysql" % "mysql-connector-java" % "5.1.36"**
    
    
    So , here is the code
    
          import java.sql.Connection
    
          val driver = "com.mysql.jdbc.Driver"
          val url = "jdbc:mysql://localhost/world"
          val username = "root"
          val password = "root"
          var connection: Connection = null
    
      try {         // make the connection
                    Class.forName(driver)
                    connection = DriverManager.getConnection(url, username, password)
    
                    // create the statement, and run the select query
                    val statement = connection.createStatement()
                    val resultSet = statement.executeQuery("SELECT id , name FROM bar")
    
                    val sql: SqlQuery = SQL("select * from products order by name asc")
    
                    while (resultSet.next()) {
                      val id = resultSet.getString("id")
                      val name = resultSet.getString("name")
                      println(id, name)
                    }
                  } catch {
                    case e: Exception => println("exception caught: " + e);
                  }
                  connection.close()
    

  • 6

    Error: User Rate Limit Exceeded

    Add MySQL connector/J in project's dependency (which is inside /project/Build.scala) After adding dependency, run play dependencies to resolve newly added MySQL connector/J dependency Uncomment default ebean configuration line ebean.default="models.*" Configure MySQL database correctly with proper character encoding db.default.driver=com.mysql.jdbc.Driver db.default.url="jdbc:mysql://www.sample.com:3306/test?characterEncoding=UTF-8" db.default.user=playuser db.default.pass=playuser

  • 10

    Error: User Rate Limit Exceeded

      "mysql" % "mysql-connector-java" % "5.1.27"
    

  • 1

    Error: User Rate Limit Exceeded

    libraryDependencies ++= Seq(
      javaJdbc,
      javaEbean,
      cache,
      javaWs,
      "mysql" % "mysql-connector-java" % "5.1.27"
    )
    

  • 101

    Error: User Rate Limit Exceeded

    Other than for the h2 in-memory database, useful mostly in development mode, Play 2.0 does not provide any database drivers. Consequently, to deploy in production you will have to add your database driver as an application dependency.

    For example, if you use MySQL5, you need to add a dependency for the connector:

    val appDependencies = Seq(
        // Add your project dependencies here,
        ...
        "mysql" % "mysql-connector-java" % "5.1.18"
        ...
    )
    

    .

    application.conf:

    db.default.driver=com.mysql.jdbc.Driver
    db.default.url="mysql://root:[email protected]/myDatabase"
    

  • 4

    Error: User Rate Limit Exceeded

    Play 2.4.3 & MYSQL 5.7.9

    Environment Details: (this is what I am using)

    Play 2.4.3 this comes with activator-1.3.7-minimal JDK8, you should already have this as I don't think this version of play works with JDK7 MYSQL 5.7.9

    appication.conf

    db.default.driver=com.mysql.jdbc.Driver
    db.default.url="jdbc:mysql://localhost:3306/testSchema?characterEncoding=UTF-8"
    db.default.user=yourDBUserName
    db.default.password=yourDBUserPass
    

    Note:

    testSchema in the URL is your database name, if you are using something like MYSQL workbench you will see this listed under the SCHEMAS section. I called mine testSchema. Others may call it something like "myDatabase" The port should be the MYSQL port. Not your application port. I put 3306 in the example because that is usually the default for MYSQL.

    build.sbt

    libraryDependencies ++= Seq()

    libraryDependencies += "mysql" % "mysql-connector-java" % "5.1.36"
    

    Finally

    run this command from your project root -> activator reload restart your appplication

  • 94

    Error: User Rate Limit Exceeded

    /project/Build.scala

    val appDependencies = Seq(
        // Add your project dependencies here,
        "mysql" % "mysql-connector-java" % "5.1.18"
    )
    

    /conf/application.conf:

    db.default.driver=com.mysql.jdbc.Driver
    db.default.url="jdbc:mysql://localhost/your_db_name?characterEncoding=UTF-8"
    db.default.user=your_login
    db.default.password=your_pass
    

    ebean.default="models.*"
    

  • 8

    Error: User Rate Limit Exceeded

    For Play 2.3.3, in the build.sbt file add the mysql specific line in the libraryDependencies:

    libraryDependencies ++= Seq(
        "mysql" % "mysql-connector-java" % "5.1.27"
    )
    

    In the /conf/application.conf file add this:

    db.myotherdb.driver = com.mysql.jdbc.Driver
    db.myotherdb.url = "jdbc:mysql://xxx.xxx.xxx.xxx/NameOfOtherDB?characterEncoding=UTF-8"
    db.myotherdb.user = MyOtherDbUSername
    db.myotherdb.password = MyOtherDbPass
    

    You can replace "myotherdb" by "default" in case you want to use the default database or with any other name that you want to use. Replace "xxx.xxx.xxx.xxx" with the IP address of the server where your database is located (in case of an external database) or localhost (or 127.0.0.1) for local database. Replace "NameOfOtherDB" with the name of the database that you want to use, the "MyOtherDbUSername" with your database username and "MyOtherDbPass" with your database password.

    Inside your Model (/app/models/MyModel.scala) add this:

    val connection = DB.getConnection("myotherdb")
    

    Create the statement, the query and execute it:

    val statement = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)
    val query = "SELECT * FROM myTableName"
    val resultset = statement.executeQuery(query)
    

    Then you can continue with whatever you want to do with the retrieved data. For example:

    while (resultset.next()) {
        resultset.getString("columnName")
    }
    

    Where "columnName" is the name of the DB table column/field that you want to retrieve.

    close()

  • 4

    Error: User Rate Limit Exceeded

    play 2.3.1

    libraryDependencies ++= Seq( javaJdbc, javaEbean, "mysql" % "mysql-connector-java" % "5.1.29"
    

    db.default.driver=com.mysql.jdbc.Driver    //this is com. and not org.
    db.default.url="jdbc:mysql://127.0.0.1/test?characterEncoding=UTF-8"
    db.default.user=playuser
    db.default.pass=playuser
    

    reload

  • 1

    Error: User Rate Limit Exceeded

    application.conf

    # MySQL DB Configuration
    db.default.driver=com.mysql.jdbc.Driver
    db.default.url="jdbc:mysql://{hostname or ipaddres}/{db name}?characterEncoding=UTF-8"
    db.default.username=username  // Note that user id deprecated, instead use username. Though that is not a major issue
    db.default.password="password"
    
    # JPA Configurations
    jpa.default=defaultPersistenceUnit
    PlayKeys.externalizeResources = false
    
    # JavaEbean configuration
    ebean.default = ["models.*"]

    build.sbt

    libraryDependencies ++= Seq(
      javaJdbc,
      cache,
      javaWs,
      javaJpa,
      evolutions,
      "mysql" % "mysql-connector-java" % "5.1.27"
    )

    plugins.sbt

    // The Play plugin
    addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.3")
    
    // Web plugins
    addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
    addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6")
    addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.3")
    addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7")
    addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0")
    addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.1.0")
    
    // Play enhancer - this automatically generates getters/setters for public fields
    // and rewrites accessors of these fields to use the getters/setters. Remove this
    // plugin if you prefer not to have this feature, or disable on a per project
    // basis using disablePlugins(PlayEnhancer) in your build.sbt
    addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0")
    
    // Play Ebean support, to enable, uncomment this line, and enable in your build.sbt using
    // enablePlugins(SbtEbean). Note, uncommenting this line will automatically bring in
    // Play enhancer, regardless of whether the line above is commented out or not.
    addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "1.0.0")

    After configuring above steps, go to command line, stop your activator and run the command activator run. In my situation, I was keep getting the error unable to find mysql drivers. After running the activator run, activator would actually download the MySQL drivers and would resolve the dependencies. That is the important step that resolved my issue.