I am facing a problem with my database. Context: Web application referencing members, where it is possible to import members via an xls file repository, a processing is done to save it in database. I try to execute a command that is supposed to run in the background on the production environment, but on the development environment it must be executed manually, to perform the import of the files that have as states "to import". Problem during the execution, the command displays that there are driver problems with PDO, it can't find them.
Any idea where the problem could come from?
You will find here with the detailed errors, as well as the config.yml of the symfony 5 project
In AbstractMySQLDriver.php line 128:
An exception occurred in driver: could not find driver
In Exception.php line 18:
could not find driver
In PDOConnection.php line 40:
could not find driver
doctrine:
dbal:
driver: pdo_mysql
host: '%database_host%'
port: '%database_port%'
dbname: '%database_name%'
user: '%database_user%'
password: '%database_password%'
charset: UTF8
types:
phone_number: Misd\PhoneNumberBundle\Doctrine\DBAL\Types\PhoneNumberType
server_version: "%doctrine_server_version%"
options:
1002: 'SET sql_mode=(SELECT REPLACE(##sql_mode, "ONLY_FULL_GROUP_BY", ""))'
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
dql:
string_functions:
MONTH: DoctrineExtensions\Query\Mysql\Month
YEAR: DoctrineExtensions\Query\Mysql\Year
regexp: DoctrineExtensions\Query\Mysql\Regexp
replace: DoctrineExtensions\Query\Mysql\Replace
DATE_FORMAT: DoctrineExtensions\Query\Mysql\DateFormat
mappings:
gedmo_tree:
type: annotation
prefix: Gedmo\Tree\Entity
dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/Entity"
alias: GedmoTree # (optional) it will default to the name set for the mapping
is_bundle: false
Check if your DATABASE_URL host is correct on your .env file.
You should have something like DATABASE_URL=mysql://dbuser:dbpassword#127.0.0.1:3306/something
If it's correctly setup, check your local installation (usually with sudo apt-get install pdo-mysql)
Also check your php.ini file if extension=pdo_mysql is not commented.
I'm confused I found where my mistake came from. The configuration files were set up correctly but I hadn't run bash before running the command, so it didn't recognize the locally binded augments. Really sorry for this question ... very stupid
The problem here comes from you env file. Make sure you wrote the correct database information there:
DATABASE_URL="mysql://db_user:db_password#127.0.0.1:3306/db_name?serverVersion=5.7"
Also, make sure that you did create your database correctly and you can find here in your database.
Related
I am ned to dbt and currently trying to set up my first profile to run dbt via snowflake.
During the setup process, I have created my profiles.yml
However, when running dbt debug
I receive the following message: profiles.yml file [ERROR not found]
The path where my profile is: /Users/Kakurebono .dbt/profiles.yml
What could be the reason behind not finding the profile?
This is my profile.yml config setup:
udemy-learn-dbt:
target: dev
default:
outputs:
dev:
type: snowflake
account: zpa43768.us-east-1
#User/password auth
user: transform_user
password: xxxx
role: TRANSFORM_ROLE
database: analytics
warehouse: transform_wh
schema: dbt
threads: 1
client_session_keep_alive: False
so the problem was the following:
the Project.yml can only be named with underscore and lower case letters
the Project.yml file contains name: that can be anything and profile: that refers to the Profile.yml file. Please bear in mind that both files are white space sensitive!
Run $ dbt compile once both files are updated and saved then $ dbt debugto check whether everything is running correctly.
The config can be tricky. I would recommend for newbies like myself the Udemy dbt course
I'm trying to connect to MongoDB in a IBMCloud instance and I'm using MongoID. I ever use some configurations and try very things. I'm getting the error:
MONGODB | Error running ismaster on address:port: system lib
Here is my mongoid.yml that I'm trying to connect to mongoDB:
development:
clients:
default:
database: databasename
hosts:
- address:port
- address:port
options:
user: 'admin'
password: 'some-password'
auth_mech: :scram
auth_source: admin
connect: :replica_set
replica_set: replset
ssl: true
ssl_ca_cert: ./some-certificate.pem
ssl_verify: true
options:
log_level: :debug
What do I need to add to connect with the mongo database in IBMCloud?
"system lib" is coming from OpenSSL and indicates a problem with the CA certificate, such as the path not referring to an existing file. Note that in the configuration you specified a relative path which could cause problems.
I created https://jira.mongodb.org/browse/RUBY-1946 to add the exception class to the reported message which would clarify where the error is originating in the future.
Upgrade to the current version of Ruby driver (2.10.2 as of this writing) which provides more extensive diagnostics. Set driver log level to debug (https://docs.mongodb.com/mongoid/master/tutorials/mongoid-configuration/#logging). If you are having trouble identifying the problem then, post the
updated error and log messages here.
I've been holding off posting here because I feel like this issue could be too vague. I will try my best to explain. I have been through all of the existing questions but they don't seem relevant to what I am doing.
Basically, I have inherited 3 Ec2 Instances that are Dev / Staging / Live web applications in my new role. I use Ansible playbooks to migrate the Database between all environments. We recently had a new website that was deployed onto all three existing instances.
The Dev box recently died so I blew it away and launched a new one, the website looks fine, however exporting and importing the Database no longer works (on the new instance)
Below is the Ansible output:
TASK: [Export database to migrate] ********************************************
failed: [172.**.**.***] => {"changed": true, "cmd": "wp db export dbv2.sql --tables=t*******0_links,t*******0_options,t*******0_postmeta,t*******0_posts,taxlt4ws0_rg_form,taxlt4ws0_rg_form_meta,taxlt4ws0_rg_form_view,t*******0_term_relationships,t*******0_term_taxonomy,t*******0_termmeta,t*******0_terms,t*******0_usermeta,t*******0_users", "delta": "0:00:00.001594", "end": "2017-09-01 10:21:25.225355", "rc": 127, "start": "2017-09-01 10:21:25.223761", "warnings": []}
stderr: /bin/sh: 1: wp: not found
FATAL: all hosts have already failed -- aborting
Things I've checked:
Chmod on the folders it import/exports in/from.
IAM Role is set
Used Shell instead of Command in the Playbook
Configs for each environment
I'm really stumped my Ansible knowledge is quite limited as I only picked it up a couple months ago and hadn't run into any issues (even with a new Website) until the Dev box had to be replaced.
I think ansible is referring to wpcli. It is not able to find its executable.
If this is the case,you need to install it with another task before that one.
Basically what this is complaining about is that whatever script you are using in module Export DB is not able to find a wp script or executable.
stderr: /bin/sh: 1: wp: not found
Would recommend checking which wp or maybe do a find to see if it is on the staging or live instances to see what it is and install/copy it over to the Dev instances.
You can test this hypothesis by using a small test script:
#!/bin/sh
wp
create this script say test.sh, give it executable permissions and run it on all the env's to see where it fails.
I am trying to connect a phoenix application to MS SQL. After looking around online I came across a couple of adapters called mssql_ecto & mssqlex.
I have added them to the project following the instructions in the readme, installed odbc and checked that the db is online but I am now getting the following error..
[error] Mssqlex.Protocol (#PID<0.13069.0>) failed to connect: ** (Mssqlex.Error) odbc_not_started
My app is configured as below..
config :my_app, MyApp.Repo,
adapter: MssqlEcto,
username: "<my_username>",
password: "<my_password>",
database: "test",
hostname: "<my_server>.database.windows.net",
pool_size: 10
My environment is as follows..
MacOS Sierra 10.12.5
Elixir version: 1.4.4
There is an issue in the mssql_ecto repo already, and I have tried the suggestions from there, but it still has not worked.
If anyone has managed to connect their phoenix/elixir application to MSSQL on macOS and could provide some instructions it would be greatly appreciated (even if it was done in a completely different way to my approach 😉 ).
Side note: Tried it in node with the same db and was able to connect to and query the db.
I've been working through the same issue this week, connecting to an Azure SQL Database, and this is what I've got working.
You are seeing the first of 2 main problems I ran into:
Erlang installed without ODBC
Mssqlex adapter is missing required configuration options
#1: Erlang installed without ODBC
If you've installed Elixir and Erlang using brew, or something like it, you are getting an installation of Erlang that does not include erlang-odbc. In order to remedy this, you will need to install Erlang from source.
I recommend that you install both Erlang and Elixir from source using the method documented here:
http://www.lambdacat.com/how-to-install-elixir-on-mac/
Just make sure that you remove the Kerl option, --without-odbc, before you build Erlang.
Now that you have Erlang installed correctly, the odbc_not_started error should go away... to be replaced by connection errors to the database.
#2: Mssqlex adapter is missing required configuration options
As of this moment, the mssqlex adapter does not support the following configuration options that Azure is looking for:
Encrypt
TrustServerCertificate
Connection Timeout
To get around this issue, I forked the mssqlex library and added those options in a branch. I am not committing to maintaining this so feel free to fork it yourself.
In order to use the modified mssqlex, replace the mix dependency with the github location and branch name:
{:mssqlex, git: "https://github.com/tvanhouten/mssqlex.git", branch: "azure-settings", override: true}
The override: true is important because mssql_ecto has a dependency on the mssqlex version in hex.
Now you can update your configuration:
config :my_app, MyApp.Repo,
adapter: MssqlEcto,
username: "<my_username>",
password: "<my_password>",
database: "test",
hostname: "<my_server>.database.windows.net",
pool_size: 10,
encrypt: "yes",
trust_server_certificate: "no",
connection_timeout: "30
Other "Gotchas" to Look Out For
Azure requires TCP connection:
In order to connect to an Azure SQL Database, you will need to make sure that the hostname: option starts with tcp:. So, all together, it will look like
hostname: "tcp:.database.windows.net"
Mssql_ecto does not support Ecto 2.2+:
If you're getting errors related to Ecto or Ecto.SubQuery, you probably need to make sure that you are using a version of Ecto that is supported by mssql_ecto. At this point in time, that means Ecto 2.1.x. Again, this requires a slight change to your mix dependencies:
{:ecto, ">= 2.1.0 and < 2.2.0"}
Dependency cache and lock issues:
If everything seems to be in order according to the above but it just doesn't seem like the new dependencies are being updated and compiled as expected, do the following:
Run mix deps.clean --all
Delete the mix.lock file from your root project directory
Run mix deps.get
Run mix deps.compile
That should do it!
I received this error after running
export DATABASE_URL=postgres://$(whoami)
on the command line. Now when I run the command
$$ rake db:migrate
This is the full error
rake aborted!
PG::ConnectionBad: could not translate host name "Jillian" to address: nodename nor servname provided, or not known
Tasks: TOP => db:migrate
How can I fix postgres?
PS I was following this tutorial https://devcenter.heroku.com/articles/heroku-postgresql#local-setup to set up pg for a python app, but I may have an old version of pg. I'm trying to at least get postgres back to how it was before I ran that^
....And the answer you've all been waiting for:
If you've messed up your development environment by running export DATABASE_URL=..., if you'e in a similar sitaution to the one above and already set up your environments within each project, resolve this issue by running
unset DATABASE_URL
My solution was to change /etc/hosts file
In my application.yml file was defined:
databases:
crm:
adapter: postgresql
host: postgresql
and error was looked like
PG::ConnectionBad:
could not translate host name "postgresql" to address: nodename nor servname provided, or not known
therefore I've edit my /etc/hosts file (with sudo):
sudo vim /etc/hosts
and have added next row
127.0.0.1 postgresql
after that everything works fine