Connection refused - connect(2) rails - solr

I copied a source code from github, and then I install ruby,rails,mysql...,which are necessary!
this is the config/database.yml :
common: &common
adapter: mysql2
encoding: utf8
reconnect: true
# socket: /var/run/mysqld/mysqld.sock
common settings for any development databases
devel_common: &dev
host: localhost
username: root
password: wjn_123
common settings for all test databases
tst_common: &tst
host: localhost
username: root
password: wjn_123
common settings for all integration databases
int_common: &remote
host: localhost
username: root
password: wjn_123
.......
then I execute "rake eol:db:recreate RAILS_ENV=development" and there is no exception.but when I execute "rake eol:db:populate" and it gives me this :
Rebuilding BHL ...
Error accessing http:// localhost :8983/solr/bhl/update
"Connection refused - connect(2)"
.....
rake aborted!
Connection refused - connect(2)
/usr/local/rvm/gems/ruby-1.9.3-p392#upgrade/gems/webmock-1.8.11/lib/webmock/http_lib_adapters/net_http.rb:98:in request'
/usr/local/rvm/gems/ruby-1.9.3-p392#upgrade/gems/webmock-1.8.11/lib/webmock/http_lib_adapters/net_http.rb:116:instart_without_connect'
/usr/local/rvm/gems/ruby-1.9.3-p392#upgrade/gems/webmock-1.8.11/lib/webmock/http_lib_adapters/net_http.rb:131:in `start'
so how can I solve the problem .
and I did not install jdk/jre . is that the reason?

Do you think it might have anything to do with the issue mentioned by Houen in http://railscasts.com/episodes/278-search-with-sunspot?view=comments ?

Related

strapi Error connecting to the atlas Mongo database

