pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Specify port no to connect to Informix Database through ODBC
2+ messages / 2 participants
[nested] [flat]

* Specify port no to connect to Informix Database through ODBC
@ 2003-11-27 13:21  Lee <lee_5398@yahoo.com>
  0 siblings, 1 reply; 2+ messages in thread

From: lee_5398@yahoo.com @ 2003-11-27 13:21 UTC (permalink / raw)
  To: pgsql-odbc

Hi,
I'm developing a socket program to connect to Informix database
through the ODBC. In here i called my socket program as "tap" . My tap
will listen for data from unix through port 1070. After checking of
the data, tap will then insert the data to the informix database. I
know we can point the tap to one specified port in Informix database
through the services file. My question is how should i know to which
port my tap program send out to the informix database or should i ask
how should i specify one port to connect to the informix and lock that
port from other process to use it?For current moment, my tap will
randomly pick one port to connect to informix database.

My coding for connect to Informix looks like below;
// Initialize ODBC variables
// NOTE : Make sure these variables is intialized before used.
henv = SQL_NULL_HENV;
hdbc = SQL_NULL_HDBC;
hstmt = hOrderStmt = hTradeStmt = SQL_NULL_HSTMT;

SQLAllocEnv(&henv);
SQLAllocConnect(henv, &hdbc);

char szRetMsg[500];
memset(szRetMsg, '\0', sizeof(szRetMsg));
 
if (SQLSetConnectOption(hdbc,SQL_TXN_ISOLATION,SQL_TXN_READ_UNCOMMITTED)
!= SQL_SUCCESS) {
       SQLErrorMessageBox(henv,hdbc,hstmt,"Connect",(LPSTR)&szRetMsg);
       ::MessageBox(NULL,szRetMsg,"Tap32",MB_ICONSTOP|MB_TASKMODAL);
       PostQuitMessage(0);
       return FALSE;
}


if (SQLConnect(hdbc, szDSN, SQL_NTS, szUserID, SQL_NTS, szPassword,
SQL_NTS) != SQL_SUCCESS)
{
 SQLErrorMessageBox(henv,hdbc,hstmt,"Connect",(LPSTR)&szRetMsg);
 ::MessageBox(NULL,szRetMsg,"Tap32",MB_ICONSTOP|MB_TASKMODAL);
 PostQuitMessage(0);
 return FALSE;
}

I really appreciate if someone can help me out. Thank you very much.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Specify port no to connect to Informix Database through ODBC
@ 2003-11-29 17:38  Jeff Eckermann <jeff_eckermann@yahoo.com>
  parent: Lee <lee_5398@yahoo.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Jeff Eckermann @ 2003-11-29 17:38 UTC (permalink / raw)
  To: Lee <lee_5398@yahoo.com>; pgsql-odbc

Perhaps you might get some help if you post to an
Informix group/list.  This is a PostgreSQL list.

--- Lee <lee_5398@yahoo.com> wrote:
> Hi,
> I'm developing a socket program to connect to
> Informix database
> through the ODBC. In here i called my socket program
> as "tap" . My tap
> will listen for data from unix through port 1070.
> After checking of
> the data, tap will then insert the data to the
> informix database. I
> know we can point the tap to one specified port in
> Informix database
> through the services file. My question is how should
> i know to which
> port my tap program send out to the informix
> database or should i ask
> how should i specify one port to connect to the
> informix and lock that
> port from other process to use it?For current
> moment, my tap will
> randomly pick one port to connect to informix
> database.
> 
> My coding for connect to Informix looks like below;
> // Initialize ODBC variables
> // NOTE : Make sure these variables is intialized
> before used.
> henv = SQL_NULL_HENV;
> hdbc = SQL_NULL_HDBC;
> hstmt = hOrderStmt = hTradeStmt = SQL_NULL_HSTMT;
> 
> SQLAllocEnv(&henv);
> SQLAllocConnect(henv, &hdbc);
> 
> char szRetMsg[500];
> memset(szRetMsg, '\0', sizeof(szRetMsg));
>  
> if
>
(SQLSetConnectOption(hdbc,SQL_TXN_ISOLATION,SQL_TXN_READ_UNCOMMITTED)
> != SQL_SUCCESS) {
>       
>
SQLErrorMessageBox(henv,hdbc,hstmt,"Connect",(LPSTR)&szRetMsg);
>       
>
::MessageBox(NULL,szRetMsg,"Tap32",MB_ICONSTOP|MB_TASKMODAL);
>        PostQuitMessage(0);
>        return FALSE;
> }
> 
> 
> if (SQLConnect(hdbc, szDSN, SQL_NTS, szUserID,
> SQL_NTS, szPassword,
> SQL_NTS) != SQL_SUCCESS)
> {
> 
>
SQLErrorMessageBox(henv,hdbc,hstmt,"Connect",(LPSTR)&szRetMsg);
> 
>
::MessageBox(NULL,szRetMsg,"Tap32",MB_ICONSTOP|MB_TASKMODAL);
>  PostQuitMessage(0);
>  return FALSE;
> }
> 
> I really appreciate if someone can help me out.
> Thank you very much.
> 
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the
> unregister command
>     (send "unregister YourEmailAddressHere" to
majordomo@postgresql.org)


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-11-29 17:38 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-11-27 13:21 Specify port no to connect to Informix Database through ODBC Lee <lee_5398@yahoo.com>
2003-11-29 17:38 ` Jeff Eckermann <jeff_eckermann@yahoo.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox