Solved

DB2 connection

Posted on 2008-06-24
18
1,560 Views
Last Modified: 2010-04-21
Hi
I'm using an OLE DB provider connection string similar to this.
cn2.Open("Provider=IBMDADB2;Database=JDEENT;Hostname=172.16.1.10;Protocol=TCPIP;Port=8476; Uid=RLEE;Pwd=PEARL")
I'm getting a COM error. I'm assujming one of my parameters may be wrong. Can someone confirm that. How does one interrogate an AS400 box to find the right parameters? I know the IP is right. The user name and password I'm passing has sufficient rights.
I need to find if the PORT and database name are right. How do I do that?
Thanks
0
Comment
Question by:HenryV1955
  • 8
  • 8
  • 2
18 Comments
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 21859749
This is the right format:
Provider=IBMDADB2;Database=myDataBase;Hostname=myServerAddress;Protocol=TCPIP;Port=50000; Uid=myUsername;Pwd=myPassword;

0
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 21859878
oops... posted to fast
 I think you have to add the " ; " to the end :)
0
 
LVL 4

Expert Comment

by:LewisPower
ID: 21864490
Hi HenryV1955,

For the second part of your question, to manage your port, there's 2 places...
1-Go TCPADM, option 7, option 3: This one is to manage TCP/IP Connection Status
2-Go TCPADM, option 1, option 4: This one is to manage TCP/IP Port Restrictions

By the way, there might be something else in TCPADM that can give you a COM error too. You should provide us the error message to go deeper. Or you can sneak around in TCPADM, you might find it.

Does this helped ?
0
 

Author Comment

by:HenryV1955
ID: 21864606
Hi, heres the error message I get
SQL30081N  A communication error has been detected.  Communication protocol being used: "TCP/IP".  Communication API being used: "SOCKETS".  Location where the error was detected: "172.16.1.10".  Communication function detecting the error: "selectForRecvTimeout".  Protocol specific error code(s): "0", "*", "*".  SQLSTATE=08001

thanks
0
 

Author Comment

by:HenryV1955
ID: 21865313
HI Lewis

I dont know what TCPADM is? Where is it, how do I access it?

Thanks
0
 
LVL 4

Expert Comment

by:LewisPower
ID: 21865430
Hi HenryV1955,

Sorry for TCPADM... I was assuming too much...
On the command line in the AS/400, if you type GO TCPADM, the system will bring you the TCP maintenances of the AS/400. Then when you'll do the options mentionned, you'll be able to see and manage your setup.

Be back for you error message SQL30081N...
Lewis
0
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 21865586
Hi Henry,

Do you know the return code of this message? or the sense codes ?

example:
The most common sense codes associated with this error message, and the suggested solution in each case, are as follows:

SQL30081N with Return Code 1 and sna sense code 0877002C
Wrong network name has been specified.
SQL30081N with Return Code 1 and SNA sense code ffff0003
The wrong MAC address has been specified or the SNA link is not active.
SQL30081N with Return Code 1 and SNA sense code 10030021
There is an LU type mismatch.
SQL30081N with Return Code 1 and SNA sense code 084B6031
The MAXDBAT in DSNZPARM (at a DB2 for OS/390 and z/OS(TM) host) is set to 0.
Other suggestions:

When creating the Local LU profile, define the LU as the default LU. For example, in the SNA Feature list panel in CM/2, either:
Place a checkmark in the checkbox 'Use this local LU as your default local LU alias', or
Set the profile or environment variable APPCLLU on the DB2 Connect Enterprise Edition server system to the Local LU name. You can do this on Windows(R) systems using the Control Panel.
Check that SNA is started on the DB2 Connect server.
If you are using DB2 for OS/390 and z/OS, check that the Distributed Data Facility (DDF) address space is started and that DB2 is running.

for the other return codes, Check the error code in the manual
http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/conn/c0005607.htm

Good Luck,
Murph
0
 

Author Comment

by:HenryV1955
ID: 21865713
HI Murphy, this is complete error msg I get in VB whatever this means

System.Runtime.InteropServices.COMException was unhandled
  ErrorCode=-2147467259
  Message=" SQL30081N  A communication error has been detected.  Communication protocol being used: "TCP/IP".  Communication API being used: "SOCKETS".  Location where the error was detected: "172.16.1.10".  Communication function detecting the error: "selectForRecvTimeout".  Protocol specific error code(s): "0", "*", "*".  SQLSTATE=08001
