flyway cli failing to connect to mysql database - getDatabaseTypeForUrl - flyway

I've been trying without success to connect to a local mySQL database, it keeps failing with the errors listed below.
[root#stargate drivers]# flyway info -X -url='"jdbc:mysql://localhost:3306/sms_database"'
DEBUG: Loading config file: /home/development/wip/flyway-9.1.3/conf/flyway.conf
DEBUG: Loading config file: /root/flyway.conf
DEBUG: Unable to load config file: /home/development/wip/flyway-9.1.3/drivers/flyway.conf
DEBUG: Using configuration:
DEBUG: flyway.jarDirs -> /home/development/wip/flyway-9.1.3/jars
DEBUG: flyway.locations -> service-sms/service-sms
DEBUG: flyway.password -> ********
DEBUG: flyway.url -> "jdbc:mysql://localhost:3306/sms_database"
DEBUG: flyway.user -> root
ERROR: Unexpected error
org.flywaydb.core.api.FlywayException: No database found to handle "jdbc:mysql://localhost:3306/sms_database"
at org.flywaydb.core.internal.database.DatabaseTypeRegister.getDatabaseTypeForUrl(DatabaseTypeRegister.java:54)
at org.flywaydb.core.internal.jdbc.DriverDataSource.<init>(DriverDataSource.java:109)
at org.flywaydb.core.internal.jdbc.DriverDataSource.<init>(DriverDataSource.java:89)
at org.flywaydb.core.api.configuration.ClassicConfiguration.configure(ClassicConfiguration.java:1528)
at org.flywaydb.core.api.configuration.FluentConfiguration.configuration(FluentConfiguration.java:943)
at org.flywaydb.commandline.Main.main(Main.java:157)
I've confirmed connectivity:
[root#stargate drivers]# mysql -h 127.0.0.1 -u root -ppassword
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 26
Server version: 8.0.23-vitess
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> status;
--------------
mysql Ver 8.0.26 for Linux on x86_64 (Source distribution)
Connection id: 26
Current database:
Current user: vt_app#localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 8.0.23-vitess
Protocol version: 10
Connection: 127.0.0.1 via TCP/IP
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: utf8mb4
Conn. characterset: utf8mb4
TCP port: 3306
Binary data as: Hexadecimal
--------------
I've tried both the mariadb-java-client-2.7.3.jar and mysql-connector-java-8.0.30.jar drivers and error is the same. Any advice ?

This is fixed by removing the extra '' characters from the URL string.

Related

Symfony bdal Excepiton: could not find driver

On command line I get connection and desired entities, no driver error here:
php bin/console dbal:run-sql 'select * from ourtest'
But on web i get error:
$this->connection->fetchAll('SELECT * FROM ourtest');
Handling
"App\Application\Command\DocumentUpload\DocumentUploadCommand" failed:
An exception occurred in driver: could not find driver
i tried
php -m display among others PDO, pdo_mysql, mysqli, mysqlnd
connection url from .env:
DATABASE_URL=mysql://xxx:xxx#mysql-db:3306/db_test_01?serverVersion=8.0
doctrine.yaml:
doctrine:
dbal:
dbname: db_test_01
host: mysql-db
port: 3306
user: xxx
password: xxx
driver: pdo_mysql
version: 8.0
My guess is the command line and your webserver use different configurations of PHP or different installations altogether.
Here's how to find out: Put a phpinfo() call in a file on your webserver (Do not do that on production as it will expose sensitive data to anyone with access to this file!). Open that file in your browser and check where your PHP installation is located.
On the command line, you can run which php to see where the PHP binary is located.
Compare the two and see whether you are running on the same binary. If it is indeed the same, then you should check which .ini file is used by the web server. In that .ini file you should find the name of the mysql extension (pdo_mysql.so) and it should not be commented out (no preceding ;).

Write a playbook, which access the network devices present in host file and check for host OS of the device (nexus/cisco/arista)

I am writing a playbook, which dynamically enters the network servers provided by user at prompt in host file.Further i want to create a task which will ssh on the server one by one and run show version command to fetch the OS of those network devices.
As of now, I am getting the below error:
1."Unable to automatically determine host network os. Please manually configure ansible_network_os value for this host"
I dont want to define the OS beforehand, rather want the playbook to do it.
I tried entering some configurations in host file as below:
[device]
192.1xx.xxx.xx
[all:vars]
ansible_connection=network_cli
ansible_user=user
ansible_ssh_pass=password
ssh_args = -o GSSAPIAuthentication=no
The below plsybook is taking device name from the user and adding it to the file, further it need to ssh on those servers and fetch the OS details:
---
- name: add host dynamically
hosts: localhost
gather_facts: no
vars:
Server: null_val1
vars_prompt:
- name: "Server"
prompt: "Please enter the non-reporting server/IP"
private: no
default: null_val1
pre_tasks:
- name: Save variable
set_fact:
Server: "{{Server}}"
- name: Copying servers to host file
hosts: localhost
become: true
tasks:
- name: copying variable value
lineinfile:
path: "{{playbook_dir}}/hosts.txt"
line: "{{Server}}"
insertafter: '^\[device\]'
state: present
- name: Main execution task
hosts: device
gather_facts: true
tasks:
- name: Run command on devices
cli_command:
command: show version
register: result
- name: display result
debug:
var: result.stdout_lines
The actual result should show me the OS of network device(s) entered in host file by running show version command remotely.

unauthorized: authentication required - trying to pull or run a public image

I'm trying to follow along this blog about using Docker with R.
I followed basic Docker set up steps and am able to run the hello world image.
I'm on a old 2009 Mac and had to use Docker Toolbox.
I'm in a place with weak internet connection and am using a personal hotspot.
Each time I try to run docker run --rm -p 8787:8787 rocker/verse I wait for a few minutes and see a downloading message, then I get a message "docker: unauthorized: authentication required."
I found this separate documentation which advised me to add a password:
docker run --rm -p 8787:8787 -e PASSWORD=blah rocker/rstudio
But I got the same result "docker: unauthorized: authentication required."
I did some Google searching and found some posts both here on SO and on Github but was unable to identify what is causing this error in my specific case.
I suspect my weak internet connection might have something to do with it since I seem to be able to download for about 10 or 15 minutes before seeing this message.
Here is Docker info:
Macs-MacBook:~ macuser$ docker info
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 2
Server Version: 18.09.6
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: bb71b10fd8f58240ca47fbb579b9d1028eea7c84
runc version: 2b18fe1d885ee5083ef9f0838fee39b62d653e30
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.14.116-boot2docker
Operating System: Boot2Docker 18.09.6 (TCL 8.2.1)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.951GiB
Name: default
ID: XMCE:OBLV:CKEX:EGIB:PHQ7:MLHF:ZJSA:PGYN:OIMM:JI67:ETCI:JKBH
Docker Root Dir: /mnt/sda1/var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
provider=virtualbox
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Does anyone know where I can look to next in order to be able to pull and or run the rocker image?

mysql window function working on production server, not on Raspberry Pi

I have just setup my Raspberry Pi (RPI) with OSMC (debian 9 stretch), nginx, PHP 7, Mysql and phpmyadmin
All seems to be working except the mysql windows functions. For example the following query produces a syntax error:
SELECT sum(propertyId) over() FROM `properties`;
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '() FROM `properties` LIMIT 0, 25' at line 1
However, the exact same query and database tables works fine on my production server.
Here are the setups (from the respective phpmyadmins) for the two servers:
RASPBERRY PI (not working)
Database server
Server: Localhost via UNIX socket
Server type: MariaDB
Server version: 10.1.26-MariaDB-0+deb9u1 - Debian 9.1
Protocol version: 10
User: phpmyadmin#localhost
Server charset: UTF-8 Unicode (utf8)
Web server
nginx/1.10.3
Database client version: libmysql - mysqlnd 5.0.12-dev - 20150407 - $Id: b5c5906d452ec590732a93b051f3827e02749b83 $
PHP extension: mysqliDocumentation mbstringDocumentation
PHP version: 7.0.30-0+deb9u1
PRODUCTION SERVER (WORKING FINE)
Database server
Server: Localhost via UNIX socket
Server type: MariaDB
Server version: 10.2.12-MariaDB-log - MariaDB Server
Protocol version: 10
User: montegoventures#localhost
Server charset: UTF-8 Unicode (utf8)
Web server
cpsrvd 11.70.0.53
Database client version: libmysql - 5.1.73
PHP extension: mysqliDocumentation curlDocumentation mbstringDocumentation
PHP version: 5.6.30
I have tried countless times to upgrade the mariadb on the RPI to version 10.2 but no matter what I do, it still installs version 10.1.26
So, any suggestions on how I can get my simple query to work on my RPI server? Yes, I know it is a trivial query, but if I can't get that simple one to work on the RPI, how can I get my complex queries to work?
thanks

SSH connectivity issues with ntc-ansible modules

I am trying to using the ntc-ansible module with Ansible running on Ubuntu (WSL). I have ssh connectivity to my remote device (Cisco 2960X) and I can run ansible playbooks to the same remote switch using the built in Ansible networking modules (ios_command) and it works fine.
Issue:
When I try to run any of the ntc-ansible modules, it fails, unable to connect to the device. Probably something simple, but I have hit a wall. There is something I am missing about how to use ntc-ansible modules. Ansible is seeing the modules as I can look at the docs as was suggested as a test in the readme.
I have ntc-ansible module installed here: /home/melshman/.ansible/plugins/modules/ntc-ansible
I am running my playbooks from here: ~/projects/ansible/
The first time I ran the playbook with the ntc-ansible modules it failed and based on error message and some research I installed sshpass (sudo apt-get install sshpass). But still having ssh problems using ntc-ansible… (playbook and traceback below)
I hear folks taking about an index file, but I can’t find that file? Where does it live and what do I need to do with it?
What is my connection supposed to be setup to be? Local? SSH? Netmiko_ssh?
What should I be using for platform? Cisco_ios? cisco_ios_ssh?
Appreciate any help I can get. I have been running in circles for hours and hours.
Ansible Version Info:
VTMNB17024:~/projects/ansible $ ansible --version
ansible 2.5.3
config file = /home/melshman/projects/ansible/ansible.cfg
configured module search path = [u'/home/melshman/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609]
Working playbook (ios_command:) note: ansible_ssh_pass and ansible_user in group var:
- name: Test Net Automation
hosts: ctil-ios-upgrade
connection: local
gather_facts: no
tasks:
- name: Grab run config
ios_command:
commands:
- show run
register: config
- name: Create backup of running configuration
copy:
content: "{{config.stdout[0]}}"
dest: "backups/show_run_{{inventory_hostname}}.txt"
Playbook (not working) using ntc-ansible module (Note: username and password are defined in Group VAR:
- name: Cisco IOS Automation
hosts: ctil-ios-upgrade
connection: local
gather_facts: no
tasks:
- name: GET UPTIME
ntc_show_command:
connection: ssh
platform: "cisco_ios"
command: 'show version | inc uptime'
host: "{{ inventory_hostname }}"
username: "{{ username }}"
password: "{{ password }}"
use_templates: True
template_dir: /home/melshman/.ansible/plugins/modules/ntc-ansible/ntc-templates/templates
Here is the traceback I get when the error occurs:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: netmiko.ssh_exception.NetMikoTimeoutException: Connection to device timed-out: cisco_ios VTgroup_SW:22
fatal: [VTgroup_SW]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_RJRY9m/ansible_module_ntc_save_config.py\", line 279, in \n main()\n File \"/tmp/ansible_RJRY9m/ansible_module_ntc_save_config.py\", line 251, in main\n device = ntc_device(device_type, host, username, password, **kwargs)\n File \"/usr/local/lib/python2.7/dist-packages/pyntc-0.0.6-py2.7.egg/pyntc/__init__.py\", line 35, in ntc_device\n return device_class(*args, **kwargs)\n File \"/usr/local/lib/python2.7/dist-packages/pyntc-0.0.6-py2.7.egg/pyntc/devices/ios_device.py\", line 39, in __init__\n self.open()\n File \"/usr/local/lib/python2.7/dist-packages/pyntc-0.0.6-py2.7.egg/pyntc/devices/ios_device.py\", line 55, in open\n verbose=False)\n File \"build/bdist.linux-x86_64/egg/netmiko/ssh_dispatcher.py\", line 178, in ConnectHandler\n File \"build/bdist.linux-x86_64/egg/netmiko/base_connection.py\", line 207, in __init__\n File \"build/bdist.linux-x86_64/egg/netmiko/base_connection.py\", line 693, in establish_connection\nnetmiko.ssh_exception.NetMikoTimeoutException: Connection to device timed-out: cisco_ios VTgroup_SW:22\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}
Here is a working solution using ntc_show_command to a Cisco IOS device.
- name: Cisco IOS Automation
hosts: pynet-rtr1
connection: local
gather_facts: no
tasks:
- name: GET UPTIME
ntc_show_command:
connection: ssh
platform: "cisco_ios"
command: 'show version'
host: "{{ ansible_host }}"
username: "{{ ansible_user }}"
password: "{{ ansible_ssh_pass }}"
use_templates: True
template_dir: '/home/kbyers/ntc-templates/templates'
If you are going to use ntc-templates, I probably would not have the '| include uptime' in the 'show version'. In other words, let TextFSM convert the output to structured data first and then grab the uptime from that structured data.
I modified inventory_hostname to ansible_host to be consistent with my inventory format (my inventory_hostname doesn't actually resolve in DNS).
I modified username and password to 'ansible_user' and 'ansible_ssh_pass' to be consistent with my inventory and also to be more consistent with Ansible 2.5/2.6 variable naming.
On your above issue, your exception message does not match your playbook (i.e. are you sure that is the exception you get for that playbook).
Here is my inventory file (I simplified this to remove some unnecessary devices and to hide confidential information)
[all:vars]
ansible_connection=local
ansible_python_interpreter=/home/kbyers/VENV/ansible/bin/python
ansible_user=user
ansible_ssh_pass=password
[local]
localhost ansible_connection=local
[cisco]
pynet-rtr1 ansible_host=cisco1.domain.com
pynet-rtr2 ansible_host=cisco2.domain.com

Resources