[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-178034-105":53,"doc-detail-178034-en":126},{"code":4,"msg":5,"data":6},0,"success",[7,14,19,24,29,34,39,44,49],{"id":8,"doc_module":9,"doc_module_name":10,"category_name":11,"show_sort_weight":12,"slug":13},11,1,"Template","Presentations",90,"presentations",{"id":15,"doc_module":9,"doc_module_name":10,"category_name":16,"show_sort_weight":17,"slug":18},12,"Resumes",80,"resumes",{"id":20,"doc_module":9,"doc_module_name":10,"category_name":21,"show_sort_weight":22,"slug":23},14,"Invoices",70,"invoices",{"id":25,"doc_module":9,"doc_module_name":10,"category_name":26,"show_sort_weight":27,"slug":28},15,"Posters",60,"posters",{"id":30,"doc_module":9,"doc_module_name":10,"category_name":31,"show_sort_weight":32,"slug":33},16,"Social Media",50,"social-media",{"id":35,"doc_module":9,"doc_module_name":10,"category_name":36,"show_sort_weight":37,"slug":38},17,"Forms",40,"forms",{"id":40,"doc_module":9,"doc_module_name":10,"category_name":41,"show_sort_weight":42,"slug":43},18,"Letters",30,"letters",{"id":45,"doc_module":9,"doc_module_name":10,"category_name":46,"show_sort_weight":47,"slug":48},21,"Paper Templates",5,"papers-templates",{"id":50,"doc_module":9,"doc_module_name":10,"category_name":51,"show_sort_weight":4,"slug":52},158,"General","general-158",{"code":4,"msg":54,"data":55},"ok",{"site_id":56,"language":57,"slug":58,"title":59,"keywords":60,"description":61,"schema_data":62,"social_meta":119,"head_meta":121,"extra_data":123,"updated_unix":125},105,"en","create-a-java-application-accessing-db2-91-on-system-z","Create a Java Application - Accessing DB2 9.1 on System z","","Create a Java application using RDz to access a DB2 9.1 database running on System z (z10). The guide focuses on setting up RDz connections and switching to the Java Perspective, creating a Java project, package, and class, and then implementing JDBC code to connect to the DB2 host, execute a SQL query against a DB2 table, and print the result set. It also includes driver loading, parameterized connection inputs, and error-handling with SQL state and messages.",{"@graph":63,"@context":118},[64,80,101],{"@type":65,"itemListElement":66},"BreadcrumbList",[67,71,74,77],{"item":68,"name":69,"@type":70,"position":9},"https://docshare.wps.com","Home","ListItem",{"item":72,"name":10,"@type":70,"position":73},"https://docshare.wps.com/template/",2,{"item":75,"name":51,"@type":70,"position":76},"https://docshare.wps.com/template/general/",3,{"item":78,"name":59,"@type":70,"position":79},"https://docshare.wps.com/template/create-a-java-application-accessing-db2-91-on-system-z/178034/",4,{"url":78,"name":59,"@type":81,"image":82,"author":87,"headline":59,"publisher":90,"fileFormat":93,"inLanguage":57,"description":61,"dateModified":94,"datePublished":95,"encodingFormat":93,"isAccessibleForFree":96,"interactionStatistic":97},"DigitalDocument",{"url":83,"@type":84,"width":85,"height":86},"https://docshare.wps.com/thumbnails/create-a-java-application-accessing-db2-91-on-system-z/178034.png","ImageObject",442,249,{"name":88,"@type":89},"Paura","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/vnd.openxmlformats-officedocument.wordprocessingml.document","2026-09-28","2026-09-02",true,{"@type":98,"interactionType":99,"userInteractionCount":47},"InteractionCounter",{"@type":100},"ViewAction",{"@type":102,"mainEntity":103},"FAQPage",[104,110,114],{"name":105,"@type":106,"acceptedAnswer":107},"What prerequisites are required before running the Java application?","Question",{"text":108,"@type":109},"A z/OS connection must be available in RDz, and the DB2 9.1 table structure must be created before the project runs.","Answer",{"name":111,"@type":106,"acceptedAnswer":112},"How does the example create the Java project in RDz?",{"text":113,"@type":109},"In RDz, create a Java Project via File > New > Project > Java Project, name it (e.g., JDBCJava), accept defaults, and finish.",{"name":115,"@type":106,"acceptedAnswer":116},"How does the program connect to DB2 9.1 and retrieve data?",{"text":117,"@type":109},"It loads the DB2 JDBC driver, builds a JDBC URL using the first argument as location, uses userid and password from the remaining arguments, establishes a connection, executes a SELECT query, and prints the result set metadata and rows.","https://schema.org",{"og:url":78,"og:type":120,"og:title":59,"og:site_name":91,"og:description":61},"article",{"robots":122,"canonical":78},"index,follow",{"doc_id":124,"site_id":56},178034,1790018485,{"code":4,"msg":5,"data":127},{"doc_id":124,"user_id":128,"nickname":88,"user_avatar":129,"doc_module":9,"category_id":50,"category_name":51,"doc_title":59,"doc_description":61,"doc_content":130,"file_id":131,"file_url":132,"file_type":133,"file_size":134,"view_count":47,"is_deleted":4,"is_public":9,"is_downloadable":9,"audit_status":9,"page_count":135,"language":136,"language_code":57,"site_id":56,"html_lang":57,"table_of_contents":137,"faqs":138,"seo_title":139,"seo_description":61,"update_tm":140,"read_time":76},13056712833777,"https://ap-avatar.wpscdn.com/davatar_29158cc5080c5b710cf443261637dec0","Module Objectives:\nBecome proficient in the RDz Java Perspective\nBe able to extract data from a DB2 table using Java\nCreating a Java program to access DB2 9.1 on System z\nCreate a Java Application\nThis example creates a Java application that runs against DB2 9.1 on the host (z10).  One must create the DB2 9.1 table before this project will run.\nOpen RDz and ensure you have a z/OS connection (Remote System).  To create a Java Project, you will need to open the Java Perspective.\nTo switch to the Java Perspective:\n1. Perspectives that have been opened in RDz are kept usually as expandable tabs in the upper right corner of your Remote System perspective.  If you have not previously opened the Java perspective, click Window => Perspective => other. A dialog box displays.\n2. Select Java and click OK. RDz automatically arranges the windows, views, and editors for Java development tasks.   Package Explorer (only Packa displayed) is shown below.\n\u000fTo create a Java project:\n1. Click File => New => Project => Java Project\n2.    Click the Next button and name the new project –JDBCJava for this example.\n\u000f\nAccept the default values and click the Finish button (not shown).  The result is shown below.\nTo create a Java package within the project:\n1. Right-click the project (JDBC Java in this case) in the Package Explorer window and select New => Package\n3. Enter a name for the new package such as com.acctid (com.douglas in this case) and click the Finish button (not shown)\nThe package is created as shown\nTo create a Java class:\n1. Right-click the project (JDBCJava) in the Package Explorer window and select New => Class.\n3. Use the Browse button to select your package, for example com.douglas\n4. Enter your class name; for example, DisplayNames\n5. Click the box for public static void main and then click the Finish button.\nRDz creates a Java programming template as shown below.\n\u000fThe Program--copy the following Java Program into the DisplayNames Java program\nThe package statement should be in your Java editor—my specific package is\npackage com.douglas;\nEnter the following import statements--between the package name and the class--to import the Java classes needed for this application\nimport java.sql.Connection;\nimport java.sql.DriverManager;\nimport java.sql.ResultSet;\nimport java.sql.ResultSetMetaData;\nimport java.sql.SQLException;\nimport java.sql.Statement;\nThe class and main subroutine headers are already created in the Java Editor.  Thus, do not copy and paste them.\n----------------------------------------------------\npublic class DisplayNames {\n/**\n* @param args\n*/\npublic static void main(String[] args) {\nCopy the following code into the main program stub—note some comments that show the DB2 9.1 table structure\nSystem.out.println(\"\u003C\u003C\u003C Entering DisplayNames >>>\");\nif (args.length != 3) {\nSystem.out.println(\"required: location_name\u003Cuserid\u003Cpassword>\");\nSystem.exit(0);\n}\ntry {\nClass.forName(\"com.ibm.db2.jcc.DB2Driver\").newInstance();\nString url = \"jdbc:db2://stplex4a.svl.ibm.com:8028/\" + args[0];\nConnection connection = DriverManager.getConnection(url,\nargs[1], args[2]);\nshowPeople(connection);\nconnection.close();\n} catch (SQLException ex) {\nSystem.out.println(\"\\n***SQLExecption caught***\\n\");\nwhile (ex != null) {\nSystem.out.println(\"SQLState: \" + ex.getSQLState());\nSystem.out.println(\"MEssage: \" + ex.getMessage());\nSystem.out.println(\"Vendor: \" + ex.getErrorCode());\nex = ex.getNextException();\n}\nSystem.out.println(\"====================================\");\n} catch (java.lang.Exception langEx) {\nSystem.out.println(\"\\n***java.lang.Execption caught***\\n\");\nlangEx.printStackTrace();\n}\n}\n/**\n* showPeople method\n*\n* CREATE TABLE FRIENDZ (\n*\tFNAME CHAR(10) NOT NULL,\n*\tLNAME CHAR(10) NOT NULL,\n*\tPHONE CHAR(10) NOT NULL,\n*\tEMAIL CHAR(30) NOT NULL\n*  )\n* AUDIT NONE\n* DATA CAPTURE NONE\n* CCSID EBCDIC;\n*\n**/\nprotected static void showPeople(Connection connection) throws SQLException {\nSystem.out.println(\"\u003C\u003C\u003C showPeople method >>> \");\nStatement stmt = connection","cbCaiq2sa8DQNay0","https://ap.wps.com/l/cbCaiq2sa8DQNay0","docx",791922,9,"English","# Module Objectives\n## RDz Setup and Java Perspective\n## Create Java Project and Package\n## Create Java Class and Program Template\n## JDBC Code to Access DB2 9.1\n## Run Configuration","[{\"question\":\"What prerequisites are required before running the Java application?\",\"answer\":\"A z/OS connection must be available in RDz, and the DB2 9.1 table structure must be created before the project runs.\"},{\"question\":\"How does the example create the Java project in RDz?\",\"answer\":\"In RDz, create a Java Project via File \\u003e New \\u003e Project \\u003e Java Project, name it (e.g., JDBCJava), accept defaults, and finish.\"},{\"question\":\"How does the program connect to DB2 9.1 and retrieve data?\",\"answer\":\"It loads the DB2 JDBC driver, builds a JDBC URL using the first argument as location, uses userid and password from the remaining arguments, establishes a connection, executes a SELECT query, and prints the result set metadata and rows.\"}]","Create a Java Application - Accessing DB2 9.1 on System z | DOCX",1788330137]