Rob Brooks-Bilson
Tech, Photography, Stuff
Tech, Photography, Stuff
January 27, 2004
Although this isn't really *new* (the driver was released about a month ago), I never got around to blogging it. For those of you who connect ot an AS400/iSeries with CFMX, you might be interested to know that IBM released version 4.2 of JTOpen, their open source JDBC driver for DB2/400. You can download the driver here.
1/28/04 6:34 AM
But there's still no timeout parameter. :(
(See comment on http://www.cfczone.org/blogs/rob/addcomment.cfm?id... ).
2/9/04 11:05 PM
Here is how to read and write data queues using JTOpen 4.2
----
<!--- Create Connection Variables --->
<cfset myAS400 = JavaCast("string","myas400.com")>
<cfset userid = JavaCast("string","userprf")>
<cfset password = JavaCast("string","passwd")>
<!--- create AS400 Objects (com.ibm.as400.access.AS400) --->
<cfobject action="create" type="java" class="com.ibm.as400.access.AS400" name="sys">
<cfset sys.init(myAS400, userid, password)>
<!--- create AS400 Data Queue (com.ibm.as400.access.DataQueue) --->
<cfobject action="create" type="java" class="com.ibm.as400.access.DataQueue" name="dtaq">
<!--- initialize AS400 Data Queue (dtaq) --->
<cfset dtaq.init(sys,"/QSYS.LIB/MYLIB.LIB/MYDTAQ.DTAQ")>
<!--- Write to Data Queue --->
<cfset dtaq.write("aaabbbccc")>
<!--- Read Data Queue contents--->
<cfset myByteArray=dtaq.read()>
<!--- Read Data Queue contents--->
<cfset data=myByteArray.getstring()>
<!--- Output string--->
<cfdump var=#data#>
<!--- Disconnect Service --->
<cfset sys.disconnectService(sys.COMMAND)>
-------
This is getting rather fun :)
Jeremy