{"id":364,"date":"2014-10-17T23:59:29","date_gmt":"2014-10-17T21:59:29","guid":{"rendered":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/?p=364"},"modified":"2014-12-20T14:16:25","modified_gmt":"2014-12-20T12:16:25","slug":"implementing-a-mysql-db-connection-via-oorexx-by-using-bsf4oorexx-3_mysql_connector-rxj","status":"publish","type":"post","link":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/?p=364","title":{"rendered":"Implementing a MySQL DB connection via ooRexx by using BSF4ooRexx &#8211; (3_MySql_connector.rxj)"},"content":{"rendered":"<pre class=\"theme:familiar lang:default decode:true  \" title=\"implementing a MySQL DB connection via ooRexx\">\/* ***************************************************************************** *\/\r\n\/* This is a short example of implementing a MySQL DB connection via ooRexx      *\/ \r\n\/* by using BSF4ooRexx. Using the Java - mysql connector via bean scripting      *\/\r\n\/* in ooRexx                                                                     *\/\r\n\/* created by Martin Stoppacher - 26.12.2009                                     *\/\r\n\/* ***************************************************************************** *\/\r\n\r\nsay hello access to a my sql database via java using bsf4rexx\r\nuid = \"root\";\r\nurl = \"jdbc:mysql:\/\/localhost\/test\";\r\npw = \"password\";\r\n\r\nmydrive=.bsf~new('com.mysql.jdbc.Driver')        \/* establishe the db connection *\/\r\nman=bsf.loadClass(\"java.sql.DriverManager\")\r\nman~registerDriver(mydrive)\r\n\r\nconn=man~getConnection(url, uid, pw)                  \/* connecting the database *\/\r\n\r\nstmt=conn~createStatement                                       \/* fetching data *\/\r\nrset=stmt~executeQuery(\"select max(Nr)+1 as maximum from mytest\")\r\n\r\nrset~next; i = rset~getString(\"maximum\"); say i;\r\nstmt~executeUpdate(\"insert into mytest values(\" || i ||\",'BSF4ooRexx')\") \r\n\r\nrset=stmt~executeQuery(\"select NR, NAME from mytest\")           \/* fetching data *\/\r\n\r\nsay \"NR______NAME\"                                                 \/* print data *\/\r\ndo while rset~next\r\nsay rset~getString(\"nr\")  || ______ || rset~getString(\"NAME\")\r\nend\r\n\r\nsay end\r\n\r\n::requires BSF.CLS                                       \/* get the Java support *\/<\/pre>\n<hr \/>\n<ul>\n<li><a title=\"Open Object Rexx (ooRexx)\" href=\"http:\/\/www.oorexx.org\/\" target=\"_blank\">the Open Object Rexx (ooRexx) web site<\/a><\/li>\n<li><a title=\"Project ROME\" href=\"http:\/\/rometools.github.io\/rome\/\" target=\"_blank\">ROME is a set of\u00a0RSS and Atom\u00a0Utilities for Java<\/a><\/li>\n<li><a title=\"Introduction to ooRexx\" href=\"http:\/\/www.facultas.at\/list\/SFRE8554C\" target=\"_blank\">Introduction to REXX and ooRexx &#8211;\u00a0Flatscher Rony G.<\/a><\/li>\n<li><a href=\"http:\/\/wi.wu-wien.ac.at:8002\/rgf\/\" target=\"_blank\">http:\/\/wi.wu-wien.ac.at:8002\/rgf\/<\/a><\/li>\n<li><a title=\"Presentation - Martin Stoppacher\" href=\"http:\/\/wi.wu-wien.ac.at\/rgf\/diplomarbeiten\/BakkStuff\/2010\/201001_Stoppacher\/Project_Rome_in_combination_with_BSF4ooRexx_Presentation.pdf\" target=\"_blank\">http:\/\/wi.wu-wien.ac.at\/rgf\/diplomarbeiten\/BakkStuff\/2010\/201001_Stoppacher\/Project_Rome_in_combination_with_BSF4ooRexx_Presentation.pdf<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/* ***************************************************************************** *\/ \/* This is a short example of implementing a MySQL DB connection via ooRexx *\/ \/* by using BSF4ooRexx. Using the Java &#8211; mysql connector via bean scripting *\/ \/* in ooRexx *\/ \/* created by Martin Stoppacher &#8211; 26.12.2009 *\/ \/* ***************************************************************************** *\/ say hello access to a my sql database &hellip; <a href=\"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/?p=364\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Implementing a MySQL DB connection via ooRexx by using BSF4ooRexx &#8211; (3_MySql_connector.rxj)<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18,10,15],"tags":[],"_links":{"self":[{"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/364"}],"collection":[{"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=364"}],"version-history":[{"count":4,"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/364\/revisions"}],"predecessor-version":[{"id":367,"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/364\/revisions\/367"}],"wp:attachment":[{"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}