PermaLink DB2 LSX problem - pt.3: Listing all tables in a DB2 db generates a weird error07/28/2004
DB2
I'm trying to use the LSX LSConnection.Catalog() method to list all of the tables in a DB2 database. So far, all I get is this funky error:

Error 12325 occurred in INITIALIZE at line 94: Error: [IBM][CLI Driver][DB2/SUN] SQL0031C File "C:\32CAE614\bnd\db2clish.bnd" could not be opened., Connector 'db2', Method -Catalog [Metadata]- (-31)

which I have no idea what it means. If you'd like to see the Lotusscript code behind the error I'm getting, click the Read More link below.
'Catalog example: 

Option Public
Option Declare

Uselsx "*LSXLC"

%INCLUDE "lsconst.lss"
Sub Initialize
	
	Dim session As New LCSession 
	Dim connect As New LCConnection ("order")  
	Dim cnt As Long
	Dim conFldLst As New LCFieldList (1, LCFIELDF_TRUNC_DATA + LCFIELDF_TRUNC_PREC)
	Dim conFld As New LCField (LCTYPE_TEXT, 1)
	Dim field As New LCField (LCTYPE_TEXT, 1)
	Dim wintitle As String
	Dim result As String
	Dim mb As Long
	
	On Error Goto ErrorHandler
	
	wintitle = "Catalog Example"
	connect.ConnectorName = "db2"
	
     REM this section assigns the appropriate properties to connect to DB2
	connect.Database = "somedb"
	connect.Userid = "user"
	connect.Password = "password"
	
     REM connect to DB2
	connect.Connect
	
     REM now perform the catalog action - in this case for metadata 
	cnt =  connect.Catalog(LCOBJECT_METADATA,conFldLst)
	If (cnt = 0) Then 
		mb = MB_IconInformation + MB_OK
		Messagebox "No metadata was found.", mb, wintitle
		End
	Else
          REM fetch the results
		cnt = connect.Fetch(conFldLst, 1, 1)
	End If   
	
     REM now get each field and build a list using the variable called result
     REM this list can get very large depending on how many tables this DB2 database has
	Set field =  conFldLst.GetField(1)
	result = ""
	While ((session.status = LCSUCCESS) And (cnt >0))
		result = result + field.text(0) +  ","
		cnt =  connect.Fetch(conFldLst, 1, 1)
	Wend
	
	Print  "Here is the metadata: " & result,  wintitle
	End
	
ErrorHandler:
	Dim Msg As String
	Dim MsgCode As Long
	Dim status As Integer
	
	If session.status <> LCSUCCESS Then
		status = session.GetStatus (result, msgcode, msg)
	Else
		result =  "Error " & Err() & ": " & Error()
	End If
	
	Messagebox (result), mb, wintitle
	
	End
	
End Sub

Comments :v
No comments.
Credits
NuTechs Powered by Domino
Search
Calendar
February 2012
Su
Mo
Tu
We
Th
Fr
Sa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Monthly Archive
Get Real, Detroit!
Real Detroit Weekly
SWARM
Service
With
A
Rapid
Motion


-- old Rally's Hamburgers credo
Lotus Domino ND6 RSS News Feed RSS Comments Feed Podcast Feed Geo URL netcraft RSS Validator Lotus Geek Chris. A. Brandlehner Open Notes Picture Database OpenNTF CoComment Integrated BlogSphere
By Category
The BlogRoll
About
Contact Me
Contact me, Michael Sobczak, using this e-mail address:

my first initial my last name at Yahoo dot com
Recent Entries
No Recent Blogs
Powered by
Blogsphere