The document discusses Java Database Connectivity (JDBC). It describes JDBC as a Java API that allows Java programs to execute SQL statements. It provides methods for querying and updating data within a database. The document outlines the different components and specifications of JDBC, including the JDBC driver manager, JDBC drivers, and JDBC APIs. It also discusses the different types of JDBC drivers and their architectures.
JDBC java database connectivity with dbmsKhyalNayak
JDBC provides a standard interface for connecting to and interacting with databases in Java applications. There are four types of JDBC drivers: 1) Type 1 drivers use JDBC-ODBC bridges but are platform dependent. 2) Type 2 drivers convert JDBC calls to native database calls and require client-side libraries. 3) Type 3 drivers use a middleware layer and allow connection to multiple databases from a single driver. 4) Type 4 drivers directly convert JDBC calls to database protocols and are 100% pure Java but require a separate driver for each database.
JDBC provides a standard interface for connecting to and working with databases in Java applications. There are four main types of JDBC drivers: Type 1 drivers use ODBC to connect to databases but are only compatible with Windows. Type 2 drivers use native database client libraries but require the libraries to be installed. Type 3 drivers use a middleware layer to support multiple database types without native libraries. Type 4 drivers connect directly to databases using a pure Java implementation, providing cross-platform compatibility without additional layers.
Mumbai Academics is Mumbai’s first dedicated Professional Training Center for Training with Spoke and hub model with Multiple verticles . The strong foundation of Mumbai Academics is laid by highly skilled and trained Professionals, carrying mission to provide industry level input to the freshers and highly skilled and trained Software Professionals/other professional to IT companies.
The document discusses the four types of JDBC drivers:
- Type 1 drivers use JDBC-ODBC bridge, which converts JDBC to ODBC. They are platform dependent.
- Type 2 drivers use native database APIs and are partly Java. The database client is needed.
- Type 3 drivers use a middleware layer that converts JDBC to the database protocol. They support multiple databases.
- Type 4 drivers directly convert JDBC to the database protocol. They are 100% Java but database dependent.
JDBC provides a standard Java API for connecting Java applications to relational databases. It defines interfaces for establishing a connection to a database, sending SQL statements, processing results, and handling errors. There are four types of JDBC drivers that implement the API in different ways, including bridge drivers, native drivers, network protocol drivers, and pure Java drivers.
J2EE is a platform-independent Java-centric environment for developing, building, and deploying web-based enterprise applications. It consists of services, APIs, and protocols that provide functionality for developing multi-tier, web-based applications. J2EE supports component-based development of multi-tier enterprise applications consisting of client, web, EJB, and EIS tiers. Statements are used to send SQL commands and receive data from databases, with PreparedStatements being useful for queries with parameters and CallableStatements for stored procedures.
A JDBC driver enables a Java application to interact with a database. There are 4 types of JDBC drivers: 1) Type 1 drivers use the JDBC-ODBC bridge and convert JDBC calls to ODBC. They are platform dependent. 2) Type 2 drivers use native database APIs and client-side libraries. 3) Type 3 drivers use middleware that converts JDBC calls to database protocols. They support multiple databases. 4) Type 4 drivers directly convert JDBC calls to vendor protocols. They are pure Java and platform independent but database dependent.
This document discusses Java Database Connectivity (JDBC) and its components. It begins with an introduction to JDBC, explaining that JDBC is a Java API that allows Java programs to execute SQL statements and interact with multiple database sources. It then discusses the four types of JDBC drivers - JDBC-ODBC bridge drivers, native-API partly Java drivers, network protocol all-Java drivers, and native protocol all-Java drivers - and their characteristics. The document proceeds to explain the standard seven steps to querying databases using JDBC: loading the driver, defining the connection URL, establishing the connection, creating a statement object, executing a query or update, processing results, and closing the connection.
JDBC stands for Java Database Connectivity. JDBC is a Java API to connect and execute the query with the database. It is a part of JavaSE (Java Standard Edition). JDBC API uses JDBC drivers to connect with the database
Before JDBC, ODBC API was the database API to connect and execute the query with the database. But, ODBC API uses ODBC driver which is written in C language (i.e. platform dependent and unsecured). That is why Java has defined its own API (JDBC API) that uses JDBC drivers (written in Java language).
We can use JDBC API to handle database using Java program and can perform the following activities:
Connect to the database
Execute queries and update statements to the database
Retrieve the result received from the database.
JDBC is a Java API that allows Java programs to execute SQL statements and access databases. There are 4 types of JDBC drivers: Type 1 uses JDBC-ODBC bridge, Type 2 uses native database APIs, Type 3 uses middleware, and Type 4 communicates directly with database using vendor-specific protocols. The basic JDBC process involves loading the driver, connecting to the database, creating statements to execute queries, processing result sets, and closing the connection.
JDBC allows Java programs to execute SQL statements. It includes interfaces and classes that provide methods for connecting to a database, executing queries, processing result sets, and managing transactions. The key components of JDBC are the JDBC API, driver manager, drivers, and Java SQL package. There are four types of JDBC drivers: Type 1 uses JDBC-ODBC bridge, Type 2 uses a native database API, Type 3 uses a network protocol, and Type 4 communicates directly with a database via its network protocol. Creating a database connection in JDBC involves loading the driver, getting a connection, creating statements, executing queries, and closing resources.
The document discusses Java Database Connectivity (JDBC) which provides a standard interface for connecting Java applications to various databases. It describes the JDBC architecture including common components like DriverManager, Connection, Statement, and ResultSet. It also explains the four types of JDBC drivers and how to register drivers, establish a connection, execute queries, and extract result sets in a JDBC application. Key classes like Connection, Statement, PreparedStatement, and ResultSet and their common methods are outlined.
This document provides information on JDBC programming and connecting to databases in Java. It discusses the four types of JDBC drivers (Type 1 to Type 4), how to connect to a database by loading the appropriate driver, formulating the database URL, and creating a connection object. It also covers executing SQL queries, updating and retrieving result sets from the database, and handling errors and exceptions using the SQLException class.
JDBC is a Java API that allows Java programs to execute SQL statements. There are four types of JDBC drivers: Type 1 uses JDBC-ODBC bridge and ODBC driver; Type 2 uses a native database API; Type 3 uses a middleware layer for database independence; Type 4 communicates directly with the database using its native protocol. To connect to a database using JDBC, an application loads the appropriate JDBC driver and then calls DriverManager.getConnection(), specifying the database URL, username, and password.
This document discusses JDBC architecture and driver types. It introduces JDBC as an API that allows Java applications to connect to databases. The JDBC architecture involves using driver classes like DriverManager and Connection to communicate with a database through a specific driver. There are four types of JDBC drivers: type 1 uses JDBC-ODBC bridge, type 2 uses native database APIs, type 3 uses a middleware, and type 4 is a pure Java driver that connects directly to the database.
A JDBC driver allows Java code to interact with a database. There are four types of JDBC drivers:
1. Type 1 drivers use ODBC to connect to databases but have poor performance.
2. Type 2 drivers use native database APIs and have better performance than Type 1 but require client libraries.
3. Type 3 drivers use middleware that converts JDBC calls to database protocols, requiring no client code but adding overhead.
4. Type 4 drivers communicate directly with databases via sockets, have best performance but depend on the database.
There are four types of JDBC drivers: 1) JDBC-ODBC bridge driver, which uses ODBC to connect to databases but has performance issues. 2) Native-API driver, which uses client libraries but requires installation. 3) Network protocol driver, which uses middleware but requires database-specific coding. 4) Thin driver, which directly converts JDBC calls to database protocols and has best performance without requiring client/server software.
A quick view of the types of the JDBC drivers in Java. This document contains a simpler introduction about JDBC driver, their types, advantages, disadvantages and where or in which scenario they should be used.
JDBC is a Java API that allows Java programs to connect to databases. It provides interfaces for establishing a connection to a database, executing SQL statements, and processing the results. There are four types of JDBC drivers that implement the connection between Java programs and databases in different ways, including using ODBC, native database APIs, network protocols, or thin drivers directly connecting to the database. The example shows how to use a JDBC-ODBC bridge driver to connect a Java program to a Microsoft Access database, running queries to retrieve and display records from a table.
The document discusses JDBC (Java Database Connectivity), which provides Java applications with methods to access databases. It covers JDBC architecture and driver types, including Type 1 (JDBC-ODBC bridge), Type 2 (native API), Type 3 (network protocol), and Type 4 (pure Java) drivers. The key classes and interfaces of the JDBC API are also summarized, along with the typical steps to connect to a database using JDBC: loading a driver, connecting, executing statements, and handling exceptions.
Java applications cannot directly communicate with a database to submit data and retrieve the results of queries.
This is because a database can interpret only SQL statements and not Java language statements.
For this reason, you need a mechanism to translate Java statements into SQL statements.
The JDBC architecture provides the mechanism for this kind of translation.
The JDBC architecture can be classified into two layers :
JDBC application layer.
JDBC driver layer.
JDBC application layer : Signifies a Java application that uses the JDBC API to interact with the JDBC drivers. A JDBC driver is software that a Java application uses to access a database. The JDBC driver manager of JDBC API connects the Java application to the driver.
JDBC driver layer : Acts as an interface between a Java applications and a database. This layer contains a driver , such as a SQL server driver or an Oracle driver , which enables connectivity to a database.
A driver sends the request of a Java application to the database. After processing the request, the database sends the response back to the driver. The driver translates and sends the response to the JDBC API. The JDBC API forwards it to the Java application.
The document discusses Java Database Connectivity (JDBC) and provides details on connecting to a database from a Java program. It covers:
1. What JDBC is and its architecture, including key interfaces like Connection, Statement, and ResultSet.
2. The steps to connect to a database using JDBC: loading the driver, defining the connection URL, establishing a connection, creating a Statement, executing queries, processing results, and closing the connection.
3. The different types of JDBC drivers and Statements that can be used.
This document discusses Java Database Connectivity (JDBC) which provides a standard interface for connecting Java applications to various databases. It describes the JDBC API and architecture, including the four types of JDBC drivers. The key points are:
1) JDBC provides a standard way for Java programs to access any SQL database. It uses JDBC drivers implemented by database vendors to translate JDBC calls into database-specific protocols.
2) The JDBC API has two layers - an application layer used by developers, and a driver layer implemented by vendors. There are four main interfaces (Driver, Connection, Statement, ResultSet) and the DriverManager class.
3) There are
This document discusses Java Database Connectivity (JDBC) which provides a standard interface for connecting Java applications to various databases. It describes the JDBC API and architecture, including the four types of JDBC drivers. The key points are:
1) JDBC provides a standard way for Java programs to access any SQL database. It uses JDBC drivers implemented by database vendors to translate JDBC calls into database-specific protocols.
2) The JDBC API has two layers - an application layer used by developers, and a driver layer implemented by vendors. There are four main interfaces (Driver, Connection, Statement, ResultSet) and the DriverManager class.
3) There are
A JDBC driver enables a Java application to interact with a database. There are 4 types of JDBC drivers: 1) Type 1 drivers use the JDBC-ODBC bridge and convert JDBC calls to ODBC. They are platform dependent. 2) Type 2 drivers use native database APIs and client-side libraries. 3) Type 3 drivers use middleware that converts JDBC calls to database protocols. They support multiple databases. 4) Type 4 drivers directly convert JDBC calls to vendor protocols. They are pure Java and platform independent but database dependent.
This document discusses Java Database Connectivity (JDBC) and its components. It begins with an introduction to JDBC, explaining that JDBC is a Java API that allows Java programs to execute SQL statements and interact with multiple database sources. It then discusses the four types of JDBC drivers - JDBC-ODBC bridge drivers, native-API partly Java drivers, network protocol all-Java drivers, and native protocol all-Java drivers - and their characteristics. The document proceeds to explain the standard seven steps to querying databases using JDBC: loading the driver, defining the connection URL, establishing the connection, creating a statement object, executing a query or update, processing results, and closing the connection.
JDBC stands for Java Database Connectivity. JDBC is a Java API to connect and execute the query with the database. It is a part of JavaSE (Java Standard Edition). JDBC API uses JDBC drivers to connect with the database
Before JDBC, ODBC API was the database API to connect and execute the query with the database. But, ODBC API uses ODBC driver which is written in C language (i.e. platform dependent and unsecured). That is why Java has defined its own API (JDBC API) that uses JDBC drivers (written in Java language).
We can use JDBC API to handle database using Java program and can perform the following activities:
Connect to the database
Execute queries and update statements to the database
Retrieve the result received from the database.
JDBC is a Java API that allows Java programs to execute SQL statements and access databases. There are 4 types of JDBC drivers: Type 1 uses JDBC-ODBC bridge, Type 2 uses native database APIs, Type 3 uses middleware, and Type 4 communicates directly with database using vendor-specific protocols. The basic JDBC process involves loading the driver, connecting to the database, creating statements to execute queries, processing result sets, and closing the connection.
JDBC allows Java programs to execute SQL statements. It includes interfaces and classes that provide methods for connecting to a database, executing queries, processing result sets, and managing transactions. The key components of JDBC are the JDBC API, driver manager, drivers, and Java SQL package. There are four types of JDBC drivers: Type 1 uses JDBC-ODBC bridge, Type 2 uses a native database API, Type 3 uses a network protocol, and Type 4 communicates directly with a database via its network protocol. Creating a database connection in JDBC involves loading the driver, getting a connection, creating statements, executing queries, and closing resources.
The document discusses Java Database Connectivity (JDBC) which provides a standard interface for connecting Java applications to various databases. It describes the JDBC architecture including common components like DriverManager, Connection, Statement, and ResultSet. It also explains the four types of JDBC drivers and how to register drivers, establish a connection, execute queries, and extract result sets in a JDBC application. Key classes like Connection, Statement, PreparedStatement, and ResultSet and their common methods are outlined.
This document provides information on JDBC programming and connecting to databases in Java. It discusses the four types of JDBC drivers (Type 1 to Type 4), how to connect to a database by loading the appropriate driver, formulating the database URL, and creating a connection object. It also covers executing SQL queries, updating and retrieving result sets from the database, and handling errors and exceptions using the SQLException class.
JDBC is a Java API that allows Java programs to execute SQL statements. There are four types of JDBC drivers: Type 1 uses JDBC-ODBC bridge and ODBC driver; Type 2 uses a native database API; Type 3 uses a middleware layer for database independence; Type 4 communicates directly with the database using its native protocol. To connect to a database using JDBC, an application loads the appropriate JDBC driver and then calls DriverManager.getConnection(), specifying the database URL, username, and password.
This document discusses JDBC architecture and driver types. It introduces JDBC as an API that allows Java applications to connect to databases. The JDBC architecture involves using driver classes like DriverManager and Connection to communicate with a database through a specific driver. There are four types of JDBC drivers: type 1 uses JDBC-ODBC bridge, type 2 uses native database APIs, type 3 uses a middleware, and type 4 is a pure Java driver that connects directly to the database.
A JDBC driver allows Java code to interact with a database. There are four types of JDBC drivers:
1. Type 1 drivers use ODBC to connect to databases but have poor performance.
2. Type 2 drivers use native database APIs and have better performance than Type 1 but require client libraries.
3. Type 3 drivers use middleware that converts JDBC calls to database protocols, requiring no client code but adding overhead.
4. Type 4 drivers communicate directly with databases via sockets, have best performance but depend on the database.
There are four types of JDBC drivers: 1) JDBC-ODBC bridge driver, which uses ODBC to connect to databases but has performance issues. 2) Native-API driver, which uses client libraries but requires installation. 3) Network protocol driver, which uses middleware but requires database-specific coding. 4) Thin driver, which directly converts JDBC calls to database protocols and has best performance without requiring client/server software.
A quick view of the types of the JDBC drivers in Java. This document contains a simpler introduction about JDBC driver, their types, advantages, disadvantages and where or in which scenario they should be used.
JDBC is a Java API that allows Java programs to connect to databases. It provides interfaces for establishing a connection to a database, executing SQL statements, and processing the results. There are four types of JDBC drivers that implement the connection between Java programs and databases in different ways, including using ODBC, native database APIs, network protocols, or thin drivers directly connecting to the database. The example shows how to use a JDBC-ODBC bridge driver to connect a Java program to a Microsoft Access database, running queries to retrieve and display records from a table.
The document discusses JDBC (Java Database Connectivity), which provides Java applications with methods to access databases. It covers JDBC architecture and driver types, including Type 1 (JDBC-ODBC bridge), Type 2 (native API), Type 3 (network protocol), and Type 4 (pure Java) drivers. The key classes and interfaces of the JDBC API are also summarized, along with the typical steps to connect to a database using JDBC: loading a driver, connecting, executing statements, and handling exceptions.
Java applications cannot directly communicate with a database to submit data and retrieve the results of queries.
This is because a database can interpret only SQL statements and not Java language statements.
For this reason, you need a mechanism to translate Java statements into SQL statements.
The JDBC architecture provides the mechanism for this kind of translation.
The JDBC architecture can be classified into two layers :
JDBC application layer.
JDBC driver layer.
JDBC application layer : Signifies a Java application that uses the JDBC API to interact with the JDBC drivers. A JDBC driver is software that a Java application uses to access a database. The JDBC driver manager of JDBC API connects the Java application to the driver.
JDBC driver layer : Acts as an interface between a Java applications and a database. This layer contains a driver , such as a SQL server driver or an Oracle driver , which enables connectivity to a database.
A driver sends the request of a Java application to the database. After processing the request, the database sends the response back to the driver. The driver translates and sends the response to the JDBC API. The JDBC API forwards it to the Java application.
The document discusses Java Database Connectivity (JDBC) and provides details on connecting to a database from a Java program. It covers:
1. What JDBC is and its architecture, including key interfaces like Connection, Statement, and ResultSet.
2. The steps to connect to a database using JDBC: loading the driver, defining the connection URL, establishing a connection, creating a Statement, executing queries, processing results, and closing the connection.
3. The different types of JDBC drivers and Statements that can be used.
This document discusses Java Database Connectivity (JDBC) which provides a standard interface for connecting Java applications to various databases. It describes the JDBC API and architecture, including the four types of JDBC drivers. The key points are:
1) JDBC provides a standard way for Java programs to access any SQL database. It uses JDBC drivers implemented by database vendors to translate JDBC calls into database-specific protocols.
2) The JDBC API has two layers - an application layer used by developers, and a driver layer implemented by vendors. There are four main interfaces (Driver, Connection, Statement, ResultSet) and the DriverManager class.
3) There are
This document discusses Java Database Connectivity (JDBC) which provides a standard interface for connecting Java applications to various databases. It describes the JDBC API and architecture, including the four types of JDBC drivers. The key points are:
1) JDBC provides a standard way for Java programs to access any SQL database. It uses JDBC drivers implemented by database vendors to translate JDBC calls into database-specific protocols.
2) The JDBC API has two layers - an application layer used by developers, and a driver layer implemented by vendors. There are four main interfaces (Driver, Connection, Statement, ResultSet) and the DriverManager class.
3) There are
In the given example only one object will be created. Firstly JVM will not fi...Indu32
In the given example only one object will be created. Firstly JVM will not find any string object with the value “Welcome” in the string constant pool, so it will create a new object. After that it will find the string with the value “Welcome” in the pool, it will not create a new object but will return the reference to the same instance. In this article, we will learn about Java Strings.
In this page, we will learn about the basics of OOPs. Object-Oriented Program...Indu32
In this page, we will learn about the basics of OOPs. Object-Oriented Programming is a paradigm that provides many concepts, such as inheritance, data binding, polymorphism, etc.
In this page, we will learn about the basics of OOPs. Object-Oriented Program...Indu32
In this page, we will learn about the basics of OOPs. Object-Oriented Programming is a paradigm that provides many concepts, such as inheritance, data binding, polymorphism, etc.
java basic ppt introduction, The Java language is known for its robustness, s...Indu32
Java is an object-oriented, class-based programming language. The language is designed to have as few dependencies implementations as possible. The intention of using this language is to give relief to the developers from writing codes for every platform. The term WORA, write once and run everywhere is often associated with this language. It means whenever we compile a Java code, we get the byte code (.class file), and that can be executed (without compiling it again) on different platforms provided they support Java. In the year 1995, Java language was developed. It is mainly used to develop web, desktop, and mobile devices. The Java language is known for its robustness, security, and simplicity features. That is designed to have as few implementation dependencies as possible.
Societal challenges of AI: biases, multilinguism and sustainabilityJordi Cabot
Towards a fairer, inclusive and sustainable AI that works for everybody.
Reviewing the state of the art on these challenges and what we're doing at LIST to test current LLMs and help you select the one that works best for you
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDinusha Kumarasiri
AI is transforming APIs, enabling smarter automation, enhanced decision-making, and seamless integrations. This presentation explores key design principles for AI-infused APIs on Azure, covering performance optimization, security best practices, scalability strategies, and responsible AI governance. Learn how to leverage Azure API Management, machine learning models, and cloud-native architectures to build robust, efficient, and intelligent API solutions
Who Watches the Watchmen (SciFiDevCon 2025)Allon Mureinik
Tests, especially unit tests, are the developers’ superheroes. They allow us to mess around with our code and keep us safe.
We often trust them with the safety of our codebase, but how do we know that we should? How do we know that this trust is well-deserved?
Enter mutation testing – by intentionally injecting harmful mutations into our code and seeing if they are caught by the tests, we can evaluate the quality of the safety net they provide. By watching the watchmen, we can make sure our tests really protect us, and we aren’t just green-washing our IDEs to a false sense of security.
Talk from SciFiDevCon 2025
https://www.scifidevcon.com/courses/2025-scifidevcon/contents/680efa43ae4f5
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentShubham Joshi
A secure test infrastructure ensures that the testing process doesn’t become a gateway for vulnerabilities. By protecting test environments, data, and access points, organizations can confidently develop and deploy software without compromising user privacy or system integrity.
Copy & Paste On Google >>> https://dr-up-community.info/
EASEUS Partition Master Final with Crack and Key Download If you are looking for a powerful and easy-to-use disk partitioning software,
Adobe After Effects Crack FREE FRESH version 2025kashifyounis067
🌍📱👉COPY LINK & PASTE ON GOOGLE http://drfiles.net/ 👈🌍
Adobe After Effects is a software application used for creating motion graphics, special effects, and video compositing. It's widely used in TV and film post-production, as well as for creating visuals for online content, presentations, and more. While it can be used to create basic animations and designs, its primary strength lies in adding visual effects and motion to videos and graphics after they have been edited.
Here's a more detailed breakdown:
Motion Graphics:
.
After Effects is powerful for creating animated titles, transitions, and other visual elements to enhance the look of videos and presentations.
Visual Effects:
.
It's used extensively in film and television for creating special effects like green screen compositing, object manipulation, and other visual enhancements.
Video Compositing:
.
After Effects allows users to combine multiple video clips, images, and graphics to create a final, cohesive visual.
Animation:
.
It uses keyframes to create smooth, animated sequences, allowing for precise control over the movement and appearance of objects.
Integration with Adobe Creative Cloud:
.
After Effects is part of the Adobe Creative Cloud, a suite of software that includes other popular applications like Photoshop and Premiere Pro.
Post-Production Tool:
.
After Effects is primarily used in the post-production phase, meaning it's used to enhance the visuals after the initial editing of footage has been completed.
Interactive Odoo Dashboard for various business needs can provide users with dynamic, visually appealing dashboards tailored to their specific requirements. such a module that could support multiple dashboards for different aspects of a business
✅Visit And Buy Now : https://bit.ly/3VojWza
✅This Interactive Odoo dashboard module allow user to create their own odoo interactive dashboards for various purpose.
App download now :
Odoo 18 : https://bit.ly/3VojWza
Odoo 17 : https://bit.ly/4h9Z47G
Odoo 16 : https://bit.ly/3FJTEA4
Odoo 15 : https://bit.ly/3W7tsEB
Odoo 14 : https://bit.ly/3BqZDHg
Odoo 13 : https://bit.ly/3uNMF2t
Try Our website appointment booking odoo app : https://bit.ly/3SvNvgU
👉Want a Demo ?📧 [email protected]
➡️Contact us for Odoo ERP Set up : 091066 49361
👉Explore more apps: https://bit.ly/3oFIOCF
👉Want to know more : 🌐 https://www.axistechnolabs.com/
#odoo #odoo18 #odoo17 #odoo16 #odoo15 #odooapps #dashboards #dashboardsoftware #odooerp #odooimplementation #odoodashboardapp #bestodoodashboard #dashboardapp #odoodashboard #dashboardmodule #interactivedashboard #bestdashboard #dashboard #odootag #odooservices #odoonewfeatures #newappfeatures #odoodashboardapp #dynamicdashboard #odooapp #odooappstore #TopOdooApps #odooapp #odooexperience #odoodevelopment #businessdashboard #allinonedashboard #odooproducts
Discover why Wi-Fi 7 is set to transform wireless networking and how Router Architects is leading the way with next-gen router designs built for speed, reliability, and innovation.
WinRAR Crack for Windows (100% Working 2025)sh607827
copy and past on google ➤ ➤➤ https://hdlicense.org/ddl/
WinRAR Crack Free Download is a powerful archive manager that provides full support for RAR and ZIP archives and decompresses CAB, ARJ, LZH, TAR, GZ, ACE, UUE, .
Join Ajay Sarpal and Miray Vu to learn about key Marketo Engage enhancements. Discover improved in-app Salesforce CRM connector statistics for easy monitoring of sync health and throughput. Explore new Salesforce CRM Synch Dashboards providing up-to-date insights into weekly activity usage, thresholds, and limits with drill-down capabilities. Learn about proactive notifications for both Salesforce CRM sync and product usage overages. Get an update on improved Salesforce CRM synch scale and reliability coming in Q2 2025.
Key Takeaways:
Improved Salesforce CRM User Experience: Learn how self-service visibility enhances satisfaction.
Utilize Salesforce CRM Synch Dashboards: Explore real-time weekly activity data.
Monitor Performance Against Limits: See threshold limits for each product level.
Get Usage Over-Limit Alerts: Receive notifications for exceeding thresholds.
Learn About Improved Salesforce CRM Scale: Understand upcoming cloud-based incremental sync.
This presentation explores code comprehension challenges in scientific programming based on a survey of 57 research scientists. It reveals that 57.9% of scientists have no formal training in writing readable code. Key findings highlight a "documentation paradox" where documentation is both the most common readability practice and the biggest challenge scientists face. The study identifies critical issues with naming conventions and code organization, noting that 100% of scientists agree readable code is essential for reproducible research. The research concludes with four key recommendations: expanding programming education for scientists, conducting targeted research on scientific code quality, developing specialized tools, and establishing clearer documentation guidelines for scientific software.
Presented at: The 33rd International Conference on Program Comprehension (ICPC '25)
Date of Conference: April 2025
Conference Location: Ottawa, Ontario, Canada
Preprint: https://arxiv.org/abs/2501.10037
PDF Reader Pro Crack Latest Version FREE Download 2025mu394968
🌍📱👉COPY LINK & PASTE ON GOOGLE https://dr-kain-geera.info/👈🌍
PDF Reader Pro is a software application, often referred to as an AI-powered PDF editor and converter, designed for viewing, editing, annotating, and managing PDF files. It supports various PDF functionalities like merging, splitting, converting, and protecting PDFs. Additionally, it can handle tasks such as creating fillable forms, adding digital signatures, and performing optical character recognition (OCR).
Not So Common Memory Leaks in Java WebinarTier1 app
This SlideShare presentation is from our May webinar, “Not So Common Memory Leaks & How to Fix Them?”, where we explored lesser-known memory leak patterns in Java applications. Unlike typical leaks, subtle issues such as thread local misuse, inner class references, uncached collections, and misbehaving frameworks often go undetected and gradually degrade performance. This deck provides in-depth insights into identifying these hidden leaks using advanced heap analysis and profiling techniques, along with real-world case studies and practical solutions. Ideal for developers and performance engineers aiming to deepen their understanding of Java memory management and improve application stability.
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfTechSoup
In this webinar we will dive into the essentials of generative AI, address key AI concerns, and demonstrate how nonprofits can benefit from using Microsoft’s AI assistant, Copilot, to achieve their goals.
This event series to help nonprofits obtain Copilot skills is made possible by generous support from Microsoft.
What You’ll Learn in Part 2:
Explore real-world nonprofit use cases and success stories.
Participate in live demonstrations and a hands-on activity to see how you can use Microsoft 365 Copilot in your own work!
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...Egor Kaleynik
This case study explores how we partnered with a mid-sized U.S. healthcare SaaS provider to help them scale from a successful pilot phase to supporting over 10,000 users—while meeting strict HIPAA compliance requirements.
Faced with slow, manual testing cycles, frequent regression bugs, and looming audit risks, their growth was at risk. Their existing QA processes couldn’t keep up with the complexity of real-time biometric data handling, and earlier automation attempts had failed due to unreliable tools and fragmented workflows.
We stepped in to deliver a full QA and DevOps transformation. Our team replaced their fragile legacy tests with Testim’s self-healing automation, integrated Postman and OWASP ZAP into Jenkins pipelines for continuous API and security validation, and leveraged AWS Device Farm for real-device, region-specific compliance testing. Custom deployment scripts gave them control over rollouts without relying on heavy CI/CD infrastructure.
The result? Test cycle times were reduced from 3 days to just 8 hours, regression bugs dropped by 40%, and they passed their first HIPAA audit without issue—unlocking faster contract signings and enabling them to expand confidently. More than just a technical upgrade, this project embedded compliance into every phase of development, proving that SaaS providers in regulated industries can scale fast and stay secure.
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...Egor Kaleynik
Ad
unit8_jdbc.pdf mysql and java jdbc connection
1. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
UNIT-VIII
Introduction of Java Database Connectivity
JDBC - Java Database Connectivity.
JDBC provides API or Protocol to interact with different databases.
With the help of JDBC driver we can connect with different types of databases.
Driver is must needed for connection establishment with any database.
A driver works as an interface between the client and a database server.
JDBC have so many classes and interfaces that allow a java application to send request made by
user to any specific DBMS(Data Base Management System).
JDBC supports a wide level of portability.
JDBC provides interfaces that are compatible with java application.
2. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
components and specification of JDBC:
Components of JDBC:
JDBC has four main components as under and with the help of these components java
application can connect with database.
The JDBC API - it provides various methods and interfaces for easy communication with
database.
The JDBC DriverManager - it loads database specific drivers in an application to establish
connection with database.
The JDBC test suite - it will be used to test an operation being performed by JDBC drivers.
The JDBC-ODBC bridge - it connects database drivers to the database.
JDBC Specification:
Different version of JDBC has different specification as under.
JDBC 1.0 - it provides basic functionality of JDBC
JDBC 2.0 - it provides JDBC API(JDBC 2.0 Core API and JDBC 2.0 Optional Package API).
JDBC 3.0 - it provides classes and interfaces in two packages(java.sql and javax.sql).
JDBC 4.0 - it provides so many extra features like
Auto loading of the driver interface.
Connection management
ROWID data type support.
Enhanced support for large object like BLOB(Binary Large Object) and CLOB(Character Large
Object).
What Does JDBC Do?
Simply put, JDBC makes it possible to do three things:
1. establish a connection with a database
3. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
2. send SQL statements
3. process the results.
JavaSoft provides three JDBC product components as part of the Java Developer's Kit (JDK):
1. . the JDBC driver manager,
2. . the JDBC driver test suite, and
3. . the JDBC-ODBC bridge.
The JDBC driver manager is the backbone of the JDB architecture. It actually is quite small and
simple; its primary function is to connect Java applications to the correct JDBC driver and then
get out of the way
JDBC Architecture:
As we all know now that driver is required to communicate with database.
JDBC API provides classes and interfaces to handle request made by user and response made by
database.
Some of the important JDBC API are as under.
DriverManager
Driver
Connection
Statement
PreparedStatement
CallableStatement
ResultSet
DatabaseMetaData
ResultSetMetaData
Here The DriverManager plays an important role in JDBC architecture.
It uses some database specific drivers to communicate our J2EE application to database.
4. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
As per the diagram first of all we have to program our application with JDBC API.
With the help of DriverManager class than we connect to a specific database with the help of
spcific database driver.
Java drivers require some library to communicate with the database.
5. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
We have four different types of java drivers.
We will learn all that four drivers with architecture in next chapter.
Some drivers are pure java drivers and some are partial.
So with this kind of JDBC architecture we can communicate with specific database.
JDBC Drivers:
JDBC Driver Types:
There are four categories of drivers by which developer can apply a connection between Client
(The JAVA application or an applet) to a DBMS.
(1) Type 1 Driver : JDBC-ODBC Bridge.
(2) Type 2 Driver : Native-API Driver (Partly Java driver).
(3) Type 3 Driver : Network-Protocol Driver (Pure Java driver for database Middleware).
(4) Type 4 Driver : Native-Protocol Driver (Pure Java driver directly connected to database).
(1) Type 1 Driver: JDBC-ODBC Bridge :-
The JDBC type 1 driver which is also known as a JDBC-ODBC Bridge is a convert JDBC
methods into ODBC function calls.
SunprovidesJDBC-ODBCBridge driver by “sun.jdbc.odbc.JdbcOdbcDriver”.
The driver is a platform dependent because it uses ODBC which is depends on native libraries of
the operating system and also the driver needs other installation for example, ODBC must be
installed on the computer and the database must support ODBC driver.
Type 1 is the simplest compare to all other driver but it’s a platform specific i.e. only on
Microsoft platform.
For type-1 we create the DSN name.
Steps for DSN:
1. Start
6. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
2. Control panel
3. Administrator tools
4. Data source odbc
5. System dsn
6. Add
7. Microsoft oracle for odbc
8. Finish
9. ora
The JDBC-ODBC Bridge is use only when there is no PURE-JAVA driver available for a
particular database.
The driver is a platform dependent because it uses ODBC which is depends on native libraries of
the operating system and also the driver needs other installation for example, ODBC must be
installed on the computer and the database must support ODBC driver.
Java DB is Oracle's supported distribution of the open source Apache Derby database. Its ease of
use, standards compliance, full feature set, and small footprint make it the ideal database for Java
developers. Java DB is written in the Java programming language, providing "write once, run
anywhere" portability. It can be embedded in Java applications, requiring zero administration by
the developer or user. It can also be used in client server mode. Java DB is fully transactional and
provides a standard SQL interface.
The JDBC driver manager is the backbone of the JDB architecture. It actually is quite small and
simple; its primary function is to connect Java applications to the correct JDBC driver and then
get out of the way
Architecture Diagram:
7. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
Process:
Java Application → JDBC APIs → JDBC Driver Manager → Type 1 Driver → ODBC
Driver → Database library APIs → Database
Advantage:
(1) Connect to almost any database on any system, for which ODBC driver is installed.
(2) It’s an easy for installation as well as easy(simplest) to use as compare the all other driver.
Disadvantage:
(1) The ODBC Driver needs to be installed on the client machine.
(2) It’s a not a purely platform independent because its use ODBC which is depends on native
libraries of the operating system on client machine.
(3) Not suitable for applets because the ODBC driver needs to be installed on the client machine.
(2) Type 2 Driver: Native-API Driver (Partly Java driver) :-
The JDBC type 2 driver is uses the libraries of the database which is available at client side and
this driver converts the JDBC method calls into native calls of the database so this driver is also
known as a Native-API driver.
Architecture Diagram :
8. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
Process:
Java Application → JDBC APIs → JDBC Driver Manager → Type 2 Driver → Vendor
Client Database library APIs → Database
Advantage:
(1) There is no implantation of JDBC-ODBC Bridge so it’s faster than a type 1 driver; hence
the performance is better as compare the type 1 driver (JDBC-ODBC Bridge).
Disadvantage:
(1) On the client machine require the extra installation because this driver uses the vendor client
libraries.
(2) The Client side software needed so cannot use such type of driver in the web-based
application.
(3) Not all databases have the client side library.
(4) This driver supports all JAVA applications except applets.
(3) Type 3 Driver: Network-Protocol Driver (Pure Java driver for database Middleware) :-
The JDBC type 3 driver uses the middle tier(application server) between the calling program and
the database and this middle tier converts JDBC method calls into the vendor specific database
protocol and the same driver can be used for multiple databases also so it’s also known as a
Network-Protocol driver as well as a JAVA driver for database middleware.
Architecture Diagram:
9. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
Process:
Java Application → JDBC APIs → JDBC Driver Manager → Type 3 Driver →
Middleware (Server)→ any Database
Advantage:
(1) There is no need for the vendor database library on the client machine because the
middleware is database independent and it communicates with client.
(2) Type 3 driver can be used in any web application as well as on internet also because there is
no any software require at client side.
(3) A single driver can handle any database at client side so there is no need a separate driver for
each database.
(4) The middleware server can also provide the typical services such as connections, auditing,
load balancing, logging etc.
Disadvantage:
(1) An Extra layer added, may be time consuming.
(2) At the middleware develop the database specific coding, may be increase complexity.
(4) Type 4 Driver: Native-Protocol Driver (Pure Java driver directly
connected to database) :-
The JDBC type 4 driver converts JDBC method calls directly into the vendor specific database
protocol and in between do not need to be converted any other formatted system so this is the
fastest way to communicate quires to DBMS and it is completely written in JAVA because of
that this is also known as the “direct to database Pure JAVA driver”.
If we are using type-4 driver in oracle then we need to add jar file to the class path because it was
given by third party.
11. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
Advantage:
(1) It’s a 100% pure JAVA Driver so it’s a platform independence.
(2) No translation or middleware layers are used so consider as a faster than other drivers.
(3) The all process of the application-to-database connection can manage by JVM so the
debugging is also managed easily.
Disadvantage:
(1)There is a separate driver needed for each database at the client side.
(2) Drivers are Database dependent, as different database vendors use different network
protocols.
JDBC APIs:
If any java application or an applet wants to connect with a database then there are various
classes and interfaces available in java.sql package.
Depending on the requirements these classes and interfaces can be used.
Some of them are list out the below which are used to perform the various tasks with database as
well as for connection.
Class or Interface Description
Java.sql.Connection Create a connection with specific database
Java.sql.DriverManager
The task of DriverManager is to manage the database
driver
Java.sql.Statement
It executes SQL statements for particular connection
and retrieve the results
Java.sql.PreparedStatement
It allows the programmer to create prepared SQL
statements
Java.sql.CallableStatement It executes stored procedures
Java.sql.ResultSet
This interface provides methods to get result row by
row generated by SELECT statements
12. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
The Connection interface:
The Connection interface used to connect java application with particular database.
After crating the connection with database we can execute SQL statements for that particular
connection using object of Connection and retrieve the results.
The interface has few methods that makes changes to the database temporary or permanently.
The some methods are as given below.
Method Description
void close()
This method frees an object of type Connection
from database and other JDBC resources.
void commit()
This method makes all the changes made since the
last commit or rollback permanent. It throws
SQLExeception.
Statement createStatement()
This method creates an object of type Statement
for sending SQL statements to the database. It
throws SQLExeception.
boolean isClosed()
Return true if the connection is close else return
false.
CallableStatement prepareCall(String s)
This method creates an object of type
CallableStatement for calling the stored
procedures from database. It throws
SQLExeception.
PreparedStatement prepareStatement(String
s)
This method creates an object of type
PrepareStatement for sending dynamic (with or
without IN parameter) SQL statements to the
database. It throws SQLExeception.
void rollback()
This method undoes all changes made to the
database.
13. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
Statement Interface:
The Statement interface is used for to execute a static query.
It’s a very simple and easy so it also calls a “Simple Statement”.
The statement interface has several methods for execute the SQL statements and also get the
appropriate result as per the query sent to the database.
Some of the most common methods are as given below
Method Description
void close()
This method frees an object of type Statement
from database and other JDBC resources.
boolean execute(String s)
This method executes the SQL statement specified
by s. The getResultSet() method is used to retrieve
the result.
ResultSet getResultet()
This method retrieves the ResultSet that is
generated by the execute() method.
ResultSet executeQuery(String s)
This method is used to execute the SQL statement
specified by s and returns the object of type
ResultSet.
int getMaxRows()
This method returns the maximum number of rows
those are generated by the executeQuery() method.
Int executeUpdate(String s)
This method executes the SQL statement specified
by s. The SQL statement may be a SQL insert,
update and delete statement.
The Prepared Statement Interface:
The Prepared Statement interface is used to execute a dynamic query (parameterized SQL
statement) with IN parameter.
IN Parameter:-
14. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
In some situation where we need to pass different values to an query then such values can be
specified as a “?” in the query and the actual values can be passed using the setXXX() method at
the time of execution.
Syntax :
setXXX(integer data ,XXX value);
Where XXX means a data type as per the value we want to pass in the query.
For example,
String query = "Select * from Data where ID = ? and Name = ? ";
PreparedStatement ps = con.prepareStatement(query);
ps.setInt(1, 1);
ps.setString(2, "Ashutosh Abhangi");
The Prepared statement interface has several methods to execute the parameterized SQL
statements and retrieve appropriate result as per the query sent to the database.
Some of the most common methods are as given below
Method Description
void close()
This method frees an object of type Prepared
Statement from database and other JDBC
resources.
boolean execute()
This method executes the dynamic query in the
object of type Prepared Statement.The
getResult() method is used to retrieve the result.
ResultSet executeQuery()
This method is used to execute the dynamic
query in the object of type Prepared
Statement and returns the object of type
ResultSet.
Int executeUpdate()
This method executes the SQL statement in the
object of type Prepared Statement. The SQL
statement may be a SQL insert, update and
delete statement.
ResultSetMetaData getMetaData()
The ResultSetMetaData means a deta about the
data of ResultSet.This method retrieves an
15. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
The JDBC API
The JDBC API is based mainly on a set of interfaces, not classes. It's up to the manufacturer of
the driver to implement the interfaces with their own set of classes.
A class diagram that shows the basic JDBC classes and interfaces; these make up the core API.
Notice that the only concrete class is DriverManager. The rest of the core API is a set of
interfaces.
The interfaces of the core JDBC API
DriverManager is used to load a JDBC Driver. A Driver is a software vendor's implementation
of the JDBC API. After a driver is loaded, DriverManager is used to get a Connection.
In turn, a Connection is used to create a Statement, or to create and prepare a PreparedStatement
or CallableStatement.
Statement and PreparedStatement objects are used to execute SQL statements. CallableStatement
objects are used to execute stored procedures.
A Connection can also be used to get a DatabaseMetaData object describing a database's
functionality.
The results of executing a SQL statement using a Statement or PreparedStatement are
returned as a ResultSet.
A ResultSet can be used to get the actual returned data or a ResultSetMetaData object that can
be queried to identify the types of data returned in the ResultSet.
A Struct is a weakly typed object that represents a database object as a record.
A Ref is a reference to an object in a database. It can be used to get to a database object. An
Array is a weakly typed object that represents a database collection object as an array. The
SQLData interface is implemented by custom classes you write to represent database objects as
Java objects in your application. SQLInput and SQLOutput are used by the Driver in the creation
of your custom classes during retrieval and storage.
object of type ResultSetMetaData that contains
information about the columns of the ResultSet
object that will be return when a query is
execute.
int getMaxRows()
This method returns the maximum number of
rows those are generated by the executeQuery()
method.
22. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
Output:
//2. InsertEx.java
//Working with statement
package com.yellaswamy.jdbcexamples;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class InsertEx
{
public static void main(String[] args) throws SQLException, ClassNotFoundException
{
//Get Connection
Connection con=prepareConnection();
//obtain a statement
Statement st=con.createStatement();
//String query="create table mytable(col1 varchar2(20),col2 number,col3
number(10,2))";
String query="insert into mytable1 values('yellaswamy',1215,123.13)";
23. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
//Execute the query
int count=st.executeUpdate(query);
System.out.println("Number of rows affected by this query="+count);
}
public static Connection prepareConnection() throws SQLException,ClassNotFoundException
{
// TODO Auto-generated method stub
String driverClassName="oracle.jdbc.driver.OracleDriver";
String url="jdbc:oracle:thin:@localhost:1521:xe";
String userName="system";
String password="manager";
//load driver class
Class.forName(driverClassName);
//obtain a connection
Connection conn=DriverManager.getConnection(url,userName,password);
return conn;
}
}
//3. PreparedStatementEx1.java
package com.yellaswamy.jdbcexamples;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class PreparedStatementEx1
{
public static void main(String args[])throws Exception
{
String driverClassName="oracle.jdbc.driver.OracleDriver";
String url="jdbc:oracle:thin:@localhost:1521:xe";
String userName="system";
String password="manager";
//load driver class
Class.forName(driverClassName);
//obtain a connection
Connection conn=DriverManager.getConnection(url,userName,password);
String query="insert into mytable values(?,?,?)";
//step1:Get Prepared Statement
24. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
PreparedStatement ps=conn.prepareStatement(query);
//step2:set parameters
ps.setString(1,"shashank1");
ps.setInt(2,1216);
ps.setDouble(3,123.56);
//Step3:Execute the Query
int i=ps.executeUpdate();
System.out.println("Record inserted count="+i);
//To excecute the query once again
ps.setString(1,"Kamalamma1");
ps.setInt(2,1217);
ps.setDouble(3,125.65);
i=ps.executeUpdate();
System.out.println("Query Excecuted for the second time count="+i);
conn.close();
}
}
//4.Resultset Example
package com.yellaswamy.jdbcexample;
import java.sql.*;
public class GetAllRows
{
public static void main(String args[])throws
SQLException, ClassNotFoundException
{ //Get Connection
Connection con=prepareConnection ();
// Obtain a Statement
Statement st=con.createStatement ();
String query = "select * from mytable";
//Execute the Query
ResultSet rs=st.executeQuery (query);
System.out.println ("COL1ttCOL2tCOL3");
while (rs.next ())
{
System.out.print (rs.getString ("COL1") + "t");
System.out.print (rs.getInt ("COL2") + "t");
System.out.println (rs.getDouble ("COL3")+"t");
}//while
con.close ();
}//main
public static Connection prepareConnection()
throws SQLException,
ClassNotFoundException
25. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
{
String driverClassName="oracle.jdbc.driver.OracleDriver";
String url="jdbc:oracle:thin:@localhost:1521:xe";
String username="system";
String password="manager";
//Load driver class
Class.forName (driverClassName);
// Obtain a connection
return DriverManager. getConnection (url, username, password);
}//prepareConnection
}//class
26. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
CallableStatement Interface
To call the stored procedures and functions, CallableStatement interface is used.
We can have business logic on the database by the use of stored procedures and
functions that will make the performance better because these are precompiled.
Suppose you need the get the age of the employee based on the date of birth, you may
create a function that receives date as the input and returns age of the employee as the
output.
1. The java.sql.CallableStatement is a part of JDBC API that describes a standard abstraction for the
CallableStatement object,implemented by third-party vendor as a part of JDBC driver.
2. The CallableStatement object provides support for both input and output parameters.
What is the difference between stored procedures and
functions.
The differences between stored procedures and functions are given below:
Stored Procedure Function
is used to perform business logic. is used to perform calculation.
must not have the return type. must have the return type.
may return 0 or more values. may return only one values.
We can call functions from the procedure. Procedure cannot be called from
function.
Procedure supports input and output
parameters.
Function supports only input parameter.
Exception handling using try/catch block
can be used in stored procedures.
Exception handling using try/catch can't
be used in user defined functions.
27. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
Syntax of creating a stored procedure:
Create or [Replace] Procedure procedure_name
[(parameter[,parameter])]
IS
[Declarations]
BEGIN
Executables
[EXCEPTION exceptions]
END [Procedure_name]
Steps to use CallableStatement in an Application are as follows:
1. Create the CallableStatement object
2. Setting the values of parameters
3. Registering the OUT parameter type
4. Excecuting the stored procedure or function
5. Retrieving the parameter values
Let’s discuss these steps in details
Create the CallableStatement object:
The first step to use CallableStatement is to create the CallableStatement object.The
CallableStatement object can be created by invoking the prepareCall(String) method of the
Connection object.
The syntax to call the prepareCall method in an application is as follows:
{call procedure_name(?,?,…)} //Calling the procedure method with parameters
{call procedure_name} //with no parameter
Setting the values of parameters
After creating the CallableStatement object,you need to set the values for the IN and IN OUT
type parameters of stored procedure.The values of these parameters can be set by calling the
setXXX() methods of the CallableStatement object.These methods are used to pass the values to
the IN OUT parameters.The values for the parameter can be set by using the following syntax:
setXXX(int index,XXX value)
Registering the OUT Parameter Type
The OUT or IN OUT parameters,which are used in a procedure and represented by
CallableStatement,must be registered to collect the values of the parameters after the stored
procedure is executed.
The parameters can be registered by using the following syntax:
registerOutParameter(int index,int type)
Excecuting the Stored Procedure or Function
After registering the OUT parameter type you need to execute the procedure by using execute()
method of CallableStatement object.The execute() method of CallableStatement does not take
any argument.
28. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
Retrieving the Parameter Values:
After executing the stored procedure,you can retrieve its OUT or IN OUT type parameter values.
EXECUTING A STORED PROCEDURE WITH IN PARAMETERS
Create the Following Tables:
create table bank(Accno number,Name varchar2(20),Bal number(10,2),Acctype number);
Create table personal_details(Accno number,address varchar2(20),phno number);
Create the following Procedure:
create or replace procedure createAccount(accnumber number,actype number,acname
varchar2,amt number,addr varchar2,phno number)is
begin
insert into bank values(accnumber,acname,amt,actype);
insert into personal_details values(accnumber,addr,phno);
end;
30. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
// CallableStatementEx1.java
package com.yellaswamy.jdbc;
import java.sql.*;
/**
* @author yellaswamy
*/
public class CallableStatementEx1 {
public static void main(String s[]) throws Exception {
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","yellaswamy","yella
swamy");
//Step1: Get CallableStatement
CallableStatement cs= con.prepareCall("{call createAccount (?,?,?,?,?,?)}");
//Step2: set IN parameters
cs.setInt(1, 101);
cs.setInt(2, 10);
cs.setString(3, "Yellaswamy");
cs.setDouble(4, 10000);
cs.setString(5, "Hyderabad");
cs.setInt(6, 123456789);
//Step3 : register OUT parameters
//In this procedure example we dont have OUT parameters
//Step4
cs.execute();
System.out.println("Account Created");
con.close();
}//main
}//class
31. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
Executing a Stored Procedure with OUT Parameters:
We create an application that calls a stored procedure name getBalance() by using
CallableStatement.
First create a procedure named getBalance() as shown in the following code snippet:
create or replace procedure getBalance(acno number,amt OUT number)is
begin
select bal into amt from bank where accno=acno;
end;
35. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
Package javax.sql Description
Provides the API for server side data source access and processing from the JavaTM
programming
language. This package supplements the java.sql package and, as of the version 1.4 release, is
included in the Java Platform, Standard Edition (Java SETM
). It remains an essential part of the
Java Platform, Enterprise Edition (Java EETM
).
The javax.sql package provides for the following:
1. The DataSource interface as an alternative to the DriverManager for establishing a
connection with a data source
2. Connection pooling and Statement pooling
3. Distributed transactions
4. Rowsets
Applications use the DataSource and RowSet APIs directly, but the connection pooling and
distributed transaction APIs are used internally by the middle-tier infrastructure.
Using a DataSource Object to Make a Connection
The javax.sql package provides the preferred way to make a connection with a data source.
The DriverManager class, the original mechanism, is still valid, and code using it will continue
to run. However, the newer DataSource mechanism is preferred because it offers many
advantages over the DriverManager mechanism.
These are the main advantages of using a DataSource object to make a connection:
Changes can be made to a data source's properties, which means that it is not necessary to
make changes in application code when something about the data source or driver
changes.
Connection and Statement pooling and distributed transactions are available through a
DataSource object that is implemented to work with the middle-tier infrastructure.
Connections made through the DriverManager do not have connection and statement
pooling or distributed transaction capabilities.
Driver vendors provide DataSource implementations. A particular DataSource object
represents a particular physical data source, and each connection the DataSource object creates
is a connection to that physical data source.
A logical name for the data source is registered with a naming service that uses the Java Naming
and Directory InterfaceTM
(JNDI) API, usually by a system administrator or someone performing
the duties of a system administrator. An application can retrieve the DataSource object it wants
by doing a lookup on the logical name that has been registered for it. The application can then
use the DataSource object to create a connection to the physical data source it represents.
36. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
A DataSource object can be implemented to work with the middle tier infrastructure so that the
connections it produces will be pooled for reuse. An application that uses such a DataSource
implementation will automatically get a connection that participates in connection pooling. A
DataSource object can also be implemented to work with the middle tier infrastructure so that
the connections it produces can be used for distributed transactions without any special coding.
Connection Pooling and Statement Pooling
Connections made via a DataSource object that is implemented to work with a middle tier
connection pool manager will participate in connection pooling. This can improve performance
dramatically because creating new connections is very expensive. Connection pooling allows a
connection to be used and reused, thus cutting down substantially on the number of new
connections that need to be created.
Connection pooling is totally transparent. It is done automatically in the middle tier of a Java EE
configuration, so from an application's viewpoint, no change in code is required. An application
simply uses the DataSource.getConnection method to get the pooled connection and uses it
the same way it uses any Connection object.
The classes and interfaces used for connection pooling are:
ConnectionPoolDataSource
PooledConnection
ConnectionEvent
ConnectionEventListener
StatementEvent
StatementEventListener
The connection pool manager, a facility in the middle tier of a three-tier architecture, uses these
classes and interfaces behind the scenes. When a ConnectionPoolDataSource object is called
on to create a PooledConnection object, the connection pool manager will register as a
ConnectionEventListener object with the new PooledConnection object. When the
connection is closed or there is an error, the connection pool manager (being a listener) gets a
notification that includes a ConnectionEvent object.
If the connection pool manager supports Statement pooling, for PreparedStatements, which
can be determined by invoking the method DatabaseMetaData.supportsStatementPooling,
the connection pool manager will register as a StatementEventListener object with the new
PooledConnection object. When the PreparedStatement is closed or there is an error, the
connection pool manager (being a listener) gets a notification that includes a StatementEvent
object.
37. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
Distributed Transactions
As with pooled connections, connections made via a DataSource object that is implemented to
work with the middle tier infrastructure may participate in distributed transactions. This gives an
application the ability to involve data sources on multiple servers in a single transaction.
The classes and interfaces used for distributed transactions are:
XADataSource
XAConnection
These interfaces are used by the transaction manager; an application does not use them directly.
The XAConnection interface is derived from the PooledConnection interface, so what applies
to a pooled connection also applies to a connection that is part of a distributed transaction. A
transaction manager in the middle tier handles everything transparently. The only change in
application code is that an application cannot do anything that would interfere with the
transaction manager's handling of the transaction. Specifically, an application cannot call the
methods Connection.commit or Connection.rollback, and it cannot set the connection to be
in auto-commit mode (that is, it cannot call Connection.setAutoCommit(true)).
An application does not need to do anything special to participate in a distributed transaction. It
simply creates connections to the data sources it wants to use via the
DataSource.getConnection method, just as it normally does. The transaction manager
manages the transaction behind the scenes. The XADataSource interface creates XAConnection
objects, and each XAConnection object creates an XAResource object that the transaction
manager uses to manage the connection.
Rowsets
The RowSet interface works with various other classes and interfaces behind the scenes. These
can be grouped into three categories.
1. Event Notification
o RowSetListener
A RowSet object is a JavaBeansTM
component because it has properties and
participates in the JavaBeans event notification mechanism. The RowSetListener
interface is implemented by a component that wants to be notified about events
that occur to a particular RowSet object. Such a component registers itself as a
listener with a rowset via the RowSet.addRowSetListener method.
When the RowSet object changes one of its rows, changes all of it rows, or moves
its cursor, it also notifies each listener that is registered with it. The listener reacts
by carrying out its implementation of the notification method called on it.
38. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
o RowSetEvent
As part of its internal notification process, a RowSet object creates an instance of
RowSetEvent and passes it to the listener. The listener can use this RowSetEvent
object to find out which rowset had the event.
2. Metadata
o RowSetMetaData
This interface, derived from the ResultSetMetaData interface, provides
information about the columns in a RowSet object. An application can use
RowSetMetaData methods to find out how many columns the rowset contains and
what kind of data each column can contain.
The RowSetMetaData interface provides methods for setting the information
about columns, but an application would not normally use these methods. When
an application calls the RowSet method execute, the RowSet object will contain a
new set of rows, and its RowSetMetaData object will have been internally updated
to contain information about the new columns.
3. The Reader/Writer Facility
A RowSet object that implements the RowSetInternal interface can call on the
RowSetReader object associated with it to populate itself with data. It can also call on the
RowSetWriter object associated with it to write any changes to its rows back to the data
source from which it originally got the rows. A rowset that remains connected to its data
source does not need to use a reader and writer because it can simply operate on the data
source directly.
o RowSetInternal
By implementing the RowSetInternal interface, a RowSet object gets access to
its internal state and is able to call on its reader and writer. A rowset keeps track
of the values in its current rows and of the values that immediately preceded the
current ones, referred to as the original values. A rowset also keeps track of (1)
the parameters that have been set for its command and (2) the connection that was
passed to it, if any. A rowset uses the RowSetInternal methods behind the
scenes to get access to this information. An application does not normally invoke
these methods directly.
o RowSetReader
A disconnected RowSet object that has implemented the RowSetInternal
interface can call on its reader (the RowSetReader object associated with it) to
populate it with data. When an application calls the RowSet.execute method,
that method calls on the rowset's reader to do much of the work. Implementations
can vary widely, but generally a reader makes a connection to the data source,
reads data from the data source and populates the rowset with it, and closes the
connection. A reader may also update the RowSetMetaData object for its rowset.
The rowset's internal state is also updated, either by the reader or directly by the
method RowSet.execute.
o RowSetWriter
A disconnected RowSet object that has implemented the RowSetInternal
interface can call on its writer (the RowSetWriter object associated with it) to
39. K.Yellaswamy,Assistant Professor|CMR College of Engineering & Technology
Email:[email protected]
write changes back to the underlying data source. Implementations may vary
widely, but generally, a writer will do the following:
Make a connection to the data source
Check to see whether there is a conflict, that is, whether a value that has
been changed in the rowset has also been changed in the data source
Write the new values to the data source if there is no conflict
Close the connection
The RowSet interface may be implemented in any number of ways, and anyone may write an
implementation. Developers are encouraged to use their imaginations in coming up with new
ways to use rowsets.