Asterisk res_config_mysql module is missing - mysql

I have installed asterisk latest package and using mysql DB for realtime simulation. But in the CLI i am getting the error:
config.c:2444 find_engine: Realtime mapping for 'sippeers' found to engine 'mysql', but the engine is not available
and while executing command MODULE LOAD RES_CONFIG_MYSQL i am getting the following message.
loader.c:918 load_resource: Module 'RES_CONFIG_MYSQL' could not be loaded.
My machine is with linux mint 16. 64 bit.

If you have version <1.4 you have download asterisk-addons and compile it too
Otherwise you have do
make menuconfig
before make and select mysql addon

Related

How to add a JDBC driver to a Jenkins pipeline?

I want to create a database within a pipeline script to be used by the deployed app. But first I started testing the connection. I got this problem:
java.sql.SQLException: No suitable driver found for jdbc:mysql://mysql:3306/test_db
I have the database plugin and the MySQL database plugin installed.
How do I get the JDBC driver?
import groovy.sql.Sql
node{
def sql = Sql.newInstance("jdbc:mysql://mysql:3306/test_db", "user","passwd", "com.mysql.jdbc.Driver")
def rows = sql.execute "select count(*) from test_table;"
echo rows.dump()
}
Update after albciff answer:
My versions of:
Jenkins = 2.19.1
Database plugin = 1.5
Mysql database plugin = 1.1
The latest test script.
import groovy.sql.Sql
Class.forName("com.mysql.jdbc.Driver")
Which throws:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
From the MySQL DataBase Plugin documentation you can see that jdbc drivers for MySQL are included:
Note that MySQL JDBC driver is under GPLv2 with FOSS exception. This
plugin by itself qualifies under the FOSS exception, but if you are
redistributing this plugin, please do check the license terms.
Drizzle(+MySQL) Database Plugin is available as an alternative to this
plugin, and that one is under the BSD license.
More concretely the actual last version (1.1) for this plugin contains connector version 5.1.38:
Version 1.1 (May 21, 2016) mysql-connector version 5.1.38
So probably in order to have the driver available you have to force the driver to be registered.
To do so use Class.forName("com.mysql.jdbc.Driver") before instantiate the connection in your code:
import groovy.sql.Sql
node{
Class.forName("com.mysql.jdbc.Driver")
def sql = Sql.newInstance("jdbc:mysql://mysql:3306/test_db", "user","passwd", "com.mysql.jdbc.Driver")
def rows = sql.execute "select count(*) from test_table;"
echo rows.dump()
}
UPDATE:
In order to has the JDBC connector classes available in the Jenkins pipeline groovy scripts you need to update the DataBase plugin to last currently version:
Version 1.5 (May 30, 2016) Pipeline Support
You can simply add the java connector in the java class path.
If jenkins is running java < 9 you probably will find the right place inside something like that:
<java_home>/jre/lib/ext
If jenkins is running java >= 9 you probably will find the right place inside something like that:
/usr/share/jenkins/jenkins.war
To find your paths you can check:
http://your.jenkins.host/systemInfo (or navigate system info path by GUI) and search for java.ext.dirs or java.class.path
http://your.jenkins.host/script (running console script such as System.getProperty("java.ext.dirs") or System.getProperty("java.class.path"))
This snippet can help you with the jenkins.war thing when running inside docker:
#adding extra jars to default jenkins java classpath (/usr/share/jenkins/jenkins.war)
RUN sudo mkdir -p /usr/share/jenkins/WEB-INF/lib/
RUN whereis jar #just to find full jar command classpath to use with sudo
COPY ./jar-ext/groovy/mysql-connector-java-8.0.21.jar /usr/share/jenkins/WEB-INF/lib/
RUN cd /usr/share/jenkins && sudo /opt/java/openjdk/bin/jar -uvf jenkins.war ./WEB-INF/lib/mysql-connector-java-8.0.21.jar
For Jenkins running on Java >= 9 add the jdbc drivers under ${JENKINS_HOME}/war/WEB-INF/lib and under the --webroot directory.

version node not found for symbol mysql_select_db#libmysqlclient_16

I was trying to build my app on linux using mysql c api, and got this error at link stage, it's working fine on windows. Please help, thanks!
error message:
/bin/ld: myapp.so : version node not found for symbol mysql_select_db#libmysqlclient_16
/bin/ld: failed to set dynamic section sizes: Bad value
OS: CentOS 7, 64-bit, (VM on virtual box)
Mysql: 5.6.24 (community edition, installed via yum)
.bashrc file
export LIBMYSQL_INCLUDE_DIR=/usr/include/mysql
export LIBMYSQL_LIBRARY=/usr/lib64/mysql
export LD_LIBRARY_PATH=/usr/lib64/mysql:$LD_LIBRARY_PATH
cmake file: (variables are set according to environment variables)
FILE(GLOB SRC_MYAPP myapp/*.c myapp/*.h)
INCLUDE_DIRECTORIES(${LIBMYSQL_INCLUDE_DIR})
ADD_LIBRARY(myapp ${SRC_MYAPP})
IF (MSVC_IDE)
TARGET_LINK_LIBRARIES(myapp ${LIBMYSQL_LIBRARY}/libmysql)
ELSE ()
TARGET_LINK_LIBRARIES(myapp ${LIBMYSQL_LIBRARY}/libmysqlclient_r.a)
ENDIF ()
Put #hank 's comment as answer
I suppose you should add link_directories(/usr/lib64/mysql) before add_library and then target_link_libraries(myapp mysqlclient_r) – hank May 12 at 12:50

xcode: Mysql connector library not work on iphone5 (armv7s) ,any solution?

I built my App using Mysql Connector/C to connect a remote Mysql database, its works fine on the simulator (no errors, no warnings) but when i try to run it on my device (iphone5) i got this error:
No architectures to compile for (ARCHS=armv7 armv7s, VALID_ARCHS=armv7 armv7s)
i tried -as in some answers- to change setting (Architectures - Build Active Architectures- Valid Architectures) but the error still, only when i change the setting (Architectures & Valid Architectures) to "armv6" its build without error but many warnings appears says:
warning: no rule to process file '(my App dir)/main.m' of type sourcecode.c.objc for architecture armv6
and also for all .m files, when i tried to start the App i got message:
Xcode cannot run using selected device
I know that the Connector library need to update , but are there any solution ?
your need compile the connector lib in xcode for iOS (armv6, armv7, armv7s, i386), then use lipo tool to combine output libs.
direct connect your mysql in app is not safe, a suggest way is setup a Apache+PHP+MySQL server, then on iPhone useing ASIHTTPRequest to connect your server.

Win64 compiling package from source: "sorry, unimplemented: 64 bit mode not compiled in"

Trying to install RMySQL on 64-bit Windows 7.
Using R-2.14.2 with Rtools214 and MySQL Server 5.5.
Read through several step-by-steps of RMySQL source installation.
Troubleshooting:
- Copied libmysql.dll to R-2.14.2/bin AND R-2.14.2/bin/i386.
- Copied libmysql.dll and libmysql.lib to MySQL Server 5.5\lib\opt.
- Entered MYSQL_HOME=C:\Program Files\MySQL\MySQL Server 5.5 into Renviron.site, saved to R\R-2.14.2\etc.
My instances of common problems:
Sys.getenv('MySQL_HOME')
[1] "C:\Program Files\MySQL\MySQL Server 5.5\"
install.packages('RMySQL', type = 'source')
Installing package(s) ...
...
RS-DBI.c:1:0: sorry, unimplemented: 64-bit mode not compiled in
make: [RS-DBI.o] Error 1*
ERROR: compilation failed for package 'RMySQL'
...
I'm guessing my problem lies in the '64-bit mode...' message, but I'm not sure.
Thoughts?
I'm not sure this error message has anything to do with RMySQL, or any particular package.
On 64bit Windows, instead of the default PATH :
C:\Rtools\MinGW\bin
( gives the error sorry, unimplemented: 64-bit mode not compiled in )
you might (quite reasonably) notice the MinGW64 directory alongside and try :
C:\Rtools\MinGW64\bin
but in fact it needs to be :
C:\Rtools\gcc-4.6.3\bin
Then of course, stop and start a new DOS window to pick up the new PATH.
I had problems installing RMySQl
so I installed the package RODBC which works fine.
(make sure the MySQL driver is installed).
http://dev.mysql.com/downloads/connector/odbc/

Multiple MySQL queries with Ruby

I'm having troubles with MySQL queries in Ruby. I use 'mysql' gem.
Configuration is stored in a separate yml file and loaded into #conf variable.
This is my code:
# connect to the database
Mysql::new(#conf['sql_host'], #conf['sql_user'], #conf['sql_password'], #conf['sql_base'])
# it's ok when we're doing this
my.query("SELECT * FROM `my_table`") do |e|
# code
end
# Maybe, I've missed something here...
# really this query will insert value into other table, used SELECT just for testing
# this throws exception: 'query: not connected'
my.query("SELECT * FROM `my_table_2`")
Windows XP
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
mysql (2.8.1, 2.7.3)
MySQL client version: 5.0.51a
Second query throws 'query: not connected'.
First of all, your program looks ok. I am 100% sure you have libmysql.dll version problem.
I can reproduce this with libmysql.dll provided from Mysql installer.
Download this file and replace in c:\ruby\bin\
http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll
and re-run your program without any change.
Related issue and credit to here
I have run into immeasurable problems when attempting to use Ruby's mysql gem on any version of Windows. From what I can tell, it simply doesn't work unless you can figure out how to compile it yourself (which is a royal pain in the ass).
Have you considered using ActiveRecord as your ORM (object relational mapping) layer and doing development with SQLite or some other database on Windows and then running the production environment on Linux with MySQL? This is the solution that I took a while back and it worked out quite well.