Here is my patch for sqlbox to take host into account:
Index: gw/sqlbox.c
===================================================================
RCS file: /home/cvs/sqlbox/gw/sqlbox.c,v
retrieving revision 1.2
diff -u -r1.2 sqlbox.c
--- gw/sqlbox.c 30 May 2006 17:52:46 -0000 1.2
+++ gw/sqlbox.c 3 Oct 2007 13:42:58 -0000
@@ -600,7 +600,6 @@
/* some default values */
sqlbox_port_ssl = 0;
- bearerbox_host = octstr_create(BB_DEFAULT_HOST);
bearerbox_port = BB_DEFAULT_SMSBOX_PORT;
bearerbox_port_ssl = 0;
logfile = NULL;
@@ -624,6 +623,10 @@
if (grp == NULL)
panic(0, "No 'sqlbox' group in configuration");
+ bearerbox_host = cfg_get( grp, octstr_imm("bearerbox-host"));
+ if (bearerbox_host == NULL)
+ bearerbox_host = octstr_create(BB_DEFAULT_HOST);
+
sqlbox_id = cfg_get(grp, octstr_imm("smsbox-id"));
global_sender = cfg_get(grp, octstr_imm("global-sender"));
===========================================================
Hope it helps,
Alejandro
On Nov 14, 2007 1:06 PM, seik <[EMAIL PROTECTED]> wrote:
> I am about to do the same for sqlbox_pgsql.c :)
>
> no time so far :/
>
>
>
> -----Original Message-----
> From: Juan Nin [EMAIL PROTECTED]
> Sent: 14 ??????? 2007 ?.
> To: seik
> Subject:sqlbox does not connect to remote MySQL
>
> > mhmhm, I edited gw/sqlbox_mysql.c from the sqlbox source and modified
> > the panic line in the end so the code is like here below, and the DB
> > params are shown ok
>
>
> > /*
> > * ok, ready to connect to MySQL
> > */
> > db_conf = gw_malloc(sizeof(DBConf));
> > gw_assert(db_conf != NULL);
>
> > db_conf->mysql = gw_malloc(sizeof(MySQLConf));
> > gw_assert(db_conf->mysql != NULL);
>
> > db_conf->mysql->host = mysql_host;
> > db_conf->mysql->username = mysql_user;
> > db_conf->mysql->password = mysql_pass;
> > db_conf->mysql->database = mysql_db;
> > if (have_port) {
> > db_conf->mysql->port = mysql_port;
> > }
>
> > pool = dbpool_create(DBPOOL_MYSQL, db_conf, pool_size);
> > gw_assert(pool != NULL);
>
> > /*
> > * XXX should a failing connect throw panic?!
> > */
> > if (dbpool_conn_count(pool) == 0)
> > panic(0,"SQLBOX: MySQL: database pool has no connections! host
> > '%s' user '%s' pass '%s' db '%s'", octstr_get_cstr(mysql_host),
> > octstr_get_cstr(mysql_user), octstr_get_cstr(mysql_pass),
> > octstr_get_cstr(mysql_db));
> > //panic(0,"SQLBOX: MySQL: database pool has no connections!");
>
>
>
> > On Nov 14, 2007 12:41 PM, seik <[EMAIL PROTECTED]> wrote:
> >> Err,
> >> i think its the same issue as the one with the bearerbox host :/
> >>
> >>
> >>
> >> -----Original Message-----
> >> From: Juan Nin [EMAIL PROTECTED]
> >> Sent: 14 ??????? 2007 ?.
> >> To: seik
> >> Subject:sqlbox does not connect to remote MySQL
> >>
> >>
> >> > Hi!
> >>
> >> > I'm trying sqlbox, and I can't get it to connect to a remote MySQL
> server...
> >> > It's really strange...
> >>
> >> > I got "dlr-storage = mysql" with the same settings and it connects
> >> > fine, but sqlbox does not...
> >> > if I run a local MySQ, using localhost it works fine, but not with a
> >> > remote one...
> >>
> >> > Here's the error I get:
> >>
> >> > 2007-11-14 08:58:06 [18604] [0] INFO: Added logfile
> >> > `/var/log/kannel/sqlbox.log' with level `0'.
> >> > 2007-11-14 08:58:06 [18604] [0] ERROR: MYSQL: can not connect to
> database!
> >> > 2007-11-14 08:58:06 [18604] [0] ERROR: MYSQL: Can't connect to MySQL
> >> > server on '10.10.10.2' (111)
> >> > 2007-11-14 08:58:06 [18604] [0] PANIC: SQLBOX: MySQL: database pool
> >> > has no connections!
> >> > 2007-11-14 08:58:06 [18604] [0] PANIC:
> >> > /usr/local/kannel/sbin/sqlbox(gw_panic+0x15b) [0x4248ab]
> >> > 2007-11-14 08:58:06 [18604] [0] PANIC:
> >> > /usr/local/kannel/sbin/sqlbox(sqlbox_init_mysql+0x34f) [0x40afdf]
> >> > 2007-11-14 08:58:06 [18604] [0] PANIC:
> >> > /usr/local/kannel/sbin/sqlbox(sqlbox_init_sql+0xb) [0x40bfbb]
> >> > 2007-11-14 08:58:06 [18604] [0] PANIC:
> >> > /usr/local/kannel/sbin/sqlbox(main+0x31f) [0x409dcf]
> >> > 2007-11-14 08:58:06 [18604] [0] PANIC:
> >> > /lib64/libc.so.6(__libc_start_main+0xf4) [0x3460c1d8a4]
> >> > 2007-11-14 08:58:06 [18604] [0] PANIC: /usr/local/kannel/sbin/sqlbox
> [0x4099a9]
> >>
> >> > Here's the conf:
> >>
> >> > group = sqlbox
> >> > id = sqlbox-db
> >> > smsbox-id = smsbox
> >> > bearerbox-host = localhost
> >> > bearerbox-port = 13001
> >> > smsbox-port = 13005
> >> > smsbox-port-ssl = false
> >> > sql-log-table = sent_sms
> >> > sql-insert-table = send_sms
> >> > log-file = "/var/log/kannel/sqlbox.log"
> >> > log-level = 0
> >>
> >> > group = mysql-connection
> >> > id = sqlbox-db
> >> > host = 10.10.10.2
> >> > username = myUser
> >> > password = myPass
> >> > database = kannel
> >> > max-connections = 1
> >>
> >> > And this is the conf for DLR which works fine:
> >>
> >> > group = mysql-connection
> >> > id = mydlr
> >> > host = 10.10.10.2
> >> > username = myUser
> >> > password = myPass
> >> > database = kannel
> >> > max-connections = 1
> >>
> >> > I even ran a tcpdump on the DB server, and I don't see packets
> >> > arriving for the sqlbox connection...
> >> > any ideas???
> >>
> >> > Thanks in advance,
> >>
> >> > Juan
> >>
> >> > PS: obviously connecting from the kannel host to the remote one via
> >> > console works (same info as for DLRs which connects ok)
> >>
> >>
> >>
>
>
>
>
--
Alejandro Guerrieri
Magicom
http://www.magicom-bcn.net/
LinkedIn: http://www.linkedin.com/in/aguerrieri