{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Data Mgmt Lab_Part_22 - 64 Chapter 6 Exercise 6.2 Explain...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
64 Chapter 6 Exercise 6.2 Explain how the following steps are performed in JDBC: 1. Connect to a data source. 2. Start, commit, and abort transactions. 3. Call a stored procedure. How are these steps performed in SQLJ? Answer 6.2 The answers are given below: 1. Connecting to a data source in JDBC involves the creation of a Connection object. Parameters for the connection are specified using a JDBC URL that contains things like the network address of the database server and the username and password for connecting. SQLJ makes calls to the same JDBC drver for connecting to a data source and uses the same type of JDBC URL. 2. Each connection can specify how to handle transactions. If the autocommit flag is set, each SQL statement is treated as a separate transaction. If the flag is turned off, there is a commit() function call that will actually commit the transaction. The autocommit flag can also be set in SQLJ. If the flag is not set, transactions are committed by passing a COMMIT SQL statement to the DBMS. 3. Stored procedures are called from JDBC using the CallableStatement class with the SQL command { CALL StoredProcedureName } . SQLJ also uses CALL StoredProcedureName to execute stored prodecures at the DBMS.
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern