SunQuest
           DB2 Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDB2 Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old July 11th, 2006, 09:41 AM
dlare9 dlare9 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Location: somewhere
Posts: 33 dlare9 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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>);

Reply With Quote
  #2  
Old July 12th, 2006, 07:57 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
Set up a DNS to the DB2 server on the new machine and use the DNS in the manner you have listed in the code with a username password combination. This will require the DB2 drivers on the remote machine.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDB2 Development > Accessing db2 remotely


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway