在Play 2中从命令行访问数据库

时间:2013-11-21 02:18:06

标签: java playframework-2.0 database-connection

我试图通过调用控制器中的方法从播放控制台访问Play数据库。 由于Play应用程序未运行,因此未初始化数据库。 我想出了一种获取数据库访问权限的方法是使用FakeApplication 但是,FakeApplicationis主要用于测试。我的目标是使用一种简单的方法修复生产数据库中的一些问题

由于

2 个答案:

答案 0 :(得分:0)

按照我为您制作的这些步骤。

1。           * 1

        Start by logging in to your database server.
      * 2

        Next, go to "Start, Programs, Accessories" and then to "Command Prompt."
      *

        Sponsored Links
            o Network Security Scanner

              Don't Let Hackers Access Info From Your Business Network. Try it Free!
              www.gfi.com/LanGuard_2014
      * 3

        Type "Show Databases" on the command line.
      * 4

        Choose your database from the list of databases and type it on the command line. Press "Enter." A query will run to provide you access to your own database.
      * 5

        Manage the data or commands that you would like to use as soon as you have entered your password and are officially logged in.
      * 6

        Play with the options to manage and operate your database. Set the database up to your personal preferences so navigating and managing the database will be as simple as possible.

答案 1 :(得分:0)

鉴于您正在尝试修复生产中的数据库问题,使用数据库提供的工具访问数据库可能更容易/更明智。大多数流行的数据库都有足够的GUI和/或命令行工具,它们提供的功能比简单地通过Play控制台和使用JDBC或其他库更多。