This document provides code for a login page and main user interface (UI) for a library management system written in Java. It includes code to connect to a MySQL database, validate login credentials, and initialize the login and main UI forms with labels, text fields, buttons and menus to navigate library functions. The login page code validates a username and password against the database and loads the main UI if credentials are valid. The main UI code initializes the form layout and includes menu options for library, publisher, member and report functions.
This document contains code for a login form and main interface for a grain management application. The login form allows users to enter credentials which are validated against hardcoded values. If valid, it opens the main interface containing buttons for various application functions. The interface is initialized by calling initComponents() which sets up the layout and UI elements.
New methods for exploiting ORM injections in Java applicationsMikhail Egorov
This document summarizes new methods for exploiting ORM injections in Java applications. It begins with introductions to ORM, JPA, and common ORM libraries. It then outlines several exploitation techniques, including using special functions in EclipseLink and TopLink to call database functions, abusing string handling and quote processing in OpenJPA, and leveraging features in Hibernate and specific databases like string escaping, quoted strings, magic functions, and Unicode delimiters. Code examples and demonstrations are provided for most of the techniques.
This document contains Java code for a student portal application. It defines a StudentDetailsForm class that initializes a GUI with labels, text fields, buttons etc to allow entry of student details like name, ID, date of birth, address etc. It connects to an Oracle database and includes methods for submitting the student details to a database table on button click, and refreshing the form fields.
The document describes a project that provides online quizzes to test knowledge on various topics using database connectivity. It includes source code for login, registration, menu selection, quiz questions, and results display screens. The project uses Java Swing for the front-end and MySQL database to store user details, questions, answers, and test performance. It allows users to register, select a subject to test, attempt questions, view results, and retake tests.
The document discusses removing structural duplication from code. It defines structural duplication as similar code structures that repeat even if the internal actions differ. Examples given include conditional statements, exception handling, and views. The risks of duplication include increased size and unintended changes. The document provides steps to remove duplication such as separating structure from actions, extracting data models, and using loops to consolidate duplicated code. Both advantages like improved separation of concerns and disadvantages like increased rigidity are discussed.
ORM2Pwn: Exploiting injections in Hibernate ORMMikhail Egorov
Mikhail Egorov and Sergey Soldatov presented their research on exploiting injections in Hibernate ORM. They demonstrated that while Hibernate Query Language (HQL) is more limited than SQL, it is possible to exploit HQL injections to conduct SQL injections on popular databases like MySQL, PostgreSQL, Oracle, and Microsoft SQL Server. They did this by leveraging features of Hibernate and the databases like how Hibernate handles string escaping and allows unicode characters in identifiers. Their talk provided examples of exploiting each database and a takeaway that Hibernate is not a web application firewall and HQL injections can be used to perform SQL injections.
This document summarizes PHP's magic methods. It discusses the purpose and usage of various magic methods like __construct(), __destruct(), __toString(), __get(), __set(), __isset(), __unset(), __call(), __clone(), __set_state(), __callStatic(), __sleep(), __wakeup(), __invoke(), and __autoload(). It provides examples of how each magic method works and when they are called. The document is intended to introduce developers to PHP's magic methods in about an hour and covers their basics.
От экспериментов с инфраструктурой до внедрения в продакшенDmitry Makhnev
The document discusses testing and development tools and workflows for JavaScript applications. It covers testing frameworks like Jasmine and Mocha, test runners like Karma, dependency managers like npm and webpack, and task runners like Gulp. It also discusses testing techniques like unit testing, integration testing, and behavior-driven development. Code examples demonstrate using these tools to test JavaScript code and build bundles for deployment.
This document contains code for a login form and main interface for a grain management application. The login form allows users to enter credentials which are validated against hardcoded values. If valid, it opens the main interface containing buttons for various application functions. The interface is initialized by calling initComponents() which sets up the layout and UI elements.
New methods for exploiting ORM injections in Java applicationsMikhail Egorov
This document summarizes new methods for exploiting ORM injections in Java applications. It begins with introductions to ORM, JPA, and common ORM libraries. It then outlines several exploitation techniques, including using special functions in EclipseLink and TopLink to call database functions, abusing string handling and quote processing in OpenJPA, and leveraging features in Hibernate and specific databases like string escaping, quoted strings, magic functions, and Unicode delimiters. Code examples and demonstrations are provided for most of the techniques.
This document contains Java code for a student portal application. It defines a StudentDetailsForm class that initializes a GUI with labels, text fields, buttons etc to allow entry of student details like name, ID, date of birth, address etc. It connects to an Oracle database and includes methods for submitting the student details to a database table on button click, and refreshing the form fields.
The document describes a project that provides online quizzes to test knowledge on various topics using database connectivity. It includes source code for login, registration, menu selection, quiz questions, and results display screens. The project uses Java Swing for the front-end and MySQL database to store user details, questions, answers, and test performance. It allows users to register, select a subject to test, attempt questions, view results, and retake tests.
The document discusses removing structural duplication from code. It defines structural duplication as similar code structures that repeat even if the internal actions differ. Examples given include conditional statements, exception handling, and views. The risks of duplication include increased size and unintended changes. The document provides steps to remove duplication such as separating structure from actions, extracting data models, and using loops to consolidate duplicated code. Both advantages like improved separation of concerns and disadvantages like increased rigidity are discussed.
ORM2Pwn: Exploiting injections in Hibernate ORMMikhail Egorov
Mikhail Egorov and Sergey Soldatov presented their research on exploiting injections in Hibernate ORM. They demonstrated that while Hibernate Query Language (HQL) is more limited than SQL, it is possible to exploit HQL injections to conduct SQL injections on popular databases like MySQL, PostgreSQL, Oracle, and Microsoft SQL Server. They did this by leveraging features of Hibernate and the databases like how Hibernate handles string escaping and allows unicode characters in identifiers. Their talk provided examples of exploiting each database and a takeaway that Hibernate is not a web application firewall and HQL injections can be used to perform SQL injections.
This document summarizes PHP's magic methods. It discusses the purpose and usage of various magic methods like __construct(), __destruct(), __toString(), __get(), __set(), __isset(), __unset(), __call(), __clone(), __set_state(), __callStatic(), __sleep(), __wakeup(), __invoke(), and __autoload(). It provides examples of how each magic method works and when they are called. The document is intended to introduce developers to PHP's magic methods in about an hour and covers their basics.
От экспериментов с инфраструктурой до внедрения в продакшенDmitry Makhnev
The document discusses testing and development tools and workflows for JavaScript applications. It covers testing frameworks like Jasmine and Mocha, test runners like Karma, dependency managers like npm and webpack, and task runners like Gulp. It also discusses testing techniques like unit testing, integration testing, and behavior-driven development. Code examples demonstrate using these tools to test JavaScript code and build bundles for deployment.
This document contains the code for a Java library management system. It defines classes and methods for login authentication, adding/deleting books and users, changing passwords, and issuing/viewing books. Frames and panels are created to display the login screen and main screens. Buttons trigger methods to perform actions like login validation, querying the database, and displaying results.
This document discusses ORM injection vulnerabilities using Hibernate and MySQL as an example. It begins with an introduction to injection vulnerabilities and ORM concepts. It then demonstrates how SQL injection is possible by exploiting differences in escaping rules between HQL and MySQL. A proof of concept shows injecting HQL to retrieve all records, and injecting SQL directly by escaping quotes differently. The document concludes that input validation and parameterized queries are needed to prevent ORM injection, and frameworks may not fully prevent injection depending on the underlying database.
#ITsubbotnik Spring 2017: Roman Iovlev "Java edge in test automation"epamspb
This document discusses how Java 8 features can improve test automation. It covers lambda expressions, streams, and other Java 8 features that enable more declarative programming and reduce code. Examples show filtering, mapping, and reducing collections of data in more concise ways using streams. The document also discusses Java interfaces, preconditions for testing, entity-driven testing with Java Driver Interface, and new features in Java 9.
Accessing Data Through Hibernate; What DBAs Should Tell Developers and Vice V...Marco Tusa
Hibernate is an object-relational mapping tool that allows developers to access and manage relational database data using object-oriented programming. It maps database tables to Java classes and rows to objects. The document discusses how Hibernate works, how it interacts with databases like MySQL, and what developers and DBAs need to know to effectively use Hibernate for data access and management while optimizing database performance.
This is a basic JAVA pgm that contains all of the major compoents of DB2Sheila A. Bell, MS, PMP
This Java program contains methods for performing common database operations on a DB2 table including creating a table, inserting records, updating records, deleting records, and reading records. The methods connect to the database, execute the necessary SQL statements, and handle exceptions to create, read, update and delete records in the table.
Lean React - Patterns for High Performance [ploneconf2017]Devon Bernard
Modern web tools are enabling developers to build web apps in no-wifi and low-fi environments. This talk is about performance and how frontend engineers can create a better user experience while using less resources.
Talk presented on Oct 20, 2017 at PloneConf2017.
Topics:
Airplane mode for web apps:
Mobile and native apps get lots of praise for offline mode. But why aren’t we seeing more web-apps using this. Two reasons: persistent data and code storage. We can now provide offline apps with Web Workers and IndexedDB that also improve the smoothness and robustness of our web apps in high bandwidth environments.
Redux:
Persisting state, store middleware, store subscriptions, normalizing data, normalizr, pure reducers, redux dev tools
Components:
Data heavy pages, component blocks, component skeletons, component lifecycle, shouldComponentUpdate, virtual dom, chrome render tools, method binding
Actions:
ActionTypes, action chaining, promises, store.getState()
General:
env files, route wrappers, offline first, web workers, indexeddb, eslint, airbnb style guide
Nagios Conference 2014 - Troy Lea - JavaScript and jQuery - Nagios XI Tips, T...Nagios
Troy Lea's presentation on JavaScript and jQuery - Nagios XI Tips, Tricks and How-To.
The presentation was given during the Nagios World Conference North America held Oct 13th - Oct 16th, 2014 in Saint Paul, MN. For more information on the conference (including photos and videos), visit: http://go.nagios.com/conference
This document discusses simple JDBC usage with Spring 2.5. It introduces the speaker and covers topics including when plain JDBC is more appropriate than an ORM, new Spring 2.5 JDBC features like SimpleJdbcTemplate and SimpleJdbcCall, and examples of using these features for basic queries, updates, inserts, and stored procedures. Live code demonstrations are provided to illustrate working with SimpleJdbcTemplate, SimpleJdbcInsert, and SimpleJdbcCall.
Introduction to Active Record at MySQL Conference 2007Rabble .
Active Record is an object-relational mapping pattern that allows mapping database tables to object classes. It uses the principle of "convention over configuration" to minimize configuration work. The Active Record pattern is implemented in Ruby on Rails through the ActiveRecord library, which provides methods for CRUD operations and associations between models. It aims to make working with databases and ORM intuitive for developers.
Hibernate is an object-relational mapping tool that allows Java objects to be persisted to a relational database. It provides transparent persistence by handling all database operations like insert, update, delete, and retrieval. Hibernate sits between the Java application and database, mapping objects to database tables and allowing developers to work with objects rather than directly with SQL statements. Configuration files define the mappings between Java classes and database tables. Hibernate uses these mappings to automatically generate SQL to load and store objects.
This document describes a Java program that provides a GUI for configuring and running an ETM server. The program displays panels for selecting configuration options like performing initial setup tasks, updating Java/JavaScript, starting the Tomcat server, and advanced settings. Based on the selected options, it will run tasks like copying files, updating configuration files, and starting services. It uses multiple threads to run long-running tasks without blocking the GUI.
The document provides information about HTML forms and JavaScript. It includes examples of HTML form fields like text, password, checkbox, radio buttons, and submit buttons. It also discusses how JavaScript can be used to validate form data, submit forms, and perform calculations. The last part discusses AJAX and how JavaScript and XMLHttpRequest object can be used to make asynchronous calls to retrieve and display data without reloading the page.
This document provides an overview of Python fundamentals including installing Python, hidden documentation tools, data types, strings, lists, tuples, dictionaries, control flow statements, functions, classes, the datetime library, importing modules, and web2py fundamentals such as the request and response objects, templates, controllers, models, and more. Key concepts covered include Python types like strings, lists, tuples and dictionaries, control structures like if/else and for loops, functions, classes and objects, and the basics of using the web2py framework to build web applications.
Detecting Broken Pointcuts using Structural Commonality and Degree of InterestRaffi Khatchadourian
Pointcut fragility is a well-documented problem in Aspect-Oriented Programming; changes to the base-code can lead to join points incorrectly falling in or out of the scope of pointcuts. Deciding which pointcuts have broken due to base-code changes is a daunting venture, especially in large and complex systems. We present an automated approach that recommends pointcuts that are likely to require modification due to a particular base-code change, as well as ones that do not. Our hypothesis is that join points selected by a pointcut exhibit common structural characteristics. Patterns describing such commonality are used to recommend pointcuts that have potentially broken with a degree of confidence as the developer is typing. The approach is implemented as an extension to the popular Mylyn Eclipse IDE plug-in, which maintains focused contexts of entities relevant to the task at hand using a Degree of Interest (DOI) model. We show that it is accurate in revealing broken pointcuts by applying it to multiple versions of several open source projects and evaluating the quality of the recommendations produced against actual modifications.
SQLAdria 2009 presentation's slides about our experience with Maven and SQLJ. It delves in some details about SQLJ and performance comparion between SQLJ and JDBC with prepared statements. It also shows surprising results for what concerns performances of (DB2) SQL PL procedures
This document describes 10 steps to achieve a 10x performance improvement for a MySQL database for a social media website. The steps include monitoring the database, identifying slow SQL queries, analyzing problem queries, improving indexes, offloading read load to slaves, improving SQL, using optimal storage engines, and implementing caching. Key actions include installing monitoring tools, using mk-query-digest to analyze SQL, adding indexes, configuring InnoDB, converting tables to InnoDB, and caching query results and content with Memcache. The goal is to optimize the database infrastructure and queries to handle the load of a growing web 2.0 application.
OQL querying and indexes with Apache Geode (incubating)Jason Huynh
OQL is a SQL-like language for querying objects and data in Geode. It allows querying on any object attributes and invoking methods. Indexes can significantly improve query performance and avoid scanning entire regions. Different types of indexes include functional, functional compact, key, hash, and map indexes. Partitioned and colocated regions can be queried using functions or equijoins with some restrictions. General tips include matching from clauses to indexes, ordering AND filters by selectivity, and using hints to prefer indexes.
Web2py tutorial to create db driven application.fRui Apps
This document summarizes how to create a simple database driven application using the web2py python framework. It outlines downloading and running web2py, creating an application, modeling the database with a 'notes' table with various fields, and defining functions to handle CRUD operations like indexing all notes, creating a new note, and editing a note. Templates are also created to display the notes index and create/edit forms. The full source code is provided.
Spring 3 emphasizes annotation configuration over XML. Key changes include support for JSR 250, 299/330, and 303 annotations as well as a simplified MVC framework with @Controller and @RequestMapping annotations. Validation is integrated using JSR 303 annotations and executed automatically by the framework. Configuration is also simplified through @Configuration classes and the @Bean annotation.
This document discusses 10 typical problems seen in enterprise Java applications. Problem #6 is having no data access object (DAO) layer, resulting in services directly using persistence mechanisms like JPA or JDBC. This makes code impossible to test without a database, tightly couples services to persistence, and provides no structure for adding data-dependent features like security. The solution is to use a DAO layer to abstract away the persistence, separating this technical concern from the service layer.
This document provides an overview of using JDBC (Java Database Connectivity) to connect Java applications to relational databases. It discusses downloading and configuring the JDBC driver, executing SQL statements to query and manipulate data, processing result sets, and properly closing connections. Transactions are also introduced to group statements and ensure all succeed or fail together.
This document provides an overview of how to access a database in Java using JDBC. It discusses getting a connection to the database, creating statements to execute SQL commands, and using result sets to access query results. It also covers key concepts like prepared statements to prevent SQL injection, design patterns used in JDBC like the factory and iterator patterns, and options for object relational mapping frameworks.
This document contains the code for a Java library management system. It defines classes and methods for login authentication, adding/deleting books and users, changing passwords, and issuing/viewing books. Frames and panels are created to display the login screen and main screens. Buttons trigger methods to perform actions like login validation, querying the database, and displaying results.
This document discusses ORM injection vulnerabilities using Hibernate and MySQL as an example. It begins with an introduction to injection vulnerabilities and ORM concepts. It then demonstrates how SQL injection is possible by exploiting differences in escaping rules between HQL and MySQL. A proof of concept shows injecting HQL to retrieve all records, and injecting SQL directly by escaping quotes differently. The document concludes that input validation and parameterized queries are needed to prevent ORM injection, and frameworks may not fully prevent injection depending on the underlying database.
#ITsubbotnik Spring 2017: Roman Iovlev "Java edge in test automation"epamspb
This document discusses how Java 8 features can improve test automation. It covers lambda expressions, streams, and other Java 8 features that enable more declarative programming and reduce code. Examples show filtering, mapping, and reducing collections of data in more concise ways using streams. The document also discusses Java interfaces, preconditions for testing, entity-driven testing with Java Driver Interface, and new features in Java 9.
Accessing Data Through Hibernate; What DBAs Should Tell Developers and Vice V...Marco Tusa
Hibernate is an object-relational mapping tool that allows developers to access and manage relational database data using object-oriented programming. It maps database tables to Java classes and rows to objects. The document discusses how Hibernate works, how it interacts with databases like MySQL, and what developers and DBAs need to know to effectively use Hibernate for data access and management while optimizing database performance.
This is a basic JAVA pgm that contains all of the major compoents of DB2Sheila A. Bell, MS, PMP
This Java program contains methods for performing common database operations on a DB2 table including creating a table, inserting records, updating records, deleting records, and reading records. The methods connect to the database, execute the necessary SQL statements, and handle exceptions to create, read, update and delete records in the table.
Lean React - Patterns for High Performance [ploneconf2017]Devon Bernard
Modern web tools are enabling developers to build web apps in no-wifi and low-fi environments. This talk is about performance and how frontend engineers can create a better user experience while using less resources.
Talk presented on Oct 20, 2017 at PloneConf2017.
Topics:
Airplane mode for web apps:
Mobile and native apps get lots of praise for offline mode. But why aren’t we seeing more web-apps using this. Two reasons: persistent data and code storage. We can now provide offline apps with Web Workers and IndexedDB that also improve the smoothness and robustness of our web apps in high bandwidth environments.
Redux:
Persisting state, store middleware, store subscriptions, normalizing data, normalizr, pure reducers, redux dev tools
Components:
Data heavy pages, component blocks, component skeletons, component lifecycle, shouldComponentUpdate, virtual dom, chrome render tools, method binding
Actions:
ActionTypes, action chaining, promises, store.getState()
General:
env files, route wrappers, offline first, web workers, indexeddb, eslint, airbnb style guide
Nagios Conference 2014 - Troy Lea - JavaScript and jQuery - Nagios XI Tips, T...Nagios
Troy Lea's presentation on JavaScript and jQuery - Nagios XI Tips, Tricks and How-To.
The presentation was given during the Nagios World Conference North America held Oct 13th - Oct 16th, 2014 in Saint Paul, MN. For more information on the conference (including photos and videos), visit: http://go.nagios.com/conference
This document discusses simple JDBC usage with Spring 2.5. It introduces the speaker and covers topics including when plain JDBC is more appropriate than an ORM, new Spring 2.5 JDBC features like SimpleJdbcTemplate and SimpleJdbcCall, and examples of using these features for basic queries, updates, inserts, and stored procedures. Live code demonstrations are provided to illustrate working with SimpleJdbcTemplate, SimpleJdbcInsert, and SimpleJdbcCall.
Introduction to Active Record at MySQL Conference 2007Rabble .
Active Record is an object-relational mapping pattern that allows mapping database tables to object classes. It uses the principle of "convention over configuration" to minimize configuration work. The Active Record pattern is implemented in Ruby on Rails through the ActiveRecord library, which provides methods for CRUD operations and associations between models. It aims to make working with databases and ORM intuitive for developers.
Hibernate is an object-relational mapping tool that allows Java objects to be persisted to a relational database. It provides transparent persistence by handling all database operations like insert, update, delete, and retrieval. Hibernate sits between the Java application and database, mapping objects to database tables and allowing developers to work with objects rather than directly with SQL statements. Configuration files define the mappings between Java classes and database tables. Hibernate uses these mappings to automatically generate SQL to load and store objects.
This document describes a Java program that provides a GUI for configuring and running an ETM server. The program displays panels for selecting configuration options like performing initial setup tasks, updating Java/JavaScript, starting the Tomcat server, and advanced settings. Based on the selected options, it will run tasks like copying files, updating configuration files, and starting services. It uses multiple threads to run long-running tasks without blocking the GUI.
The document provides information about HTML forms and JavaScript. It includes examples of HTML form fields like text, password, checkbox, radio buttons, and submit buttons. It also discusses how JavaScript can be used to validate form data, submit forms, and perform calculations. The last part discusses AJAX and how JavaScript and XMLHttpRequest object can be used to make asynchronous calls to retrieve and display data without reloading the page.
This document provides an overview of Python fundamentals including installing Python, hidden documentation tools, data types, strings, lists, tuples, dictionaries, control flow statements, functions, classes, the datetime library, importing modules, and web2py fundamentals such as the request and response objects, templates, controllers, models, and more. Key concepts covered include Python types like strings, lists, tuples and dictionaries, control structures like if/else and for loops, functions, classes and objects, and the basics of using the web2py framework to build web applications.
Detecting Broken Pointcuts using Structural Commonality and Degree of InterestRaffi Khatchadourian
Pointcut fragility is a well-documented problem in Aspect-Oriented Programming; changes to the base-code can lead to join points incorrectly falling in or out of the scope of pointcuts. Deciding which pointcuts have broken due to base-code changes is a daunting venture, especially in large and complex systems. We present an automated approach that recommends pointcuts that are likely to require modification due to a particular base-code change, as well as ones that do not. Our hypothesis is that join points selected by a pointcut exhibit common structural characteristics. Patterns describing such commonality are used to recommend pointcuts that have potentially broken with a degree of confidence as the developer is typing. The approach is implemented as an extension to the popular Mylyn Eclipse IDE plug-in, which maintains focused contexts of entities relevant to the task at hand using a Degree of Interest (DOI) model. We show that it is accurate in revealing broken pointcuts by applying it to multiple versions of several open source projects and evaluating the quality of the recommendations produced against actual modifications.
SQLAdria 2009 presentation's slides about our experience with Maven and SQLJ. It delves in some details about SQLJ and performance comparion between SQLJ and JDBC with prepared statements. It also shows surprising results for what concerns performances of (DB2) SQL PL procedures
This document describes 10 steps to achieve a 10x performance improvement for a MySQL database for a social media website. The steps include monitoring the database, identifying slow SQL queries, analyzing problem queries, improving indexes, offloading read load to slaves, improving SQL, using optimal storage engines, and implementing caching. Key actions include installing monitoring tools, using mk-query-digest to analyze SQL, adding indexes, configuring InnoDB, converting tables to InnoDB, and caching query results and content with Memcache. The goal is to optimize the database infrastructure and queries to handle the load of a growing web 2.0 application.
OQL querying and indexes with Apache Geode (incubating)Jason Huynh
OQL is a SQL-like language for querying objects and data in Geode. It allows querying on any object attributes and invoking methods. Indexes can significantly improve query performance and avoid scanning entire regions. Different types of indexes include functional, functional compact, key, hash, and map indexes. Partitioned and colocated regions can be queried using functions or equijoins with some restrictions. General tips include matching from clauses to indexes, ordering AND filters by selectivity, and using hints to prefer indexes.
Web2py tutorial to create db driven application.fRui Apps
This document summarizes how to create a simple database driven application using the web2py python framework. It outlines downloading and running web2py, creating an application, modeling the database with a 'notes' table with various fields, and defining functions to handle CRUD operations like indexing all notes, creating a new note, and editing a note. Templates are also created to display the notes index and create/edit forms. The full source code is provided.
Spring 3 emphasizes annotation configuration over XML. Key changes include support for JSR 250, 299/330, and 303 annotations as well as a simplified MVC framework with @Controller and @RequestMapping annotations. Validation is integrated using JSR 303 annotations and executed automatically by the framework. Configuration is also simplified through @Configuration classes and the @Bean annotation.
This document discusses 10 typical problems seen in enterprise Java applications. Problem #6 is having no data access object (DAO) layer, resulting in services directly using persistence mechanisms like JPA or JDBC. This makes code impossible to test without a database, tightly couples services to persistence, and provides no structure for adding data-dependent features like security. The solution is to use a DAO layer to abstract away the persistence, separating this technical concern from the service layer.
This document provides an overview of using JDBC (Java Database Connectivity) to connect Java applications to relational databases. It discusses downloading and configuring the JDBC driver, executing SQL statements to query and manipulate data, processing result sets, and properly closing connections. Transactions are also introduced to group statements and ensure all succeed or fail together.
This document provides an overview of how to access a database in Java using JDBC. It discusses getting a connection to the database, creating statements to execute SQL commands, and using result sets to access query results. It also covers key concepts like prepared statements to prevent SQL injection, design patterns used in JDBC like the factory and iterator patterns, and options for object relational mapping frameworks.
This Java program demonstrates how to scroll through the results of a database query in different directions and positions using a scrollable and updatable JDBC ResultSet. It connects to an Oracle database, executes a query on the student table, and then displays the records in various orders and positions - from top to bottom, bottom to top, and randomly by using ResultSet methods like next(), previous(), first(), last(), relative(), and absolute(). These methods allow navigating through the result set in both forward and backward directions as well as jumping to a particular row.
The document describes 5 Java programming experiments related to database access and web applications:
1. A program that accesses a table from an MS Access database.
2. A similar program that accesses a table from a Derby database.
3. A program that implements remote method invocation using an interface.
4. A simple servlet program that outputs HTML.
5. A servlet program that connects to a Derby database and outputs records.
The document discusses test integration and provides examples of how to use the jIntegrity library to simplify database integration testing. It shows how jIntegrity can load test data from XML files, execute SQL statements to insert, update, delete and clean data, and be configured through properties files. jIntegrity aims to provide flexibility, organization and reuse through its API and helper classes to help automate common database operations for integration testing.
The document discusses configuring Tomcat connection pools. It describes preparing Tomcat by adding jar files, configuring the server.xml file and context.xml files, and testing connection pools using JSP. It also covers how Tomcat 6 supports connection pools using dbcp and how JdbcRowSet can use connection pools.
User exits in Informatica MDM allow custom Java code to extend functionality at specific points in batch or API processes. A user exit is called by MDM Hub to run user-developed code with input parameters. Sample code is provided for a post-landing user exit that prints values, connects to the database, and calls a custom procedure. The different types of user exits are described for various MDM processes like staging, loading, matching, and merging. Common uses of user exits include data transformation, reject processing, loading related data, and manipulating child records.
This document describes a quiz management system created by Joyita Kundu. It includes details on the database tables, menu design, form design and event coding. The database contains tables for login information, questions and results. The menu system allows users to take IP or GK tests. Forms are used for login, registration, the quiz and results. Event coding handles form interactions and database queries. The system allows users to take timed tests, view results and track performance over time.
This document contains code for a Java web application that allows users to submit a registration form with their first name, last name, and email address. The form submission is handled by a JSP page that inserts the user details into a MySQL database using Java and JDBC. It then queries the database and displays the stored users in an HTML table. The code includes classes for the User object model and a SQLDBUtil class for database operations like insertion, updating, and checking if a user already exists by email.
The document provides templates and examples for creating Swing-based GUI applications, servlets, Java Server Pages (JSP), Java Database Connectivity (JDBC), Java Server Faces (JSF), Enterprise Java Beans (EJB), Hibernate, Struts, and web services in Java. It includes templates for common GUI components, servlets, JSP tags, database queries, managed beans, navigation rules, entity beans, Hibernate mappings, actions, and web service providers/consumers.
Developing Applications with MySQL and Java for beginnersSaeid Zebardast
A presentation about Developing Applications with MySQL and Java for beginners. It includes the following topics:
- Requirements
- MySQL Data Definitions
- Java Classes
- MySQL Connector (JDBC)
- Define Methods
- Compile and Run
This document describes a Java program that uses a transaction management tool to transfer money between bank accounts. The program gets input from the user for the source and destination account numbers and amount. It then uses JDBC to connect to an Oracle database, begins a transaction, withdraws money from one account and deposits it into another using a batch process, and then either commits or rolls back the transaction based on the results of executing the batch. Finally it closes the JDBC connections.
The document discusses how to access a MySQL database from a Struts 2 application. It describes setting up the database with a table and data. It then covers creating a Struts 2 action class to query the database on user login, and JSP views for successful and failed logins. Configuration files including struts.xml and web.xml are provided to wire it all together.
The document provides information about Java Database Connectivity (JDBC). It discusses what JDBC is, the prerequisites for using JDBC, how to set up the JDBC environment, and the steps to create a basic JDBC application. It also covers extracting data from result sets, handling SQL exceptions, JDBC data types, and examples for creating and selecting a database using JDBC.
This document contains code for a Java application that uses a cursor to retrieve employee data from an Oracle database based on a user-input initial character search string. The application connects to the database, calls a stored procedure that accepts the search string and returns a cursor of matching records, iterates through the cursor to retrieve each matching record, and displays the employee details.
The document discusses the Java Database Connectivity (JDBC) API for accessing tabular data sources like relational databases from Java code. It provides steps for connecting to an Oracle database using JDBC, executing SQL statements to retrieve and manipulate data, handling transactions, and obtaining metadata about the database. Key classes in JDBC include Connection, Statement, and ResultSet. The multi-tier architecture of JDBC separates the data access logic from the business logic and user interface.
Class 12 ip project on wwe management system
sql databases available
netbeans file available
made in year 2018-19
unique topic
easy java coding used
made in netbeans version 8.1
ready to print
The document describes three Java programs for calculating simple mathematical operations and values:
1. A calculator program that allows users to enter two numbers and select a mathematical operation (addition, subtraction, multiplication, or division) to perform the calculation.
2. A program that calculates severance pay values based on a user's time of service and monthly salary.
3. A program that provides budget estimates for different construction/remodeling jobs based on area size and material selections.
The document discusses refactoring JDBC code using the Strategy pattern and Spring JdbcTemplate. It describes identifying variable and constant parts of JDBC code and extracting them. Template methods are created using callback interfaces to encapsulate common JDBC operations like querying and updating. This improves code reuse and reduces duplication. Spring JdbcTemplate is also introduced as it implements the Strategy pattern and provides convenience for common data access tasks while maintaining flexibility.
Java!!!!!Create a program that authenticates username and password.pdfarvindarora20042013
Java!!!!!
Create a program that authenticates username and password. The program should have a clear
and submit button. If you click sumbit it will go to a new JFrame. The new Jframe contain a
menu button( that does nothing) and a logout button that exits the program.
Solution
import java.sql.*;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.*;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Administrator
*/
public class Login extends javax.swing.JFrame {
/**
* Creates new form Login
*/
public Login() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings(\"unchecked\")
//
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jPasswordField1 = new javax.swing.JPasswordField();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setFont(new java.awt.Font(\"Tahoma\", 1, 18)); // NOI18N
jLabel1.setText(\"Hiding Data Cloud \");
jLabel2.setFont(new java.awt.Font(\"Tahoma\", 1, 12)); // NOI18N
jLabel2.setText(\"User Name : \");
jLabel3.setFont(new java.awt.Font(\"Tahoma\", 1, 12)); // NOI18N
jLabel3.setText(\"Password :\");
jButton1.setText(\"Login\");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(96, 96, 96)
.addComponent(jLabel1))
.addGroup(layout.createSequentialGroup()
.addGap(69, 69, 69)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 134,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel3)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton1)
.addComponent(jPasswordField1))))))
.addContainerGap(112, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(35, 35, 35)
.addComponent(jLabel1)
.addGap(53, 53, 53)
.addGroup(layout.creat.
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...PECB
Denis is a dynamic and results-driven Chief Information Officer (CIO) with a distinguished career spanning information systems analysis and technical project management. With a proven track record of spearheading the design and delivery of cutting-edge Information Management solutions, he has consistently elevated business operations, streamlined reporting functions, and maximized process efficiency.
Certified as an ISO/IEC 27001: Information Security Management Systems (ISMS) Lead Implementer, Data Protection Officer, and Cyber Risks Analyst, Denis brings a heightened focus on data security, privacy, and cyber resilience to every endeavor.
His expertise extends across a diverse spectrum of reporting, database, and web development applications, underpinned by an exceptional grasp of data storage and virtualization technologies. His proficiency in application testing, database administration, and data cleansing ensures seamless execution of complex projects.
What sets Denis apart is his comprehensive understanding of Business and Systems Analysis technologies, honed through involvement in all phases of the Software Development Lifecycle (SDLC). From meticulous requirements gathering to precise analysis, innovative design, rigorous development, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: May 29, 2024
Tags: Information Security, ISO/IEC 27001, ISO/IEC 42001, Artificial Intelligence, GDPR
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 27001 Information Security Management System - EN | PECB
ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
General Data Protection Regulation (GDPR) - Training Courses - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
For more information about PECB:
Website: https://pecb.com/
LinkedIn: https://www.linkedin.com/company/pecb/
Facebook: https://www.facebook.com/PECBInternational/
Slideshare: http://www.slideshare.net/PECBCERTIFICATION
How to Build a Module in Odoo 17 Using the Scaffold MethodCeline George
Odoo provides an option for creating a module by using a single line command. By using this command the user can make a whole structure of a module. It is very easy for a beginner to make a module. There is no need to make each file manually. This slide will show how to create a module using the scaffold method.
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
This slide is special for master students (MIBS & MIFB) in UUM. Also useful for readers who are interested in the topic of contemporary Islamic banking.
This presentation was provided by Steph Pollock of The American Psychological Association’s Journals Program, and Damita Snow, of The American Society of Civil Engineers (ASCE), for the initial session of NISO's 2024 Training Series "DEIA in the Scholarly Landscape." Session One: 'Setting Expectations: a DEIA Primer,' was held June 6, 2024.
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
বাংলাদেশের অর্থনৈতিক সমীক্ষা ২০২৪ [Bangladesh Economic Review 2024 Bangla.pdf] কম্পিউটার , ট্যাব ও স্মার্ট ফোন ভার্সন সহ সম্পূর্ণ বাংলা ই-বুক বা pdf বই " সুচিপত্র ...বুকমার্ক মেনু 🔖 ও হাইপার লিংক মেনু 📝👆 যুক্ত ..
আমাদের সবার জন্য খুব খুব গুরুত্বপূর্ণ একটি বই ..বিসিএস, ব্যাংক, ইউনিভার্সিটি ভর্তি ও যে কোন প্রতিযোগিতা মূলক পরীক্ষার জন্য এর খুব ইম্পরট্যান্ট একটি বিষয় ...তাছাড়া বাংলাদেশের সাম্প্রতিক যে কোন ডাটা বা তথ্য এই বইতে পাবেন ...
তাই একজন নাগরিক হিসাবে এই তথ্য গুলো আপনার জানা প্রয়োজন ...।
বিসিএস ও ব্যাংক এর লিখিত পরীক্ষা ...+এছাড়া মাধ্যমিক ও উচ্চমাধ্যমিকের স্টুডেন্টদের জন্য অনেক কাজে আসবে ...
This presentation includes basic of PCOS their pathology and treatment and also Ayurveda correlation of PCOS and Ayurvedic line of treatment mentioned in classics.
15. /**
* @paramargs the command linearguments
*/
public static void main(Stringargs[]) {
java.awt.EventQueue.invokeLater(new
Runnable() {
public void run() {
new login().setVisible(true);
}
});
}
// Variables declaration - do not modify
privatejavax.swing.JButton LogInB;
privatejavax.swing.JPasswordField PassWordTF;
privatejavax.swing.JTextField idtf;
privatejavax.swing.JLabel invalid;
privatejavax.swing.JLabel invalidl;
privatejavax.swing.JDialogjDialog1;
privatejavax.swing.JLabel jLabel1;
privatejavax.swing.JLabel jLabel2;
privatejavax.swing.JLabel jLabel3;
privatejavax.swing.JLabel jLabel4;
privatejavax.swing.JLabel jLabel6;
privatejavax.swing.JPopupMenu jPopupMenu1;
privatejavax.swing.JPopupMenu jPopupMenu2;
// End of variables declaration
}
*****************************************
MAIN UI
*****************************************
public classMainUI extends javax.swing.JFrame{
/** Creates new form MainUI */
public MainUI() {
initComponents();
}
/** This method is called fromwithin the
constructor to
* initializethe form.
* WARNING: Do NOT modify this code. The
content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed"
desc="Generated Code">
privatevoid initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu2 = new javax.swing.JMenu();
mnuLib = new javax.swing.JMenuItem();
mnuLibEdit = new javax.swing.JMenuItem();
mnuIssue= new javax.swing.JMenuItem();
mnuReturn = new javax.swing.JMenuItem();
jMenu1 = new javax.swing.JMenu();
mnuPub = new javax.swing.JMenuItem();
mnuPMod = new javax.swing.JMenuItem();
mnuPDel = new javax.swing.JMenuItem();
mnuPNav = new javax.swing.JMenuItem();
jMenu3 = new javax.swing.JMenu();
mnuMemb = new javax.swing.JMenuItem();
mnuMMod = new javax.swing.JMenuItem();
mnuMDel = new javax.swing.JMenuItem();
mnuMNav = new javax.swing.JMenuItem();
jMenu4 = new javax.swing.JMenu();
mnuABList = new javax.swing.JMenuItem();
mnuIBList = new javax.swing.JMenuItem();
mnuMList = new javax.swing.JMenuItem();
jMenu5 = new javax.swing.JMenu();
mnuQuit = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowCon
stants.EXIT_ON_CLOSE);
setTitle("Library Management System ||
www.ezindagi.in ||");
setBounds(new java.awt.Rectangle(200,70, 0,
0));
jLabel1.setFont(new java.awt.Font("Monotype
Corsiva",0,36));
jLabel1.setForeground(new
java.awt.Color(153,0,153));
jLabel1.setHorizontalAlignment(javax.swing.Swing
Constants.CENTER);
jLabel1.setText("Library Application");
jLabel2.setFont(new
java.awt.Font("Helvetica", 1, 30)); // NOI18N
31. privatevoid
jList1MouseClicked(java.awt.event.MouseEvent
evt) {
// getSelectedValue() method extracts the
current cursor location valueinto a variable
String MembNo = (String)
jList1.getSelectedValue();
// Extract the first4 characters as Member No
into a variable
String Mno =MembNo.trim().substring(0, 3);
String query = "SELECT * FROM member
WHERE memb_no = " + (Mno) + ";";
try {
Class.forName("com.mysql.jdbc.Driver").newInsta
nce();
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://local
host:3306/Library","root","root");
// Create SQL statement and execute query.
stmt = con.createStatement();
rs = stmt.executeQuery(query);
if (rs.next()) {
String MName =
rs.getString("memb_name");
String MDate = rs.getString("mdate");
String MStatus =
rs.getString("mem_status");
// Displayingthecontents in respective
text boxes.
txtMNo.setText(Mno);
txtMName.setText(MName);
txtMDate.setText(MDate);
txtMStatus.setText(MStatus);
} else {
JOptionPane.showMessageDialog(null,
"Record does not found in Member table");
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this,
e.getMessage());
}
}
privatevoid
formWindowGainedFocus(java.awt.event.Window
Event evt) {
txtMNo.setEditable(false);
txtMName.setEditable(false);
txtMDate.setEditable(false);
txtMStatus.setEditable(false);
txtAcno.setEditable(false);
txtBTitle.setEditable(false);
txtAuth1.setEditable(false);
txtPID.setEditable(false);
txtStatus.setEditable(false);
// dModel to perform DefaultListModel for
Member
// method operations
DefaultListModel dModel = (DefaultListModel)
jList1.getModel();
// Method to add elements into jList1 control
for member
dModel.clear();
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://local
host:3306/Library","root","root");
// ListingMembers
stmt = con.createStatement();
rs = stmt.executeQuery(SQL);
while (rs.next()) {
String Mno = rs.getString("memb_no");
String MName =
rs.getString("memb_name");
// To make the Member no. as 4 digit
because we will extract4 digitfrom listvalue
// in mouse click event.
if (Mno.length() < 4)
{
int x = Mno.length();
int nl = 4 - x;
while (nl > 0){
Mno = Mno + " ";
nl--;
}
}
dModel.addElement(Mno + "- " +
MName);
}
jList1.setModel(dModel);
// cModel to perform DefaultListModel for
Library
// method operations
32. DefaultListModel cModel =
(DefaultListModel) jList2.getModel();
// Method to add elements into jList1
control for Library
cModel.clear();
// Listingbooks
stmt1 = con.createStatement();
rs1 = stmt1.executeQuery(SQL1);
while (rs1.next()) {
String Ano = rs1.getString("acc_no");
String BTitle = rs1.getString("btitle");
// To make the Accession no. as 4 digit
because we will extract4 digitfrom listvalue
// in mouse click event.
if (Ano.length() < 4)
{
int x = Ano.length();
int nl = 4 - x;
while (nl > 0){
Ano = Ano + " ";
nl--;
}
}
cModel.addElement(Ano + "- " + BTitle);
}
jList2.setModel(cModel);
} catch (Exception e) {
JOptionPane.showMessageDialog(this,e.getMessa
ge());
e.printStackTrace();
}
}
privatevoid
txtMNameActionPerformed(java.awt.event.Action
Event evt) {
}
privatevoid
txtMNamePropertyChange(java.beans.PropertyCh
angeEvent evt) {
}
privatevoid
txtMNameKeyPressed(java.awt.event.KeyEvent
evt) {
}
privatevoid
cmdExitActionPerformed(java.awt.event.ActionEv
ent evt) {
new MainUI ().setVisible(true);
dispose();
}
privatevoid
jList2MouseClicked(java.awt.event.MouseEvent
evt) {
// getSelectedValue() method extracts the
current cursor location valueinto a variable
String MBook = (String)
jList2.getSelectedValue();
// Extract the first4 characters as Accession
number into a variable
String Acno =MBook.trim().substring(0, 3);
String query = "SELECT * FROM Lib WHERE
acc_no = " + Acno + ";";
try {
Class.forName("com.mysql.jdbc.Driver").newInsta
nce();
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://local
host:3306/Library","root","root");
// Create SQL statement and execute query.
stmt1 = con.createStatement();
rs1 = stmt1.executeQuery(query);
if (rs1.next()) {
String bTitle = rs1.getString("btitle");
String Auth1 = rs1.getString("author1");
String PID = rs1.getString("pub_id");
String PStatus = rs1.getString("status");
// Displayingthecontents in respective
text boxes.
txtAcno.setText(Acno);
txtBTitle.setText(bTitle);
txtAuth1.setText(Auth1);
txtPID.setText(PID);
txtStatus.setText(PStatus);
} else {
JOptionPane.showMessageDialog(null,
"Record does not found in Lib dent table");
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this,
e.getMessage());
}
}
33. privatevoid
cmdIssueActionPerformed(java.awt.event.ActionE
vent evt) {
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://local
host:3306/Library","root","root");
// Missuetable
stmt2 = con.createStatement();
rs2 = stmt.executeQuery(SQL);
// Tissuetable
stmt3 = con.createStatement();
rs3 = stmt.executeQuery(SQL);
int Acno =
Integer.parseInt(txtAcno.getText().trim());
int Mno =
Integer.parseInt(txtMNo.getText().trim());
String idt= txtIDate.getText();
String rdt = idt; // Temporarily assigned for
testing purpose
int code =
JOptionPane.showConfirmDialog(this,"Are you
sure to add?", "Confirmation DialogBox",
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE);
if (code == JOptionPane.YES_OPTION) {
// Record updated into Missueand Tissue
tables
String strSQL = "INSERT INTO
missue(acc_no,memb_no, idate,rdate) VALUES
("+(Acno)+", "+(Mno)+", '"+(idt)+"', '"+(rdt)+"')";
String strSQL1 = "INSERT INTO
tissue(acc_no,memb_no, idate, rdate) VALUES
("+(Acno)+", "+(Mno)+", '"+(idt)+"', '"+(rdt)+"')";
stmt2.executeUpdate(strSQL);
stmt3.executeUpdate(strSQL1);
// Change the status as library book
issued
char sta = 'N'; // Lib table
String strSQLa = "Update Lib set status
='"+(sta)+"' where acc_no = " + (Acno);
stmt1.executeUpdate(strSQLa);
// Change the status as Member has a
book
char stb = 'Y'; // Member table
String strSQLb = "Update Member set
mem_issue ='"+(stb)+"' where memb_no = " +
(Mno);
stmt.executeUpdate(strSQLb);
JOptionPane.showMessageDialog(this,
"Record update successfully");
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this,
e.getMessage());
}
}
/**
* @paramargs the command linearguments
*/
public static void main(Stringargs[]) {
java.awt.EventQueue.invokeLater(new
Runnable() {
public void run() {
new IssueUI().setVisible(true);
}
});
}
// Variables declaration - do not modify
privatejavax.swing.JButton cmdExit;
privatejavax.swing.JButton cmdIssue;
privatejavax.swing.JLabel jLabel1;
privatejavax.swing.JLabel jLabel11;
privatejavax.swing.JLabel jLabel12;
privatejavax.swing.JLabel jLabel13;
privatejavax.swing.JLabel jLabel2;
privatejavax.swing.JLabel jLabel3;
privatejavax.swing.JLabel jLabel4;
privatejavax.swing.JLabel jLabel5;
privatejavax.swing.JLabel jLabel6;
privatejavax.swing.JLabel jLabel7;
privatejavax.swing.JLabel jLabel8;
privatejavax.swing.JLabel jLabel9;
privatejavax.swing.JListjList1;
privatejavax.swing.JListjList2;
privatejavax.swing.JScrollPanejScrollPane1;
privatejavax.swing.JScrollPanejScrollPane2;
privatejavax.swing.JSeparator jSeparator1;
privatejavax.swing.JTextField txtAcno;
privatejavax.swing.JTextField txtAuth1;
privatejavax.swing.JTextField txtBTitle;
privatejavax.swing.JTextField txtIDate;
privatejavax.swing.JTextField txtMDate;
privatejavax.swing.JTextField txtMName;
privatejavax.swing.JTextField txtMNo;
34. privatejavax.swing.JTextField txtMStatus;
privatejavax.swing.JTextField txtPID;
privatejavax.swing.JTextField txtStatus;
// End of variables declaration
}
*****************************************
RETURN
BOOK**********************************
*******
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.DefaultListModel;
public classReturnUI extends javax.swing.JFrame{
/** Creates new form ReturnUI */
public ReturnUI() {
initComponents();
}
/** This method is called fromwithin the
constructor to
* initializethe form.
* WARNING: Do NOT modify this code. The
content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed"
desc="Generated Code">
privatevoid initComponents() {
jLabel1 = new javax.swing.JLabel();
txtMName = new javax.swing.JTextField();
txtMNo = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
txtMStatus = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
txtMDate = new javax.swing.JTextField();
jScrollPane1 =new javax.swing.JScrollPane();
jList1 = new javax.swing.JList();
jLabel6 = new javax.swing.JLabel();
cmdExit = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
txtAcno = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
txtBTitle = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
txtAuth = new javax.swing.JTextField();
cmdReturn = new javax.swing.JButton();
jLabel9 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowCon
stants.EXIT_ON_CLOSE);
setTitle("book return - Library Management
System || www.ezindagi.in ||");
setBounds(new java.awt.Rectangle(200,70, 0,
0));
addWindowFocusListener(new
java.awt.event.WindowFocusListener() {
public void
windowGainedFocus(java.awt.event.WindowEvent
evt) {
formWindowGainedFocus(evt);
}
public void
windowLostFocus(java.awt.event.WindowEvent
evt) {
}
});
jLabel1.setFont(new java.awt.Font("Arial",1,
12));
jLabel1.setText("Member No.");
txtMName.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
txtMNameActionPerformed(evt);
}
});
txtMName.addPropertyChangeListener(new
java.beans.PropertyChangeListener() {
public void
propertyChange(java.beans.PropertyChangeEvent
evt) {
txtMNamePropertyChange(evt);
}
});
txtMName.addKeyListener(new
java.awt.event.KeyAdapter() {
public void
keyPressed(java.awt.event.KeyEvent evt) {
txtMNameKeyPressed(evt);
}
});
38. ResultSet rs2 = null;
String SQL2 = "SELECT * FROM Missue";
Statement stmt3 = null;
ResultSet rs3 = null;
String SQL3 = "SELECT * FROM Tissue";
privatevoid
txtMNameActionPerformed(java.awt.event.Action
Event evt) {
}
privatevoid
txtMNamePropertyChange(java.beans.PropertyCh
angeEvent evt) {
}
privatevoid
txtMNameKeyPressed(java.awt.event.KeyEvent
evt) {
}
privatevoid
jList1MouseClicked(java.awt.event.MouseEvent
evt) {
// getSelectedValue() method extracts the
current cursor location valueinto a variable
String MembNo = (String)
jList1.getSelectedValue();
// Extract the first4 characters as Member No
into a variable
String Mno =MembNo.trim().substring(0, 3);
String query = "SELECT * FROM Member
WHERE memb_no = " + (Mno) + ";";
try {
Class.forName("com.mysql.jdbc.Driver").newInsta
nce();
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://local
host:3306/Library","root","root");
// Create SQL statement and execute query.
stmt = con.createStatement();
rs = stmt.executeQuery(query);
if (rs.next()) {
String MName =
rs.getString("memb_name");
String MDate = rs.getString("mdate");
String MStatus =
rs.getString("mem_status");
// Displayingthecontents in respective
text boxes.
txtMNo.setText(Mno);
txtMName.setText(MName);
txtMDate.setText(MDate);
txtMStatus.setText(MStatus);
} else {
JOptionPane.showMessageDialog(null,
"Record does not found in Member table");
}
// Extratingthe Acc_no from Tissuetable to
find book details in Lib table
String query1 = "SELECT * FROM Tissue
WHERE memb_no = " + (Mno) + ";";
// Create SQL statement and execute query.
stmt3 = con.createStatement();
rs3 = stmt3.executeQuery(query1);
int ACno = 0;
if (rs3.next()) {
ACno = rs3.getInt("acc_no");
txtAcno.setText(String.valueOf(ACno));
}
// Extratingthe Library details for Acc_no
from Lib table
String query2 = "SELECT * FROM Lib WHERE
acc_no = " + (ACno) + ";";
// Create SQL statement and execute query.
stmt1 = con.createStatement();
rs1 = stmt1.executeQuery(query2);
String BTitle, Auth;
if (rs1.next()) {
BTitle = rs1.getString("btitle");
Auth = rs1.getString("author1");
txtBTitle.setText(BTitle);
txtAuth.setText(Auth);
jLabel9.setText("Issued");
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this,
e.getMessage());
}
}
privatevoid
formWindowGainedFocus(java.awt.event.Window
Event evt) {
txtMNo.setEditable(false);
txtMName.setEditable(false);
39. txtMDate.setEditable(false);
txtMStatus.setEditable(false);
txtAcno.setEditable(false);
txtBTitle.setEditable(false);
txtAuth.setEditable(false);
// dModel to perform DefaultListModel for
Member
// method operations
DefaultListModel dModel = (DefaultListModel)
jList1.getModel();
// Method to add elements into jList1 control
for member
dModel.clear();
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://local
host:3306/Library","root","root");
// ListingMembers
stmt = con.createStatement();
rs = stmt.executeQuery(SQL);
while (rs.next()) {
String Mno = rs.getString("memb_no");
String MName =
rs.getString("memb_name");
// To make the Member no. as 4 digit
because we will extract4 digitfrom listvalue
// in mouse click event.
if (Mno.length() < 4)
{
int x = Mno.length();
int nl = 4 - x;
while (nl > 0){
Mno = Mno + " ";
nl--;
}
}
dModel.addElement(Mno + "- " +
MName);
}
jList1.setModel(dModel);
} catch (Exception e) {
JOptionPane.showMessageDialog(this,e.getMessa
ge());
e.printStackTrace();
}
}
privatevoid
cmdExitActionPerformed(java.awt.event.ActionEv
ent evt) {
new MainUI ().setVisible(true);
dispose();
}
privatevoid
cmdReturnActionPerformed(java.awt.event.Action
Event evt) {
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://local
host:3306/Library","root","root");
// Missuetable
int Mno = 0, Acno = 0;
Mno =
Integer.parseInt(txtMNo.getText().trim());
Acno =
Integer.parseInt(txtAcno.getText().trim());
// Steps to confirmreturn
int opt =
JOptionPane.showConfirmDialog(null,"Areyou
sure to return this book ?");
if (opt == JOptionPane.YES_OPTION)
{
String strSQLr = "Delete from Tissue
where memb_no = " + (Mno);
stmt3.executeUpdate(strSQLr);
// Change the status as library book
issued
char sta = 'Y'; // Lib table
String strSQLa = "Update Lib set status
='"+(sta)+"' where acc_no = " + (Acno);
stmt1.executeUpdate(strSQLa);
// Change the status as Member has a
book
char stb = 'N'; // Member table
String strSQLb = "Update Member set
mem_issue ='"+(stb)+"' where memb_no = " +
(Mno);
stmt.executeUpdate(strSQLb);
JOptionPane.showMessageDialog(this,
"Thanks for returning book");
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this,
e.getMessage());
}
40. }
/**
* @paramargs the command linearguments
*/
public static void main(Stringargs[]) {
java.awt.EventQueue.invokeLater(new
Runnable() {
public void run() {
new ReturnUI().setVisible(true);
}
});
}
// Variables declaration - do not modify
privatejavax.swing.JButton cmdExit;
privatejavax.swing.JButton cmdReturn;
privatejavax.swing.JLabel jLabel1;
privatejavax.swing.JLabel jLabel2;
privatejavax.swing.JLabel jLabel3;
privatejavax.swing.JLabel jLabel4;
privatejavax.swing.JLabel jLabel5;
privatejavax.swing.JLabel jLabel6;
privatejavax.swing.JLabel jLabel7;
privatejavax.swing.JLabel jLabel8;
privatejavax.swing.JLabel jLabel9;
privatejavax.swing.JListjList1;
privatejavax.swing.JScrollPanejScrollPane1;
privatejavax.swing.JSeparator jSeparator1;
privatejavax.swing.JTextField txtAcno;
privatejavax.swing.JTextField txtAuth;
privatejavax.swing.JTextField txtBTitle;
privatejavax.swing.JTextField txtMDate;
privatejavax.swing.JTextField txtMName;
privatejavax.swing.JTextField txtMNo;
privatejavax.swing.JTextField txtMStatus;
// End of variables declaration
}
*****************************************
PUBLISHER
NAVIGATION**************************
***************
import java.sql.*;
import javax.swing.JOptionPane;
public classPubNavUI extends javax.swing.JFrame
{
/** Creates new form PubNavUI */
public PubNavUI() {
initComponents();
}
/** This method is called fromwithin the
constructor to
* initializethe form.
* WARNING: Do NOT modify this code. The
content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed"
desc="Generated Code">
privatevoid initComponents() {
jLabel5 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
txtPAdd = new javax.swing.JTextField();
txtPName = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
txtPh1 = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
txtPh2 = new javax.swing.JTextField();
txtPno = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
jLabel1 = new javax.swing.JLabel();
jSeparator2 = new javax.swing.JSeparator();
cmdFirst= new javax.swing.JButton();
cmdNext = new javax.swing.JButton();
cmdExit = new javax.swing.JButton();
cmdPrev = new javax.swing.JButton();
cmdLast = new javax.swing.JButton();
jLabel7 = new javax.swing.JLabel();
txtStatus = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowCon
stants.EXIT_ON_CLOSE);
setTitle("Publisher Record Navigation - Library
Management System || www.ezindagi.in ||");
setBounds(new java.awt.Rectangle(200,70, 0,
0));
addWindowFocusListener(new
java.awt.event.WindowFocusListener() {
public void
windowGainedFocus(java.awt.event.WindowEvent
evt) {
formWindowGainedFocus(evt);
}