Q9.)
Advantages of OODBMS
- Enriched modeling capabilities
- Extensibility
- Removal of impedance mismatch
- More expressive query language
- Support for schema evolution
- Support for long-duration transaction
- Applicability to advanced database applications.
- Improved performance
Disadvantages of OODBMS
- List of universal data model
- Lack of experience
- Lack of standards
- Competition
- Query optimization compromises encapsulation
- Locking at Object level may impact performance
- Complexity
- Lack of support for views
- Lack of support for security
1.) JDBC is a Java-based tool used to connect SQL databases.It was created at Sun Microsystems as a base for building alternate tools and interfaces.
2.) JDBC can be used to connect directly to a Java-aware DBMS. And embedded SQL for java with this approach, JDBC requires that SQL statements be passed as strings to Java methods. An embedded SQL preprocessor allows a programmer instead to mix SQL statements directly with java. For example java variables can be used in an SQL statement to receive or provide SQL values.
3.) Direct mapping of relational database tables to Java classes in this object relation mapping, each row of the table becomes an instance of that class, and each column value corresponds to an attribute of that instance.
4.) JDBC is modeled after the ODBC, originally designed and used by Microsoft. ODBC is based on the C language.
5.) JDBC API is a natural Java Interface and is built on ODBC. JDBC retains some.
- JDBC drivers are written in java and JDBC code is automatically installable, secure, and portable on all platforms.
Atomicity
Main article: Atomicity (database systems)
Atomicity requires that each transaction is "all or nothing": if one part of the transaction fails, the entire transaction fails, and the database state is left unchanged. An atomic system must guarantee atomicity in each and every situation, including power failures, errors, and crashes.
Consistency
Main article: Consistency (database systems)
The consistency property ensures that any transaction will bring the database from one valid state to another. Any data written to the database must be valid according to all defined rules, including but not limited to constraints, cascades, triggers, and any combination thereof.
Isolation
Main article: Isolation (database systems)
The isolation property ensures that the concurrent execution of transactions results in a system state that would be obtained if transactions were executed serially, i.e. one after the other. Each transaction must execute in total isolation i.e. if T1 and T2 execute concurrently then each should remain independent of the other.[citation needed]
Durability
Main article: Durability (database systems)
Durability means that once a transaction has been committed, it will remain so, even in the event of power loss, crashes, or errors. In a relational database, for instance, once a group of SQL statements execute, the results need to be stored permanently (even if the database crashes immediately thereafter).
- LOST UPDATE Problem
- Uncommitted Dependency Problem
- Inconsistent analysis problem
Schedule : is sequence of read/write by set of concurrence transaction.
Serial Schedule :
A schedule to be equivalent
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
String dbUrl = "jdbc:mysql://your.database.domain/yourDBname";
String dbClass = "com.mysql.jdbc.Driver";
String query = "Select * FROM users";
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection (dbUrl);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
dbtime = rs.getString(1);
System.out.println(dbtime);
} //end while
con.close();
String userName = "username";
String password = "password";
String url = "jdbc:sqlserver://MYPC\\SQLEXPRESS;databaseName=MYDB";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection conn = DriverManager.getConnection(url, userName, password);
CREATE TRIGGER trg_UpdateTimeEntry
ON dbo.TimeEntry
AFTER UPDATE
AS
UPDATE dbo.TimeEntry
SET ModDate = GETDATE()
WHERE ID IN (SELECT DISTINCT ID FROM Inserted)
Alter PROCEDURE GetstudentnameInOutputVariable
(
@studentid INT, --Input parameter , Studentid of the student
@studentname VARCHAR (200) OUT, -- Output parameter to collect the student name
@StudentEmail VARCHAR (200)OUT -- Output Parameter to collect the student email
)
AS
BEGIN
SELECT @studentname= Firstname+' '+Lastname,
@StudentEmail=email FROM tbl_Students WHERE studentid=@studentid
END
No comments:
Post a Comment