91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 15KB
    文件類型: .rar
    金幣: 2
    下載: 1 次
    發布日期: 2021-05-18
  • 語言: 其他
  • 標簽: exercise??9??

資源簡介

Programming with Transactions Testing Commits and Rollbacks Almost all commercial-strength DBMS software supports the ability to undo the effects of a transaction before those effects are committed to the database. This is particularly useful when an operation must be performed to completion or no

資源截圖

代碼片段和文件信息

import?java.util.*;
import?java.io.*;
import?java.text.*;
import?java.sql.*;

/**
?*?A?class?representing?the?driver?program?to?the
?*?SSD7?transaction?exercise.
?*
?*?@author?CSSE?0902K?Bek?Zhuldyz
?*?@version?09.12.2011
?*/

public?class?MovieTransaction
{
????/**
?????*?main?method.
?????*
?????*/
????public?static?void?main(?String?[]?args?)
????{

String?[]?movienames?=?new?String[10];
String?[]?movietimes?=?new?String[10];
String?sqlquery?=?null;
String?moviename?=?null;
String?movietime?=?null;
ResultSet?rset?=?null;
Connection?conn?=?null;
Statement?stmt?=?null;
BufferedReader?keyIn?=?null;
String?url?=?“jdbc:postgresql:zhuldyz“;
String?username?=?“postgres“;
String?password?=?“webuser“;
int?position?=?0?choice?movie_id?numseats?availableseats;

try
????{
//?Create?a?BufferedReader?to?read?input?from?the?keyboard.
keyIn?=?new?BufferedReader(new?InputStreamReader(System.in));

//?Load?the?PostgreSQL?JDBC?driver
Class.forName(“org.postgresql.Driver“);

//?Create?a?connection?to?the?database.
conn?=?DriverManager.getConnection(?url?usernamepassword?);

//?Turn?off?autocommit?at?each?statement.?We?will?manually?commit.
//?Set?the?transaction?isolation?level?to?serializable
//conn.setAutoCommit(false);
//conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);

//?Create?a?statement?object.
stmt?=?conn.createStatement();

System.out.println(?“Welcome?to?the?movie?theater!“?);

//?Query?the?titles?currently?playing.
String?SQLQuery?=?“select?distinct?title?from?movie“;
rset?=?stmt.executeQuery(?SQLQuery?);
while(?rset.next()?)
????{
movienames[rset.getRow()]?=?rset.getString(?“title“?);
System.out.println(?rset.getRow()?+?“:?“?+?rset.getString(“title“)?);
????}

//?Ask?the?user?what?movie?he?wants?to?see.
System.out.print(?“Enter?the?number?of?the?movie?you?want?to?see:“?);
choice?=?Integer.parseInt(keyIn.readLine());
moviename?=?movienames[(choice)];

//?Query?the?id?for?this?movie.
sqlquery?=?new?String(?“select?movie_id?from?movie?where?title=‘“?+?moviename?+?“‘“?);
rset?=?stmt.executeQuery(?sqlquery?);
rset.next();
movie_id?=?rset.getInt(?“movie_id“?);

//?Query?the?available?times?for?the?chosen?movie.
sqlquery?=?new?String(?“select?distinct?movie_time?from?showing?where?movie_id?=“?+?movie_id?);
rset?=?stmt.executeQuery(?sqlquery?);
while(?rset.next()?)?{
movietimes[(rset.getRow())]?=?rset.getString(?“movie_time“?);
???????????????????????? System.out.println(?rset.getRow()?+?“:?“?+?rset.getString(?“movie_time“?)?);
???????????????????? }
//?Ask?the?user?what?showing?he?wants?to?see.
System.out.println(?“Enter?the?number?of?the?time?you?want?to?see:?“?);
choice?=?Integer.parseInt(?keyIn.readLine()?);
movietime?=?movietimes[(choice)];

//?Ask?the?user?how?many?seats?he?wants.
System.out.println(?“Please?enter?the?number?of?seats?that?you?want?to?buy:?“?);
numseats?=?Integer.parseInt(?keyIn.readLine()?);

????????????????//?

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????1065??2011-12-09?08:39??Ex?9\deadlock.txt

?????文件???????1302??2011-12-09?08:05??Ex?9\isolation.txt

?????文件???????4928??2011-12-09?09:39??Ex?9\MovieTransaction.java

?????文件????????553??2011-12-10?22:39??Ex?9\rollback.txt

?????文件??????15221??2011-12-09?09:04??Ex?9\Transactions?at?the?ATM.docx

?????目錄??????????0??2011-12-09?09:42??Ex?9

-----------?---------??----------?-----??----

????????????????23069????????????????????6


評論

共有 條評論