List:General Discussion« Previous MessageNext Message »
From:Patrick Sherrill Date:December 31 2003 2:01pm
Subject:Re: COBOL Syntax of calling MySQL's C API
View as plain text  
Arun,

Please reply to the list so all may help/benefit from your question.

The mysql server program/daemon must be running on the server prior to any
client access.
If you are able to access the mysql server from any client than the server
is running.

For example if your linux server's resolvable domain name is
'mylinuxbox.generic.com', then mysqld must be running on
mylinuxbox.generic.com before any mysql client can connect.

If you can connect from another client program, but not your COBOL program,
then you need to look at how your COBOL program treats the data types passed
to your 'C' call.  As I mention previously, after confirming data types
being passed you need to pass NULL, not '0' as the unix_socket.  NULL is not
zero.

Normally the error you are reporting indicates the server is not running or
not accepting connections.

Check your parameters and data types for mysql_real_connect and ensure the
server you are attempting to connect to is in fact running and accepting
connections.

Also don't forget to reply to the list.

Pat...


----- Original Message ----- 
From: "Arunachalam" <arunchp@stripped>
To: "Patrick Sherrill" <patrick@stripped>
Sent: Wednesday, December 31, 2003 4:22 AM
Subject: Re: COBOL Syntax of calling MySQL's C API