I want to use mongo atlas with strapi. SO I am reading the values from .env
these are the settings
connections: {
default: {
connector: 'mongoose',
settings: {
host: env('DB_MONGO_URL', '127.0.0.1'),
srv: env.bool('DATABASE_SRV', false),
port: env.int('DB_PORT', 27017),
database: env('DATABASE_NAME', 'mydb'),
username: env('DB_USER_NAME', null),
password: env('DB_PASSWORD', null)
},
options: {
authenticationDatabase: env('AUTHENTICATION_DATABASE', null),
ssl: env.bool('DB_SSL_ENABLE', false),
},
},
and here are the values
DB_MONGO_URL=myproject.random.mongodb.net/mydbt?ssl_cert_reqs=CERT_NONE
DB_USER_NAME=myuser
DB_PASSWORD=mypasswor
but this is showing
[2021-10-12T13:18:25.485Z] debug ⛔️ Server wasn't able to start properly.
[2021-10-12T13:18:25.490Z] error Error connecting to the Mongo database. Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/
error Command failed with exit code 1.
In network i have allowed, 0.0.0.0 that includes any IP address.
If i pass this url in MongoDB Compass
mongodb+srv://myproject.random.mongodb.net/mydbt?ssl_cert_reqs=CERT_NONE
then this works
I tried the same as well
DB_MONGO_URL=mongodb+srv://myproject.random.mongodb.net/mydbt?ssl_cert_reqs=CERT_NONE
DB_USER_NAME=myuser
DB_PASSWORD=mypassword
but this shows
[2021-10-13T06:59:01.372Z] debug ⛔️ Server wasn't able to start properly.
[2021-10-13T06:59:01.374Z] error Error connecting to the Mongo database. getaddrinfo ENOTFOUND mongodb+srv
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
If i tried enable srv true
[2021-10-13T07:01:20.065Z] debug ⛔️ Server wasn't able to start properly.
[2021-10-13T07:01:20.067Z] error Error connecting to the Mongo database. URI does not have hostname, domain name and tld
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
how can i solve this?

How can I connect SQL Server with ORM Doctrine on my symfony project?

doctrine:
dbal:
# configure these for your database server
driver: 'pdo_mysql'
server_version: '5.7'
charset: utf8mb4
host: 127.0.0.1
port: 8889
user: '%env(DATABASE_USER)%'
password: '%env(DATABASE_PWD)%'
dbname: '%env(DATABASE_NAME)%'
# With Symfony 3.3, remove the `resolve:` prefix
# url: '%env(resolve:DATABASE_URL)%'
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
mappings:
App:
is_bundle: false
type: yml
dir: '%kernel.project_dir%/config/doctrine'
prefix: 'App\Entity'
alias: App
You need to use driver pdo_sqlsrv or sqlsrv, not pdo_mysql.
(See doctrine configuration documentation).
pdo_sqlsrv: A Microsoft SQL Server driver that uses pdo_sqlsrv PDO
sqlsrv: A Microsoft SQL Server driver that uses the sqlsrv PHP
extension.
Available configuration for pdo_sqlsrv/sqlsrv are:
user (string): Username to use when connecting to the database.
password (string): Password to use when connecting to the database.
host (string): Hostname of the database to connect to.
port (integer): Port of the database to connect to.
dbname (string): Name of the database/schema to connect to.
The documentation says that:
The following drivers support automatic database platform detection
out of the box without any extra configuration required:
pdo_mysql
mysqli
pdo_pgsql
pdo_sqlsrv
sqlsrv
So you dont need to specify server_version.
You would have:
doctrine:
dbal:
# configure these for your database server
driver: 'pdo_sqlsrv'
charset: utf8mb4
host: 127.0.0.1
port: 8889
user: '%env(DATABASE_USER)%'
password: '%env(DATABASE_PWD)%'
dbname: '%env(DATABASE_NAME)%'
# With Symfony 3.3, remove the `resolve:` prefix
# url: '%env(resolve:DATABASE_URL)%'
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
mappings:
App:
is_bundle: false
type: yml
dir: '%kernel.project_dir%/config/doctrine'
prefix: 'App\Entity'
alias: App

Symfony 2 SQLSTATE Connection refused

I have a problem with connecting my database online.
My site is hosted on one server, and connects to a remote database that is on another server.
But it sends me the following error:
SQLSTATE [HY000] [2002] Connection refused Error
I did, however, put the exact connection information .. I do not understand why the connection is refused ..
parameters.yml:
parameters:
database_host: **.**.**.**
database_port: 3306
database_name: zip
database_driver: pdo_mysql
database_user: root
database_password: null
mailer_transport: smtp
mailer_host:
mailer_user:
mailer_password:
secret: d87fdb6ecf4089df33360b187388e33c34e12f85
I thank you in advance
Make sure the user/password are the right ones. You can use the mysql command line cli to try to connect.

How to solve this SQLSTATE[HY000] [2002] no connection could be made because the target machine actively refused it

I am trying to follow an e-commerce tutorial where I have to create the connection with the database. I am on windows 7 with xampp v3.2.
So I use this : php bin/console generate:doctrine:entity
which gives me this error :
SQLSTATE[HY000] [2002] no connection could be made because the target
machine actively refused it
I closed xampp and I still had the same error. So I understand it comes from the configuration; somehow my shell doesn't communicate with my sql server from xampp.
here is my parameters.yml :
# This file is auto-generated during the composer install
parameters:
database_host: localhost
database_port: 3306
database_name: market
database_user: sebastian
database_password:
mailer_transport: smtp
mailer_host: localhost
mailer_user: null
mailer_password: null
secret:
and here my config.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
- { resource: "#EcommerceBundle/Resources/config/services.yml" }
# Put parameters here that don't need to change on each machine where the app is deployed
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
locale: en
framework:
#esi: ~
#translator: { fallbacks: ["%locale%"] }
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
#serializer: { enable_annotations: true }
templating:
engines: ['twig']
default_locale: "%locale%"
trusted_hosts: ~
trusted_proxies: ~
session:
# http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
handler_id: session.handler.native_file
save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
fragments: ~
http_method_override: true
assets: ~
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
# Doctrine Configuration
doctrine:
dbal:
driver: pdo_mysql
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
# if using pdo_sqlite as your database driver:
# 1. add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# 2. Uncomment database_path in parameters.yml.dist
# 3. Uncomment next line:
# path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
I checked for the extension php_pdo_mysql.dl and it is enabled.
I verified the database name, user and password.
here is a netstat :
netstat
Make sure that your MySQL server is running and that it's using that port (in xampp\mysql\bin\my.ini). Make sure that you're able to connect manually with those credentials as well.
Also, where are you specifying the database driver in your parameters.yml? Normally you should have something like this:
database_driver: pdo_mysql
And lastly, make sure that you don't have a different parameters.yml file included in your config_dev.yml because Symfony commands, by default, use the dev environment.
thank you for your answer.
I have in my.ini 3306 port so it is the good one. I have intalled symfony2.8 and it is working so there is no credentials problems. I also tried to add the line with pdo_mysql but the error message is an pdo_exception, that means pdo works as well.
I also check config.dev but I don't really know what can be wrong inside. So I show you what it looks like :
imports:
- { resource: config.yml }
framework:
router:
resource: "%kernel.root_dir%/config/routing_dev.yml"
strict_requirements: true
profiler: { only_exceptions: false }
web_profiler:
toolbar: true
intercept_redirects: false
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: [!event]
console:
type: console
channels: [!event, !doctrine]
# uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration
#firephp:
# type: firephp
# level: info
#chromephp:
# type: chromephp
# level: info
#swiftmailer:
# delivery_address: me#example.com
thank for your help
i cant connect to mysql on xamppp
install mysql 8 on my system on port 3307
and its worked great with laravel.
if you want please install mysql workbench (instead of phpmyadmin)

Error setting multiple db symfony 2.5

i'm trying to set 2 databases to my symfony 2.5 project, but got this error:
Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exception\InvalidArgumentException' with message 'The service definition "doctrine.dbal.default_connection" does not exist.' \services\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Compiler\ReplaceAliasByActualDefinitionPass.php on line 48
Symfony\Component\DependencyInjection\Exception\InvalidArgumentException: The service definition "doctrine.dbal.default_connection" does not exist. in services\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\ContainerBuilder.php on line 867
Symfony\Component\DependencyInjection\Exception\InvalidArgumentException: Unable to replace alias "doctrine.dbal.default_connection" with "database_connection"
Here is my doctrine definition config.yml
doctrine:
dbal:
default_connection: default
connections:
default:
driver: pdo_mysql
host: localhost
port: ~
name: db1
user: root
password: ~
log:
driver: pdo_mysql
host: localhost
port: ~
name: db2
user: root
password: ~
Any suggestion?
The error message Unable to replace aliaswhen fidling with multiple databases hints to a typo in your configuration.
Double check your configuration using this reference: http://symfony.com/doc/current/cookbook/doctrine/multiple_entity_managers.html

Resources