If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Excel and DB2 connectivity

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-23-11, 08:42
himanshucs28 himanshucs28 is offline
Registered User
 
Join Date: Aug 2011
Posts: 3
Excel and DB2 connectivity

Hi,

I am very new to Db2 and also VBA to an extent. Could somebody help me out with below request.

I request somebody to help me with a sample code....

Basically i have to check using CLI/ODBC driver if the connection between excel and DB2 has been established or not.

For that i plan to write a batch file where i will be calling the excel sheet which in turn will automatically execute a macro which will bring out some dummy data from sysibm.sysdummy1 table.

I require a code with which I can make a connection to my database and check if the connection has been established or not....(Probably with some explanation like code breakdown @ important palces)


Please help me with this request.. Thousand thanks in advance....

I am not very sure If I posted in the right place.. My Apologies If I had posted in wrong forum..
Reply With Quote
  #2 (permalink)  
Old 08-23-11, 09:07
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Reply With Quote
  #3 (permalink)  
Old 08-24-11, 05:16
himanshucs28 himanshucs28 is offline
Registered User
 
Join Date: Aug 2011
Posts: 3
hi ni , thanks for a quick response

i needed some clarifications on the thing .

first of all i have already created a DSN using odbc connection tool in control panel. now using this dsn i would like to check if the connection has been established or not ?

I require a code with which I can make a connection to my database and check if the connection has been established or not by giving out some success message if the connection was established and a failure message if the connection was not established....
Reply With Quote
  #4 (permalink)  
Old 08-24-11, 05:45
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
SOURCE FILE NAME: dbConn.bas is an example for connect/disconnect that can be used..
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #5 (permalink)  
Old 08-24-11, 05:54
himanshucs28 himanshucs28 is offline
Registered User
 
Join Date: Aug 2011
Posts: 3
thnx guy

just a small query .... this is the vba code and it will have to called from the batch file separately ?
Reply With Quote
  #6 (permalink)  
Old 08-24-11, 06:00
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
I have no idea - I am a dba and never using such language - if you can call it that way..
many entries are available on other forum
Include external file .BAS in Excel VBA
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On