
July 11th, 2006, 09:41 AM
|
|
Contributing User
|
|
Join Date: Jan 2006
Location: somewhere
Posts: 33
Time spent in forums: 2 Days 4 h 10 m 46 sec
Reputation Power: 3
|
|
|
Accessing db2 remotely
Hi again,
I have a DB2 database placed on a different database server (Remote) and I have C application placed on different location/pc.
I need to connect to the DB2 database from my C application.
Currently I use the ff. codes to connect to the database locally.
Code:
int ConnectToDB( struct dbConfig db )
{
if( !strlen( db.username ) || !strlen( db.password ) ) {
EXEC SQL CONNECT TO :dbName ;
}
else
{
strcpy( userId, db.username ) ;
strcpy( password, db.password );
EXEC SQL CONNECT TO :dbName user:userId using :password ;
}
SQLError( "CONNECT", SQLCODE, &sqlca ) ;
return( SQLCODE ) ;
}
Could somebody tell me how to do a remote connection using Embeded SQL in C and to the database w/c is on a different server.
Any help would be appreciated
regards,
dlare9
**all the sample codes that I've found in the net are all for connection locally. I can't seem to find a "connect" in this format connect(<host>, <username>, <password>);
|