forked from vin8bit/Library-Management-System
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRowCount1.java
More file actions
122 lines (87 loc) · 2.51 KB
/
Copy pathRowCount1.java
File metadata and controls
122 lines (87 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import java.sql.*;
import java.io.*;
class RowCount1
{
String system;
String systempass;
Connection con;
Statement stm;
ResultSet rs;
String names,roll_no1;
int column,h;
String n[]=new String[4];
int rowCount,rowCount2,rowCount3,rowCount4;
int r;
public RowCount1() throws Exception
{ try{
FileInputStream file3=new FileInputStream("username.txt");
byte []by12= new byte[50];
file3.read(by12);
system= new String(by12,0,50);
//System.out.println("2 byte "+user1);
FileInputStream file4=new FileInputStream("password.txt");
byte []by22= new byte[50];
file4.read(by22);
systempass= new String(by22,0,50);
//System.out.println("3 byte "+pass1);
}
catch(IOException io){ }
}
public int call()throws Exception
{
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe",system,systempass);
stm= con.createStatement();
rs= stm.executeQuery("SELECT COUNT(*) FROM book ");
rs.next();
int rowCount=rs.getInt(1);
rs.close();
stm.close();
con.close();
System.out.println(rowCount);
return rowCount;
}
public int call1()throws Exception
{
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe",system,systempass);
stm= con.createStatement();
rs= stm.executeQuery("SELECT COUNT(*) FROM student1 ");
rs.next();
int rowCount1=rs.getInt(1);
rs.close();
stm.close();
con.close();
return rowCount1;
}
public int call3()throws Exception
{
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe",system,systempass);
stm= con.createStatement();
rs= stm.executeQuery("SELECT COUNT(*) FROM issue_book ");
rs.next();
int rowCount3=rs.getInt(1);
rs.close();
stm.close();
con.close();
return rowCount3;
}
public int call4()throws Exception
{
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe",system,systempass);
stm= con.createStatement();
rs= stm.executeQuery("SELECT COUNT(*) FROM librarian ");
rs.next();
int rowCount4=rs.getInt(1);
rs.close();
stm.close();
con.close();
return rowCount4;
}
public static void main(String []args) throws Exception
{
RowCount1 d=new RowCount1();
}
}