LDAP Connection Timeout Error(OpenLDAP with Backend MySQL) - mysql

all
I tried to connect to OpenLDAP with Backend MySQL.
It does not work fine when I try to access to OpenLDAP with more than 5 ldap queries per second.LDAP Connection Timeout Error occurred frequently.
My detail environment is as below.
OS
CentOS release 6.10 (Final)
mysql-connector-odbc
mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
unixODBC
unixODBC-2.2.14-14.el6.x86_64
odbcinst.ini
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc5.so
Setup = /usr/lib/libodbcmyS.so
Driver64 = /usr/lib64/libmyodbc5.so
Setup64 = /usr/lib64/libodbcmyS.so
FileUsage = 1
openLDAP
# rpm -qa | grep openldap
openldap-clients-2.4.40-16.el6.x86_64
openldap-2.4.40-16.el6.x86_64
openldap-servers-2.4.40-16.el6.x86_64
openldap-servers-sql-2.4.40-16.el6.x86_64
Backend mysql
MySQL 5.6.34

Related

Connect HANA Express with MySQL via Smart Data Access

I need to connect my HANA Express VM with a MySQL database. What I did so far is:
0.) Registered VM and installed unixODBC (as described in Youtube Playlist)
1.) Downloaded ODBC driver installation files (rpm)
2.) sudo zypper install
3.) myodbc-installer -d -l
4.) cp /etc/unixODBC/odbc.ini ~/.odbc.ini
5.) cp /etc/unixODBC/odbcinst.ini ~/.odbcinst.ini
6.) nano ~/.odbc.ini
[ODBC Data Sources]
ds2 = myodbc5w
ds1 = myodbc5a
Default = Default
[myodbc5w]
Driver = /usr/lib64/libmyodbc5w.so
DATABASE = <sqldb>
DESCRIPTION = MySQL ODBC 5.3 Unicode Driver test
SERVER = <sqlip>
UID = <sqluser>
USER = <sqluser>
PASSWORD = <pw>
[myodbc5a]
Driver = /usr/lib64/libmyodbc5a.so
DATABASE = <sqldb>
DESCRIPTION = MySQL ODBC 5.3 ANSI Driver test
SERVER = <sqlip>
UID = <sqluser>
USER = <sqluser>
PASSWORD = <pw>
[Default]
Driver = /usr/lib64/libmyodbc5a.so
DATABASE = <sqldb>
DESCRIPTION = MySQL ODBC 5.3 ANSI Driver test
SERVER = <sqlip>
UID = <sqluser>
USER = <sqluser>
PASSWORD = <pw>
7.) nano ~/.odbcinst.ini
[MySQL ODBC 5.3 Unicode Driver]
Driver=/usr/lib64/libmyodbc5w.so
UsageCount=1
[MySQL ODBC 5.3 ANSI Driver]
Driver=/usr/lib64/libmyodbc5a.so
UsageCount=1
[Default]
Driver=/usr/lib64/libmyodbc5a.so
UsageCount=1
8.) nano ~/.customer.sh
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64
export ODBCINI=$HOME/.odbc.ini
export ODBCSYSINI=$HOME
9.) Restarted VM
10.) I can successfully connect by calling
isql myodbc5w <user> <pw>
11.) Also this call works
myodbc-installer -d -l
MySQL ODBC 5.3 Unicode Driver
MySQL ODBC 5.3 ANSI Driver
Default
Now my problem and questions:
Why won't also my Smart Data Access access the MySQL (it seems to connect, but can't list the tables)? And what shall I set the "Configuration File" property with? And what's wrong with the odbc / odbcinst files, that only "Default" works?
I adapted the odbc file from an example which was shipped with the ODBC installation...
See screenshot for my SDA settings (only "Default" data source worked for me yet).
I'm working for days now on this problem, any help is appreciated! Thanks!
I resolved the same issue. I installed mariadb connector (not MySQL connector):
https://mariadb.com/kb/en/about-mariadb-connector-odbc/
wget https://downloads.mariadb.com/Connectors/odbc/connector-odbc-3.1.7/mariadb-connector-odbc-3.1.7-ga-rhel7-x86_64.tar.gz
tar -xvzf mariadb-connector-odbc-3.1.7-ga-rhel7-x86_64.tar.gz
cp lib/libmaodbc.so /lib64/
Next, i made an entry for Maria in .odbc.ini
[Maria]
Description = MariaDB 3.1.7 ODBC
Driver = /lib64/libmaodbc.so
SERVER = <your server>
and then:
enter image description here

Why mysql odbc configuration not setup in linux?