"
  Source="IBM OLE DB Provider for DB2"
  StackTrace:
       at ADODB.ConnectionClass.Open(String ConnectionString, String UserID, String Password, Int32 Options)
       at Project1.Form1.Command1_Click(Object eventSender, EventArgs eventArgs) in C:\Documents and Settings\hvanderste\My Documents\VB\Project1.NET\Form1.vb:line 30
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at Project1.Form1.Main() in C:\Documents and Settings\hvanderste\My Documents\VB\Project1.NET\Form1.Designer.vb:line 1
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
0
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 21865978
can you double check:

- is the IP address right ?
- is the port number correctly specified ?
- is the TCPIP listener started ?
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 21866008
Hmm in VB? Connecting to DB2 on a AS?400 (iSeries) server?
0
 

Author Comment

by:HenryV1955
ID: 21866145
HI Murphy
I'm relying on someone else for correct IP, PORT details, which I'm not sure is accurate, thats why I'm interested in knowing how to interrogate the AS400 box
In my research, if you have db2 client installed on your pc, which I do, you can supposedly use a DB2 connection string OLE DB provider to connect to DB2 which is what I posted here.
0
 

Author Comment

by:HenryV1955
ID: 21866151
Yes a DB2 on an AS400 i series server
0
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 21866317
Why not using the IBMDA400 Driver?

Connection string:
Provider=IBMDA400;Data Source=MY_SYSTEM_NAME;User Id=myUsername;Password=myPassword;
or
Provider=IBMDA400;Data Source=MY_SYSTEM_NAME;User Id=myUsername;Password=myPassword;Default Collection=MY_LIBRARY;
0
 

Author Comment

by:HenryV1955
ID: 21878064
Hi Murphy, ok I'll try.
Please clarify, whats Data Source? Is it database name
Whats Default Collection?

0
 
LVL 16

Accepted Solution

by:
theo kouwenhoven earned 500 total points
ID: 21878167
Hi HenryV,

Data Source =SYSTEM_NAME  ( from your example it wold be 172.16.1.10)
User Id=myUsername   ( from your example it wold be RLEE)
Password=myPassword   ( from your example it wold be PEARL)
Default Collection= is the library on the AS/400 where the tabels are.

If you don't specify the Default Collection, you can qualify the files with the libraryname like:
in that case an sql statement should look like this :
     Select * from Mylibrary/Myfile  or
     Select * from Mylibrary. Myfile  

If you leave the User Id and Password blank, the AS/400 will ask for it ONCE if you make the connection.
if you already connected to the AS/400 he will use that connection and will not ask for a logon.

Regards,
Murph




0
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 21878219
Hi HenryV,

Oh yeah forget to tell, the AS/400 doesn't really have a database name (you mentioned that in yhe last question).
A library is a sort of Database, but technically it looks more like a map or directory
a Library contain files (tables) and or other objects like definitions, programs, profiles etc.

Just nice to know (i think) :)

Have fun,
Murph

0
 

Author Closing Comment

by:HenryV1955
ID: 31470307
Hi Murphy
Thank you very much for your help.
I would appreciate some further discussion
Henry
0
 

Author Comment

by:HenryV1955
ID: 21883406
HI Murphy, I used your IBMDA400 driver
Provider=IBMDA400;Data Source=MY_SYSTEM_NAME;User Id=myUsername;Password=myPassword;
works great

I assume that this driver should work too if I knew all the parameters? True?
Provider=IBMDADB2;Database=myDataBase;Hostname=myServerAddress;Protocol=TCPIP;Port=50000; Uid=myUsername;Pwd=myPassword;
Is Database the library name?
How do I find out what Port to use?

Question, is there a difference in performance from one to the other?

Thanks
Henry




0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

In this article, I will show you HOW TO: Suppress Configuration Issues and Warnings Alert displayed in Summary status for ESXi 6.5 after enabling SSH or ESXi Shell.
Owning a franchise can be the dream of a lifetime. It provides a chance for economic growth. You can be as successful as you want.  To make your franchise successful, you need to market it successfully. Here are six of the best marketing strategies …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now