Can someone who understands JDBC write me a 15mins length worth of presentation on JDBC.
JDBC Introduction
Java has an API for working with databases, and this technology is known as JDBC. JDBC provides the developer with tools that allow clients to connect to databases, and send commands to the database. These commands are written in the Structured Query Language. However, JDBC can be used with any kind of data base. That is because JDBC abstracts common database functions into a set of common classes and methods.
Database-specific code is contained in a code library, commonly called a driver library. If there is a driver library for a database, you can use the JDBC API to send commands to the database and extract data from the database.
JDBC Product Components
ODBC Vs JDBC
ODBC | JDBC |
ODBC is written in C language. | JDBC is written in Java language. |
ODBC is platform dependent. It is windows specific technology. | JDBC is platform independent. It runs on all OS. |
Loads slow. | Loads fast. |
ODBC is not thread safe. | JDBC is thread safe. |
ODBC requires manual installation of ODBC driver manager and ODBC drivers. | No need to install JDBC drivers manually.They can be easily integrated in your java code. |
Less secured. | Highly secured. |
JDBC Architecture
Two-tier and Three-tier Processing Models
The JDBC API supports both two-tier and three-tier processing
models for database access.
1: Two-tier Architecture for Data Access.
In the two-tier model, a Java applet or application talks directly to the data source. This requires a JDBC driver that can communicate with the particular data source being accessed. A user's commands are delivered to the database or other data source, and the results of those statements are sent back to the user. The data source may be located on another machine to which the user is connected via a network. This is referred to as a client/server configuration, with the user's machine as the client, and the machine housing the data source as the server. The network can be an intranet, which, for example, connects employees within a corporation, or it can be the Internet.
In the three-tier model, commands are sent to a "middle tier" of services, which then sends the commands to the data source. The data source processes the commands and sends the results back to the middle tier, which then sends them to the user. MIS directors find the three-tier model very attractive because the middle tier makes it possible to maintain control over access and the kinds of updates that can be made to corporate data. Another advantage is that it simplifies the deployment of applications. Finally, in many cases, the three-tier architecture can provide performance advantages.
2: Three-tier Architecture for Data Access.
Until recently, the middle tier has often been written in languages such as C or C++, which offer fast performance. However, with the introduction of optimizing compilers that translate Java bytecode into efficient machine-specific code and technologies such as Enterprise JavaBeans, the Java platform is fast becoming the standard platform for middle-tier development. This is a big plus, making it possible to take advantage of Java's robustness, multithreading, and security features.
With enterprises increasingly using the Java programming language for writing server code, the JDBC API is being used more and more in the middle tier of a three-tier architecture. Some of the features that make JDBC a server technology are its support for connection pooling, distributed transactions, and disconnected rowsets. The JDBC API is also what allows access to a data source from a Java middle tier.
Simple Example Code
public void connectToAndQueryDatabase(String username, String password) {
Connection con = DriverManager.getConnection(
"jdbc:myDriver:myDatabase",
username,
password);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM Table1");
while (rs.next()) {
int x = rs.getInt("a");
String s = rs.getString("b");
float f = rs.getFloat("c");
}
}
SQL Commands
SQL commands are divided into categories, the two main ones being Data Manipulation Language (DML) commands and Data Definition Language (DDL) commands. DML commands deal with data, either retrieving it or modifying it to keep it up-to-date. DDL commands create or change tables and other database objects such as views and indexes.
A list of the more common DML commands follows:
Result Sets and Cursors
The rows that satisfy the conditions of a query are called the result set. The number of rows returned in a result set can be zero, one, or many. A user can access the data in a result set one row at a time, and a cursor provides the means to do that. A cursor can be thought of as a pointer into a file that contains the rows of the result set, and that pointer has the ability to keep track of which row is currently being accessed. A cursor allows a user to process each row of a result set from top to bottom and consequently may be used for iterative processing. Most DBMSs create a cursor automatically when a result set is generated.
Earlier JDBC API versions added new capabilities for a result set's cursor, allowing it to move both forward and backward and also allowing it to move to a specified row or to a row whose position is relative to another row.
Transactions
A transaction is a set of one or more SQL statements that make up a logical unit of work. A transaction ends with either a commit or a rollback, depending on whether there are any problems with data consistency or data concurrency. The commit statement makes permanent the changes resulting from the SQL statements in the transaction, and the rollback statement undoes all changes resulting from the SQL statements in the transaction.
Stored Procedures
A stored procedure is a group of SQL statements that can be called by name. In other words, it is executable code, a mini-program, that performs a particular task that can be invoked the same way one can call a function or method. Traditionally, stored procedures have been written in a DBMS-specific programming language. The latest generation of database products allows stored procedures to be written using the Java programming language and the JDBC API. Stored procedures written in the Java programming language are bytecode portable between DBMSs. Once a stored procedure is written, it can be used and reused because a DBMS that supports stored procedures will, as its name implies, store it in the database.
Can someone who understands JDBC write me a 15mins length worth of presentation on JDBC.
10. a. Write a short Java Program that shows how SQL commands and JDBC can be used to connect the two. (See JDBC/ODBC Connections Lecture Notes 'CS267- SQL Injection, Security, and JDBC') b. Write a short paragraph 3-4 lines about the dangers of techniques like SQL Injection. 5 PT BONUS: Find the names of all the managers who manage more than 10 employees. [Hint: Can use Nested Select OR Group By... Having]
10. a. Write a short Java Program that...
Can someone help me with the idea for a research PowerPoint presentation of Birth order Duration and Initiation and Effects of Breastfeeding
Please, can someone write to me this answer!!! _______________________________________________________-- .What did you learn or improve on your skills by working on technical writing report? What did you learn about writing reports by evaluating your peers? How will the things you have learned transfer to a future workplace setting? What areas that you mentioned earlier, do you still need to work on? What new areas have you identified to work on?
Hello to anyone who can help me! I did a lab and we have to write the molecular, ionic and net ionic equations for all the confirmed Precipitates. I been having trouble understanding how to do equations so if someone can help me I would appreciate it. Pb(NO3)2+NaOH KIO3+Na2S Pb(NO3)2+Na2S BaC12+Na2SO4 Pb(NO3)2+Na2SO4 Pb(NO3)2+KIO3 Na2S+BaC12 Na2SO4+BaC12 KCLO3+BaCI2 NH4CI+BaC12
Can someone help me with this, and it has to be written in the C programming language: Write a program that reads a string from the keyboard. If the length of the string is an even number, your program should split the string into two strings of equal length. If the length of the string is odd, your program should split the string into two strings where the first part has one more character than the second part. Your program...
please can someone write me a paper on how culture influences health beliefs & cultural assessment in African American community
Can someone please write me a short essay regarding the
reflection of this quotation? And that based on the cognitive
domain of learning. Thank you
Please use the information you have learned about the cognitive domain of learning to write a short essay on the reflection of the following quotation: Education is not the learning of facts, but the training of the mind to think."-Albert Eistein
Can someone teach me how to do this?Can someone teach me how to do this?Can someone teach me how to do this?
can
someone help me with this question?
Problem 2 Write in rectangular form the complex number represented by the expression 3+2+ /2–1+ 721 – sin ( + ln(1 + (29) + \n(-1 – V31)
Can someone help do a research PowerPoint presentation of Birth order Duration and Initiation and Effects of Breastfeeding