I have two systems. my first system is ubuntu 16.04. which, work as remote.
and another is centos 6. which, run in virtually. In centos, freeswitch installed. I have to send data from freeswitch to remote system means ubuntu.
on centos, my configuration of odbc.ini as :
[freeswitch]
DRIVER = /usr/lib64/libodbcmyS.so
SERVER = <ipaddress>
USER = root
PASSWORD = <password>
PORT = 3306
DATABASE = freeswitch
OPTION = 67108864
and odbcinst.int as below:
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib64/libmyodbc.so
Setup = /usr/lib64/libodbcmyS.so
FileUsage = 1
Threading = 0
after setup above code.
I have to check odbc connection. for this, command fire as :
isql -v freeswitch
but, it show error as :
[IM004][unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed
[ISQL]ERROR: Could not SQLConnect
wrong driver description arise this type of error.
I have set proper driver description. wrongly, setup description mention in driver field.
I think you need to change the line
DRIVER = /usr/lib64/libodbcmyS.so
to
DRIVER = MySQL
Thanks.

MySQL does not display during setup of Zabbix

I have issue during Zabbix 2.4-1 installation on ubuntu 14.04.
I used manual from official site, installation was successful, no errors.
Next I created user 'zabbix' with all privileges and database 'zabbix' and imported schema.sql, images.sql and data.sql from Zabbix archive. Then I changed configuration files in /etc/zabbix dir:
zabbix.conf.php
// Zabbix GUI configuration file
global $DB;
// Valid types are MYSQL, SQLITE3 or POSTGRESQL
$DB["TYPE"] = 'MYSQL';
$DB["SERVER"] = 'localhost';
$DB["PORT"] = '3306';
// SQLITE3 use full path to file/database: $DB["DATABASE"] = '/var/lib/zabbix/zabbix.sqlite3';
$DB["DATABASE"] = 'zabbix';
$DB["USER"] = 'zabbix';
$DB["PASSWORD"] = 'root';
// SCHEMA is relevant only for IBM_DB2 database
$DB["SCHEMA"] = '';
$ZBX_SERVER = 'localhost';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = '';
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
zabbix-server-mysql.conf
...
# dbc_dbtype: type of underlying database to use
# this exists primarily to let dbconfig-common know what database
# type to use when a package supports multiple database types.
# don't change this value unless you know for certain that this
# package supports multiple database types
dbc_dbtype='mysql'
# dbc_dbuser: database user
# the name of the user who we will use to connect to the database.
dbc_dbuser='zabbix'
# dbc_dbpass: database user password
# the password to use with the above username when connecting
# to a database, if one is required
dbc_dbpass='root'
...
I start it with apache server. When I go to localhost/zabbix I see Zabbix Installer. On step 3 it's necessary to configure DB connection. So, here is a problem:
As you see, in select list is only PostgreSQL, so, I can't connect to database (mysql server is running) and go to the next step.
Your PHP doesn't support MySQL at the moment. You need to install some php-mysql* package and then restart your webserver.
Your php package for mysql is not there so that it will not show while zabbix setup installation
install php-mysql package to resolve this error
#apt-get install php7.0-mysql
and then restart apache
#systemctl restart apache2
I had the same problem installing Zabbix 4.0 on Ub
So I ran
apt install php libapache2-mod-php php-mysql
sudo service apache2 restart
it works for me

How to connect to ODBC DSN with unixODBC on Zabbix?

I installed unixODBC and MySql ODBC driver, but can not to connect ODBC DNS.
isql -v myodbc_mysql_dsn
I got this error :
Cannot connect to ODBC DSN:
[SQL ERROR]:[IM002][0][[unixODBC][Driver Manager]Data source name not found, and no default driver specified]|
my configration looks like this:
cat /etc/odbc.ini
[myodbc_mysql_dsn]
Description = test
Driver = MySQL5 # custom driver name
Server = localhost # or external IP if needed
Port = 3306 # or custom port if needed
Socket = /var/run/mysqld/mysqld.sock # socket, see above
Database = zabbix # MySQL DB name or empty
Option = 3
ReadOnly = No
cat /etc/odbcinst.ini
[MySQL5]
Description = ODBC for MySQL
Driver = /usr/lib/odbc/libmyodbc5.so
Setup = /usr/lib/odbc/libodbcmyS.so
#Driver = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
#Setup = /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
FileUsage = 1
UsageCount = 2 '
What should I do?
Here are some tips:
Use:
odbcinst -q -s
to see if you driver sees your datasources
Then
odbcinst -j
should show you filepaths to your *.ini

Java (Grails) cannot connect to MySQL remotely nor locally, but MySQL command line can

I have setup many MySQL databases on Windows and Linux, and connected many Java applications to them without issue.
This particular one is driving me insane, I have checked all the usual suspects, and come up blank.
The problem:
I installed MySQL 5.6 on Ubuntu 14. I can connect to it fine from local machine or remote PC via MySQL command line, but I cannot connect my Grails application to the database, neither running in Tomcat on the local server where MySQL is installed, or running in dev mode on my local PC. The Grails app connects fine to my local MySQL running on my PC, but not the one running on Ubuntu.
Ubuntu MySQL configuration:
MySQL 5.6 is installed on Ubuntu 14 via apt-get install mysql-server-5.6
CREATE DATABASE mydb;
create user 'myuser'#'%' identified by 'mypass';
grant all privileges on * . * to 'myuser'#'%';
The bind address is commented out in my.cnf, so it binds to all ips.
service mysql restart.
iptables are not running.
ISP firewall not configured for this server, everything wide open.
Testing connection:
from Local server: "mysql -u myuser -p mydb" - works and can create tables etc.
as above from remote PC running windows via: "mysql -u myuser -p -h x.x.x.x mydb" where x.x.x.x is the IP of my server. Works fine. Can create tables etc.
The above implies that MySQL is running fine, that there are no firewalls or networking issues.
the Grails "DataSource.groovy" configuration
dataSource {
pooled = true
driverClassName = "com.mysql.jdbc.Driver"
dialect = "org.hibernate.dialect.MySQL5InnoDBDialect"
}
environments {
development {
dataSource {
dbCreate = "create-drop"
url = "jdbc:mysql://x.x.x.x:3306/mydb"
username = "myuser"
password = "mypass"
}
}
}
NOTE:
Also tried: url = "jdbc:mysql://x.x.x.x/mydb"
The JDBC jar is: mysql-connector-java-5.1.34.jar
The Java used is: Windows jkd1.7.0_60
The error
Message: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Line | Method
->> 377 | handleNewInstance in com.mysql.jdbc.Util
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1036 | createCommunicationsException in com.mysql.jdbc.SQLError
| 338 | <init> . . . . . . . . . . . in com.mysql.jdbc.MysqlIO
| 2232 | coreConnect in com.mysql.jdbc.ConnectionImpl
Logs:
There is nothing related in the file /var/log/upstart/mysql.log nor var/log/mysql/error.log on the server.
The million dollar question is: Why would MySQL be able to connect, but JDBC not? What is the difference between the way they work (both from local and remote machines)?
This post has the most information about this issue, but I have not found any solution.
Also tried this:
properties {
maxActive = -1
minEvictableIdleTimeMillis=1800000
timeBetweenEvictionRunsMillis=1800000
numTestsPerEvictionRun=3
testOnBorrow=true
testWhileIdle=true
testOnReturn=true
validationQuery="SELECT 1"
}
Running the Grails war on Tomcat on the same server as the DB
I have more or less the same error, but different Java, different OS, different connection method.
Tomcat7 /var/lib/tomcat7/conf/context.xml
<Resource name="myresource" auth="Container" type="javax.sql.DataSource"
maxActive="50" maxIdle="5" maxWait="10000"
username="myuser" password="mypass" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/mydb"/>
Grails configuration
environments {
production {
dataSource {
dbCreate = "update"
jndiName = "java:comp/env/myresource"
pooled = true
driverClassName = "com.mysql.jdbc.Driver"
dialect = "org.hibernate.dialect.MySQL5InnoDBDialect"
properties {
maxActive = -1
minEvictableIdleTimeMillis=1800000
timeBetweenEvictionRunsMillis=1800000
numTestsPerEvictionRun=3
testOnBorrow=true
testWhileIdle=true
testOnReturn=true
validationQuery="SELECT 1"
}
}
}
}
The error in /var/log/tomcat7/catalina.out
2015-01-16 23:18:41,425 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool.
java.sql.SQLException: Driver:com.mysql.jdbc.Driver#52fc036d returned null for URL:jdbc:h2:mem:grailsDB;MVCC=TRUE;LOCK_TIMEOUT=10000
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:296)
at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)
Interestingly, the above mentions h2:mem db, but I think this is only a red-herring, its perhaps trying that after trying to connect to the MySQL db. There is no mention of h2 db anywhere in the DataSource.groovy file.
NOTE:
Java on the server (same as MySQL server) is OpenJDK, not Oracle's:
# apt-get install openjdk-7-jre-headless
# java -version
java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.3) (7u71-2.5.3-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)
JDBC (don't know how to verify the version)
# apt-get install libmysql-java
# cp /usr/share/java/mysql.jar /usr/share/tomcat7/lib
I have tried the following bind options in my.cnf (separately, with restart)
bind-address = 127.0.0.1
bind-address = x.x.x.x (i.e. my servers external fixed ip)
bind-address = 0.0.0.0
# bind-address = 127.0.0.1
all give the same error. On a dev server, I generally leave it with the bind-address commented out, so it listens on all interfaces.
I also checked that:
TOMCAT7_SECURITY=no
in /etc/init.d/tomcat7
I've bumped into a similar issue.
Just to clarify line in the reported error log:
URL:jdbc:h2:mem:grailsDB;MVCC=TRUE;LOCK_TIMEOUT=10000
This DB connection URL seems to be DataSource's default one which is used when you don't specify any valid URL in your custom DataSource. This means, when you see this URL in the log, you haven't specified any valid URL for your DB.
I was facing the same issue.
I upgraded the the MySql dependency version and driver class name as below:
FROM:
mysql:mysql-connector-java:5.1.36
com.mysql.jdbc.Driver
TO:
mysql:mysql-connector-java:8.0.18
com.mysql.cj.jdbc.Driver