Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / Informix Topics / November 2003

Tip: Looking for answers? Try searching our database.

specify port no to connect informix database through ODBC

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lee - 27 Nov 2003 13:17 GMT
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.
Gorazd Hribar Rajteric - 27 Nov 2003 13:51 GMT
I'm not sure that I understand your question, but let me try to answer it anyway:
Client side ports and server side ports are never the same. You can listen only on ports < 32768 and you'll connect from the
client with ports > 32768 (I'm not sure if port 32768 is ever used). This way you don't have to worry about client side port
being free to connect to server and vice versa.

I hope this clarifies some details.

Gorazd

> Hi,
> I'm developing a socket program to connect to Informix database
[quoted text clipped - 39 lines]
>
> I really appreciate if someone can help me out. Thank you very much.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.