> hi,
>
> >From COBOL I have tried to Connect to MySQL using the C API functions
given by MySQL. Finally I
> struck up with the error during runtime as "Can't connect to MySQL server
on localhost (10061)"
>
> I have a doubt Is, we have to start explicitly MySQL in the server
machine?  i.e., mysqld.
>
> If so with out start the mysqld in the server I can able to connect to the
server using MySQLCC,
> is an utility tool provided by MySQL and MySQLExplorer is a free utility
tool provided by
> ToolMagic softwares. More than this I can able to connect to MySQL server
and fetch the data using
> simple C++ program using C API of MySQL. I believe, no one do start the
MySQL in my server.
>
> I am running my application in Windows2000 machine (client), myserver is
at Linux machine
> (server).
>
> So what I can to do?.
>
> Arun.
>
>  --- Patrick Sherrill <patrick@stripped> wrote: > Being COBOL
illiterate, I may not be able to
> help.
> >
> > Two questions come to mind in reviewing the parameters you are passing.
> >
> > Are the parameters by reference passed as char-like pointers and the
> > parameters by content passed as integers? If they are, then the only
issue I
> > see as a possibility is that 'fMySQLSocket'  should be passed as NULL
not 0.
> >
> > Also make sure mysqld is running on 'myserver'.
> >
> > I hope this helps...
> >
> > Pat...
> >
> >
> > BTW replies to the list usually yield better results.
> > ================================================
> >
> > ----- Original Message ----- 
> > From: "Arunachalam" <arunchp@stripped>
> > To: "Patrick Sherrill" <patrick@stripped>
> > Sent: Tuesday, December 30, 2003 8:44 AM
> > Subject: COBOL Syntax of calling MySQL's C API
> >
> >
> > > Hello Patrick,
> > >
> > > The actual calling routines in C is;
> > >
> > > MYSQL *mysql_real_connect(MYSQL *mysql,
> > > const char *host,
> > > const char *user,
> > > const char *passwd,
> > > const char *db,
> > > unsigned int port,
> > > const char *unix_socket,
> > > unsigned long client_flag)
> > >
> > > I have declared the variables with values are;
> > >
> > > 05 C-cMySQLHostName      pic  x(9).
> > >               88 fMySQLHostName         value 'myserver'.
> > > 05 C-cMySQLUserId        pic  x(4).
> > >               88 fMySQLUserId           value 'arun'.
> > > 05 C-cMySQLPassword      pic  x(4).
> > >               88 fMySQLPassword         value 'arun'.
> > > 05 C-cMySQLDBName        pic  x(6).
> > >               88 fMySQLDBName           value 'MyDBMS'.
> > > 05 C-cMySQLPort          pic  x(4).
> > >               88 fMySQLPort             value '3306'.
> > > 05 C-cMySQLSocket        pic  x(8).
> > >               88 fMySQLSocket           value '0'.
> > > 05 C-cMySQLFlag          pic  x(8).
> > >               88 fMySQLFlag             value '0'.
> > >
> > >
> > > It's equivalent COBOL coding for the C coding syntax is;
> > >
> > > CALL "C_mysql_real_connect"
> > > using by reference E-ptrSQLConnect
> > > by reference C-cMySQLHostName
> > > by reference C-cMySQLUserId
> > > by reference C-cMySQLPassword
> > > by reference C-cMySQLDBName
> > > by content C-cMySQLPort
> > > by reference C-cMySQLSocket
> > > by content C-cMySQLFlag
> > > giving E-ptrSQLEnv
> > >
> > > I have tested that before reaching this Calling portion all the
variables
> > hold the values what I
> > > have set earlier. but after execution it stores the error as it's
value
> > (i.e., "Can't connect to
> > > MySQL server on localhost (10061) ") and the pointer variable
> > E_ptrSQLConnect hold value 0.
> > >
> > > Before invoking this Call I have invoked the "C_mysql_init" funtion
and
> > get the pointer value in
> > > E_ptrSQLConnect.
> > >
> > > I could't get where is the possibility of error occurence exist... :(
> > >
> > > Arun.
> > >
> > >
> > >  --- Patrick Sherrill <patrick@stripped> wrote: > What is the
syntax of
> > your call to connect to
> > > the MySQL server?
> > > > It seems as though no server parameters are being passed, thereby
> > defaulting
> > > > to the local machine which apparently has no  mysql server running.
> > > >
> > > > Pat...
> > > >
> > > > CocoNet Corporation
> > > > SW Florida's First ISP
> > > >
> > > >
> > > >
> > > > ----- Original Message ----- 
> > > > From: "Arunachalam" <arunchp@stripped>
> > > > To: <mysql@stripped>
> > > > Sent: Tuesday, December 30, 2003 6:18 AM
> > > > Subject: reg MySQL connetion to COBOL
> > > >
> > > >
> > > > > Hi,
> > > > >
> > > > > I am having responsibility to connect MySQL to COBOL. after such
> a
> > long
> > > > analysing I found there
> > > > > are some C API function to connect to MySQL provided by itself.
> > > > >
> > > > > In COBOL I have the option to CALL external programs written in
other
> > > > languages. I follow this way
> > > > > to made connection to MySQL from COBOL.
> > > > >
> > > > > Initially I struck up with Linker error while linking
> libmysql.lib
> > > > provided by MySQL file into
> > > > > COBOL, i.e, linking of this library file enable the calling of C
API
> > > > functions from COBOL and
> > > > > invoke the appropriate function.
> > > > >
> > > > > I resolve this, by convert the libmysql.dll file into
> libmysql.def
> > using
> > > > pexports.exe (it is a
> > > > > free downloadable utility) and then using LIB.exe in my COBOL
compiler
> > I
> > > > convert the libmysql.def
> > > > > file into libmysql.lib, which is understandable lib file format
> to
my
> > > > COBOL compiler. So my COBOL
> > > > > compiler recognize those libmysql.lib file while linking but
during
> > > > runtime it shows error as;
> > > > >
> > > > >        Can't Connect to MySQL server on localhost (10061)
> > > > >
> > > > > Actually I am trying to connect to the MySQL Server in Linux
machine,
> > I
> > > > can able to connect to
> > > > > server via, MySQLCC, MySQL Explorer (a free utility from
> Toolmagic
> > > > Softwares) and more than that I
> > > > > can connect via simple VC++ program using this C API functions
too.
> > > > >
> > > > > I thought that I never missed any single step to be followed
> while
> > MySQL
> > > > server startup.
> > > > >
> > > > > I appreciate any valuable suggestions with thanks.
> > > > >
> > > > > Regards,
> > > > > Arun.
> > > > >
> > > > >
> > > > >
> > ________________________________________________________________________
> > > > > Yahoo! India Mobile: Download the latest polyphonic ringtones.
> > > > > Go to http://in.mobile.yahoo.com
> > > > >
> > > > > -- 
> > > > > MySQL General Mailing List
> > > > > For list archives: http://lists.mysql.com/mysql
> > > > > To unsubscribe:
> > http://lists.mysql.com/mysql?unsub=1
> > > > >
> > > >
> > > >
> > > > -- 
> > > > MySQL General Mailing List
> > > > For list archives: http://lists.mysql.com/mysql
> > > > To unsubscribe:
> > http://lists.mysql.com/mysql?unsub=1
> > > >
> > >
> > >
________________________________________________________________________
> > > Yahoo! India Mobile: Download the latest polyphonic ringtones.
> > > Go to http://in.mobile.yahoo.com
> > >
> >
> >
> > -- 
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql
> > To unsubscribe:
http://lists.mysql.com/mysql?unsub=1
> >
>
> ________________________________________________________________________
> Yahoo! India Mobile: Download the latest polyphonic ringtones.
> Go to http://in.mobile.yahoo.com
>

Thread
Re: COBOL Syntax of calling MySQL's C APIPatrick Sherrill30 Dec
Re: COBOL Syntax of calling MySQL's C APIPatrick Sherrill31 Dec
Re: COBOL Syntax of calling MySQL's C APIPatrick Sherrill31 Dec
  • Re: COBOL Syntax of calling MySQL's C APIArunachalam2 Jan
    • Re: COBOL Syntax of calling MySQL's C APIinfo2 Jan
  • Conneting MySQL to COBOLArunachalam8 Jan
    • mysql_init function issues :Connecting MySQL to COBOLArunachalam13 Jan
      • Re: mysql_init function issues :Connecting MySQL to COBOLArunachalam13 Jan