Error RROR [08001] [IBM] SQL30081N when connecting to AS400 (iSeries) from NHibernate using C#
c#, database, ibm-midrange, nhibernate
Solution
There are two types of database connections available on the IBM i - DRDA and DDM. DRDA is used for native connections (DB2.Net.iSeries) and DDM is used for DB/2 LUW (DB2.Net, DB/2 Connect) connections.
DRDA
Verify the database host server running:
WRKACTJOB SBS(QSERVER) JOB(QZDASRVSD)
Check the port status:
`NETSTAT OPTION(*CNN)`, hit F2 and verify ports 449, 8470, 8471 and 8476 are in state Listen.
Start the database host server with the command:
STRHOSTSVR SERVER(*DATABASE)
DDM
Verify the ddm tcp server is running:
WRKACTJOB SBS(QSYSWRK) JOB(QRWTLSTN)
Check the port status:
NETSTAT *CNN, hit F2 and verify port 446 is in state Listen.
Start the ddm tcp server with the command:
STRTCPSVR SERVER(*DDM)
Include the ddm port number in your connection string:
Server=192.168.1.11:446;Database=TESTDB;UID=XXX;PWD=XXX;
This IBM Redbook should provide more information:
Integrating DB2 Universal Database for iSeries with Microsoft ADO .NET
Problem
I have absolutely no experience with AS400 DB2 so please forgive any glaring mistakes as I am learning as I go along. I have 2 boxes I can connect to running v5r3 or v4r3. and I am using NHibernate 3. However, when I try and connect I keep getting the following exception :- ``` ERROR [08001] [IBM] SQL30081N A communication error has been detected. Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS". Location where the error was detected: "192.168.1.11". Communication function detecting the error: "connect". Protocol specific error code(s): "10061", "*", "*". SQLSTATE=08001 ``` Below is my NHibernate configuration file:- ``` <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> <session-factory> <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property> <property name="dialect">NHibernate.Dialect.DB2400Dialect</property> <property name="connection.driver_class">NHibernate.Driver.DB2Driver</property> <property name="connection.connection_string">Server=192.168.1.11;Database=TESTDB;UID=XXX;PWD=XXX; </property> <property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property> <property name="command_timeout">15000</property> <property name="current_session_context_class">thread_static</property> </session-factory> </hibernate-configuration> ``` I am not sure if this is because the versions of AS400 are too early? my nhibernate configuration is incorrect? or I have something set up incorrectly on the AS400 itself. Any advice would be most appreciated. Many thanks in advance