[prev in list] [next in list] [prev in thread] [next in thread]
List: squid-dev
Subject: Re:Re:Re: UNABLE TO CONNECT TO MYSQL SERVER
From: Biswajit Paul <biswajit () cair ! res ! in>
Date: 2004-03-16 8:31:27
Message-ID: Pine.GSO.4.33.0403161341260.8236-100000 () aditi ! cair ! res ! in
[Download RAW message or body]
On Mon, 15 Mar 2004, Biswajit Paul wrote:
> Yah !! It only works fine when SQUID runs in
> NON DAEMON Mode.
>
> I do not think MySQL functions assumes there is
> a terminal. I used them in other applications which
> runs in Daemon Mode, it worked fine.
>
> CAN U FIGURE OUT THE CAUSE NOW ??
No, and I have never in the 20 years of programming I have done seen such
symptoms unless one is calling a function which requires a terminal.
Regards
Henrik
HELLO HENRIK,
Surprising for me too. Can you do one favour for me.
U plz try my code in your setup.Lets find whats happens ...
Regards
Biswajit
"
MY CODE :
------------- src/access_log.c ----------------------
/* global variable */
static MYSQL mysql;
static void accessLogSquid(AccessLogEntry * al){
.
.
.
/* Logging to MYSql Database */
mysql_CONNECT();
.
.
.
mysql_close(&mysql);
}
int mysql_CONNECT(){
char host[20];
char db[6]="SQUID";
char usedb[10]="USE SQUID";
gethostname(host,20);
mysql_init(&mysql);
mysql_options(&mysql,MYSQL_READ_DEFAULT_GROUP,"squid");
if(!mysql_real_connect(&mysql,"","","",db,0,NULL,0)){
if(!mysql_real_connect(&mysql,host,"","",db,0,NULL,0)){
debug(1, 1) ("\n Error: %s\n",mysql_error(&mysql));
mysql_close(&mysql);
return 0;
}
}
if(mysql_query(&mysql,usedb)){
debug(1, 1) ("\n Error: %s\n",mysql_error(&mysql));
mysql_close(&mysql);
return(0);
}
return 0;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic