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 30 31 32 33 34 |
/* ***************************************************************************** */ /* This is a short example of implementing a MySQL DB connection via ooRexx */ /* by using BSF4ooRexx. Using the Java - mysql connector via bean scripting */ /* in ooRexx */ /* created by Martin Stoppacher - 26.12.2009 */ /* ***************************************************************************** */ say hello access to a my sql database via java using bsf4rexx uid = "root"; url = "jdbc:mysql://localhost/test"; pw = "password"; mydrive=.bsf~new('com.mysql.jdbc.Driver') /* establishe the db connection */ man=bsf.loadClass("java.sql.DriverManager") man~registerDriver(mydrive) conn=man~getConnection(url, uid, pw) /* connecting the database */ stmt=conn~createStatement /* fetching data */ rset=stmt~executeQuery("select max(Nr)+1 as maximum from mytest") rset~next; i = rset~getString("maximum"); say i; stmt~executeUpdate("insert into mytest values(" || i ||",'BSF4ooRexx')") rset=stmt~executeQuery("select NR, NAME from mytest") /* fetching data */ say "NR______NAME" /* print data */ do while rset~next say rset~getString("nr") || ______ || rset~getString("NAME") end say end ::requires BSF.CLS /* get the Java support */ |
- the Open Object Rexx (ooRexx) web site
- ROME is a set of RSS and Atom Utilities for Java
- Introduction to REXX and ooRexx – Flatscher Rony G.
- http://wi.wu-wien.ac.at:8002/rgf/
- http://wi.wu-wien.ac.at/rgf/diplomarbeiten/BakkStuff/2010/201001_Stoppacher/Project_Rome_in_combination_with_BSF4ooRexx_Presentation.pdf