hi,
when i try to call the mysql_init function it is not getting initilized properly.
can someone help me
thanks
chinmay 1 3075 sh*********@gma il.com (Chinmay Shah) wrote in message news:<d9******* *************** ****@posting.go ogle.com>... hi, can someone help me pleaseeeeee?
i am attempting to connect mysql server to win32 application... as far
as initialization is concerned, it is successful but its showing some
problem when i use mysql_real_conn ect..... have used different
combinations to try and connect but all are unsuccessful... here is
the code which i have written.... is there any mistake in the code...
do let me know??????
the code is:
#include<winsoc k.h>
#include<my_glo bal.h>
#include<mysql. h>
#include<window s.h>
#include<window sx.h>
void ConnectToMySql( )
{
MYSQL mysql;
char *mysql_host = "localhost" ;
char *mysql_user = "root";
char *mysql_pass = "";
char *mysql_db = "test";
int mysql_port = 3306;
int mysql_flag = 0;
char *mysql_unix = NULL;
//Allocates or initializes a MYSQL object
if(mysql_init(& mysql))
MessageBox(g_hW nd,"Initializat ion Successful","Te sting",0);
else
MessageBox(g_hW nd,"Initializat ion Not Successful","Te sting",0);
//attempts to establish a connection to a MySQL database engine
running on host
if(!mysql_real_ connect
(&mysql,MYSQL_H OST,MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB,MYSQL_ PORT,MYSQL_SOCK ET,MYSQL_FLAG))
MessageBox(g_hW nd,"Connection 1 Not Successful","Te st",0);
if(!mysql_real_ connect(&mysql, mysql_host,mysq l_user,mysql_pa ss,mysql_db,mys ql_port,mysql_u nix,mysql_flag) )
MessageBox(g_hW nd,"Connection 2 Not Successful","Te st",0);
if(!mysql_real_ connect(&mysql, "localhost","ro ot","","test",3 306,NULL,0))
MessageBox(g_hW nd,"Connection 3 Not Successful","Te st",0);
if(!mysql_real_ connect(&mysql, "localhost","", "","",0,NULL,0) )
MessageBox(g_hW nd,"Connection 4 Not Successful","Te st",0);
if(!mysql_real_ connect(&mysql, "localhost","ro ot","","test",0 ,NULL,0))
MessageBox(g_hW nd,"Connection 5 Not Successful","Te st",0);
if(!mysql_real_ connect(&mysql, "","","","",0,N ULL,0))
MessageBox(g_hW nd,"Connection 6 Not Successful","Te st",0);
if(!mysql_real_ connect(&mysql, "localhost","ro ot","","",0,NUL L,0))
MessageBox(g_hW nd,"Connection 7 Not Successful","Te st",0);
}
do let me at the earliest...
thanks chinmay This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Vinay Aggarwal |
last post by:
I have been thinking about the lazy initialization and double checked
locking problem. This problem is explain in detail here
http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html
I am not fully convinced that this problem cannot be
solved. I am going to propose a solution here. For the sake of
discussion I will post my solution here. It is possible that the
proposed solution does not work, feedback and comments are...
|
by: Russell Silva |
last post by:
I have a class A with a member variable type vector<foo> which is
initialized upon construction (no standard () constructor):
class A {
protected:
vector<foo> foo_vector;
public:
A(const vector<foo>& init_foo_vector);
}
|
by: DanielBradley |
last post by:
Hello all,
I have recently been porting code from Linux to cygwin and came across
a problem with static const class members (discussed below). I am
seeking to determine whether I am programming non-standard C++ or if the
problem lies elsewhere.
To summarize static const class members are not being accessed properly
when accessed from a DLL by another external object file (not within the
DLL). It only occurs when the static const...
|
by: JKop |
last post by:
What's the difference between them?
Take the following:
#include <iostream>
struct Blah
{
int k;
|
by: Anton Pervukhin |
last post by:
Hi everybody!
I have a small problem regarding the initialization of pointer to the
file stream under some conditions.
Imagine a class which has a pointer to output file stream and some
additinional methods to deal with it, i.e. open/close/write:
classA {
private:
const std::auto_ptr<std::ofstream> filePtr;
| |
by: Luke Meyers |
last post by:
Lately I find myself increasingly preferring the practice of going
ever-so-slightly out of my way to avoid the use of the form of
initialization which uses the '=' symbol, on the grounds that it can be
mistaken too easily for assignment. I like the avoidance of mistakes.
I like even more the frequent, subtle reinforcement (for myself and my
colleagues) of the point that assignment and initialization are
entirely different operations.
...
|
by: Jesper Schmidt |
last post by:
When does CLR performs initialization of static variables in a class
library?
(1) when the class library is loaded
(2) when a static variable is first referenced
(3) when...
It seems that (1) holds for unmanaged C++ code, but not for managed
code. I have class library with both managed and unmanaged static
variables that are not referenced by any part of the program. All the
|
by: Steve Folly |
last post by:
Hi,
I had a problem in my code recently which turned out to be the 'the "static
initialization order fiasco"' problem
(<http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.12>)
The FAQ section describes a solution using methods returning references to
static objects.
But consider:
|
by: subramanian100in |
last post by:
Suppose we have a class named Test.
Test obj; // assuming default ctor is available
Test direct_init(obj); // direct initialization happens here
Test copy_init = obj; // copy initialization happens here
Suppose we have a function
void fn(Test arg);
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |