U++ framework
Do not panic. Ask here before giving up.

Home » Community » Newbie corner » mySql - how to use - what is needed?
Re: mySql - how to use - what is needed? [message #34699 is a reply to message #34681] Tue, 06 December 2011 19:31 Go to previous messageGo to previous message
BioBytes is currently offline  BioBytes
Messages: 312
Registered: October 2008
Location: France
Senior Member
Hi Wolfgang,

I have an application used where I am working in IRL and I pass only the IP adress of the server where the MySql (version 5.5) is installed. The application has been developped with U++ and connection is done using native MySql. Hereafter is the code snippet for your information. Server identifier contains the IP (193.xxx.xxx.xx) of the Win Server. "dbrisks" is the name of the MySql database.

if(rmSession.Connect(cnxStr.At(3),cnxStr.At(4),"dbrisks",server,ScanInt(cnxStr.At(2),NULL,10))){
SQL = rmSession;
SQL *Select(SqlCountRows()).From(TBLUSERS).Where(IDENTIFIER==cnx Str.At(3));

while(SQL.Fetch())
if(SQL[0]!=0)
{
SetLogonInUse(cnxStr.At(3));
msgStatusBar<<cnxStr.At(3);
msgStatusBar<<t_(" connecté");

rmImageDisplay.setConnectionStatus(true);
rmStatusBar.Set(0,msgStatusBar,200);
rmMenuBar.Set(THISBACK1(SetMainMenu,true));
}
else Exclamation("[*A2@5 "+DeQtfLf(t_("Cet utilisateur n'existe pas !.'\n'Il faut le créer."))+"]");
}
else {
errorMessage<<t_("ERREUR SQL: ")<<'\n'<<t_("Impossible d'établir une connexion au serveur !")<<'\n'<<t_("L'application va être fermée par sécurité");
PanicMessageBox(t_("Erreur connexion"),errorMessage);
Close();
}
}

cnxStr.Clear();
}


Native connection is preferable to ODBC socket when database begin to contain a lot of records. Definitively it is better to use it in production.

if you need more information or help do not hesitate to ask Razz .

Regards

Biobytes
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: CanClose? Mechanism to prompt user to save edits
Next Topic: New class
Goto Forum:
  


Current Time: Tue Oct 06 19:45:29 GMT+2 2026

Total time taken to generate the page: 0.16041 seconds