Docs for connecting to external DB

Need help? Post your questions here.
tobel
Posts: 1
Joined: 16 Dec 2016, 14:58
Has thanked: 0
Been thanked: 0

Docs for connecting to external DB

Unread post by tobel »

Hi Everyone,

I got quite excited when I saw that the "compare" page on the madsonic website (/pages/compare.jsp) mentions that madsonic 6.1.x supports external database support, so I set up an instance of the latest stable 6.1 build (6.1.8700) but

I can't find any documentation that details how to go about connecting to an external DB.

I read the madsonic.sh help and have added the following parameter to my MADSONIC_ARGS: --db=jdbc:postgresql://localhost:5432/madsonic?user=DBUSER&password=MYPASS" but the system doesn't even try to log in to my DB.

I configured postgres with "log_connections = on", and every connection to the DB shows up in my log file, but there is no attempt by the madsonic user.

I've looked through all of the installation docs, and I can't seem to find anything about actually installing into an external DB.

If I've missed something obvious, my humble apologies!

Thanks in advance...
garyo
Posts: 51
Joined: 10 Sep 2015, 01:47
Has thanked: 8 times
Been thanked: 17 times

Re: Docs for connecting to external DB

Unread post by garyo »

I'd like to know this too.
Marbug
Posts: 1
Joined: 08 Dec 2018, 11:54
Has thanked: 0
Been thanked: 0

Re: Docs for connecting to external DB

Unread post by Marbug »

Hi,

I'm using the following package: http://madsonic.org/download/6.2/201612 ... one.tar.gz
Stating version: 6.2.9080

I'm trying to set it up too, I tried with the following option:

Code: Select all

MADSONIC_DB="jdbc:mysql://an_internal_mysql_host:3306/madsonic?user=madsonic&password=xxxxxxxxxxxx&characterEncoding=UTF-8"
MADSONIC_OPTS="--home=${MADSONIC_HOME} --port=${MADSONIC_PORT} --https-port=${MADSONIC_HTTPS_PORT} --pidfile=${PIDFILE} --db=${MADSONIC_DB} --quiet"
Where --db is passed as the following to java:

Code: Select all

-Dmadsonic.db="${MADSONIC_DB}"
but it throws me the following error:
[2018-12-08 10:12:52,389] INFO MySqlDaoHelper - Checking MySQL database schema.
[2018-12-08 10:12:52,768] INFO MySqlSchema01 - Database table 'version' not found. Creating it.
[2018-12-08 10:12:52,779] ERROR MySqlDaoHelper - Failed to initialize database.
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'the_internal_madsonic_host' (using password: YES))
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:382)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:428)
at org.madsonic.dao.schema.mysql.MySqlSchema01.execute(MySqlSchema01.java:44)
at org.madsonic.dao.MySqlDaoHelper.checkDatabase(MySqlDaoHelper.java:78)
at org.madsonic.dao.MySqlDaoHelper.<init>(MySqlDaoHelper.java:48)
at org.madsonic.dao.DaoHelperFactory.create(DaoHelperFactory.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
.....
Caused by: java.sql.SQLException: Access denied for user 'root'@'the_internal_madsonic_host' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:875)
at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1712)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1228)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2253)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2284)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2083)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:806)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:410)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:328)
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
... 74 more
So it seems that the connectionstring is set, but wrong, I'm not connecting with the root user, and the host to where it wants to connect is the host from the VM I'm using and not the one from my configured instance.

I see that there is no reaction on the above, and that it will work with the version that I try.
Post Reply