I am getting the error: ```ERROR (5.5.2+00578) Co...
# box-products
o
I am getting the error:
Copy code
ERROR (5.5.2+00578)

Could not create connection to database server.

C:\Users\ookma\.CommandBox\cfml\modules\commandbox-migrations\modules\cfmigrations\models\QBMigrationManager.cfc
while trying to run the command
box migrate up
in the terminal. I have verified my database setting in the Lucee admin. I can also verify that the app itself seems to be able to access the database as seen in the attached screenshot. I also tried disabling SSL and it still doesn't work.I am getting the error:
Copy code
ERROR (5.5.2+00578)

Could not create connection to database server.

C:\Users\ookma\.CommandBox\cfml\modules\commandbox-migrations\modules\cfmigrations\models\QBMigrationManager.cfc
while trying to run the command
box migrate up
in the terminal. I have verified my database setting in the Lucee admin. I can also verify that the app itself seems to be able to access the database as seen in the attached screenshot. I also tried disabling SSL and it still doesn't work.
j
This is a commandbox command so it cannot use the datasource from your application. You will need to define the settings in the
.cfmigrations.json
configuration file. Take a look at the readme for an example here. https://github.com/commandbox-modules/commandbox-migrations
1
o
I have a cfmigration.json file already. I deleted the existing one and recreated it:
Copy code
{
  "default": {
    "manager": "cfmigrations.models.QBMigrationManager",
    "migrationsDirectory": "resources/database/migrations/",
    "seedsDirectory": "resources/database/seeds/",
    "properties": {
      "defaultGrammar": "AutoDiscover@qb",
      "schema": "${DB_SCHEMA}",
      "migrationsTable": "cfmigrations",
      "connectionInfo": {
        "password": "${DB_PASSWORD}",
        "connectionString": "${DB_CONNECTIONSTRING}",
        "class": "${DB_CLASS}",
        "username": "${DB_USER}",
        "bundleName": "${DB_BUNDLENAME}",
        "bundleVersion": "${DB_BUNDLEVERSION}"
      }
    }
  }
}
Same issue
j
Do you have a
.env
file with the connection info and credentials? i.e.
Copy code
# MYSQL VERSION
DB_SCHEMA=test_db
DB_DATABASE=test_db
DB_CLASS=org.gjt.mm.mysql.Driver
DB_CONNECTIONSTRING=jdbc:<mysql://localhost:3306/test_db?useUnicode=true&characterEncoding=UTF-8&useLegacyDatetimeCode=true>
DB_USER=test
DB_PASSWORD=pass1234
o
yes, checking
@jsteinshouer Same issue .env details are correct
j
if you type
box env show
do you see the variables listed i.e. DB_CONNECTIONSTRING, etc?
You may need to install
commandbox-dotenv
if you do not already have it. I think it is bundled in the most recent version.
Copy code
box install commandbox-dotenv
o
Copy code
PS D:\ookma-kyi-core> box env show
{
    "DB_DATABASE":"ookma-kyi",
    "APPNAME":"ookma-kyi",
    "ENVIRONMENT":"development",
    "DB_HOST":"127.0.0.1",
    "DB_USER":"root",
    "DB_BUNDLEVERSION":"5.1.38",
    "DB_PASSWORD":"ok12345",
    "DB_BUNDLENAME":"com.mysql.jdbc",
    "DB_PORT":"3306",
    "DB_SCHEMA":"ookma-kyi",
    "DB_CONNECTIONSTRING":"jdbc:<mysql://127.0.0.1:3306/ookma-kyi?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&useLegacyDatetimeCode=true>",
    "DB_DRIVER":"MySQL",
    "DB_CLASS":"com.mysql.jdbc.Driver"
j
That is everything I can think of at the moment to check.
o
it's ok you have been very helpful
e
Can you run the
box migrate up
with the
--verbose
flag? (
box migrate up --verbose
)
That looks like an old bundle for MySQL, just based on recent Lucee versions.
Try these:
Copy code
DB_CLASS=com.mysql.cj.jdbc.Driver
DB_BUNDLEVERSION=8.0.19
DB_BUNDLENAME=com.mysql.cj
o
@elpete Why did this work? Box generated these settings to use that driver, when I first created the project.
e
Can you elaborate on what “Box generated these settings”?
o
When I initially ran
coldbox create app foobar skeleton=cbtemplate-quick-with-auth
it produced:
Copy code
"DB_DATABASE":"Coldbox"
    "APPNAME":"Coldbox"
    "ENVIRONMENT":"development"
    "DB_HOST":"127.0.0.1"
    "DB_USER":"root"
    "DB_BUNDLEVERSION":"5.1.38"

    "DB_PASSWORD":""

    "DB_BUNDLENAME":"com.mysql.jdbc"

    "DB_PORT":"3306"
    "DB_SCHEMA":"Coldbox"
 "DB_CONNECTIONSTRING":"jdbc:<mysql://127.0.0.1:3306/Coldbox?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&useLegacyDatetimeCode=true>"
    "DB_DRIVER":"MySQL",
    "DB_CLASS":"com.mysql.jdbc.Driver"
Am I supposed to update that setting, and if so where do I find out what driver settings I am using?
e
You are supposed to update those settings to match your database. Those settings work for MySQL 5, if I remember.
As for finding out, I don’t have a great answer. I usually will update the datasource in the Lucee admin and either copy the datasource struct or export via cfconfig.