6
6
7
7
import java .sql .CallableStatement ;
8
8
import java .sql .Connection ;
9
- import java .sql .DriverManager ;
10
9
import java .sql .ResultSet ;
11
10
import java .sql .SQLException ;
12
11
import java .sql .Statement ;
@@ -90,14 +89,12 @@ public void datatypestest() throws Exception {
90
89
@ Tag ("xAzureSQLDW" )
91
90
@ Tag ("xAzureSQLMI" )
92
91
public void noPrivilegeTest () throws SQLException {
93
- try (Connection c = getConnection ();
94
- Statement stmt = c .createStatement ()) {
92
+ try (Connection c = getConnection (); Statement stmt = c .createStatement ()) {
95
93
String tableName = RandomUtil .getIdentifier ("jdbc_priv" );
96
94
String procName = RandomUtil .getIdentifier ("priv_proc" );
97
95
String user = "priv_user" + UUID .randomUUID ();
98
96
String pass = "priv_pass" + UUID .randomUUID ();
99
97
100
-
101
98
stmt .execute (
102
99
"CREATE TABLE " + AbstractSQLGenerator .escapeIdentifier (tableName ) + " (id int, name varchar(50))" );
103
100
stmt .execute ("CREATE PROC " + AbstractSQLGenerator .escapeIdentifier (procName )
@@ -113,11 +110,9 @@ public void noPrivilegeTest() throws SQLException {
113
110
} catch (SQLException e ) {
114
111
assertTrue (e .getMessage ().matches (TestResource .formatErrorMsg ("R_NoPrivilege" )));
115
112
} finally {
116
- TestUtils .dropProcedureIfExists (procName , stmt );
117
- TestUtils .dropTableIfExists (tableName , stmt );
118
- stmt .close ();
119
- c .close ();
120
113
try (Connection c2 = getConnection (); Statement stmt2 = c2 .createStatement ()) {
114
+ TestUtils .dropProcedureIfExists (procName , stmt2 );
115
+ TestUtils .dropTableIfExists (tableName , stmt2 );
121
116
stmt2 .execute ("DROP USER " + AbstractSQLGenerator .escapeIdentifier (user ));
122
117
stmt2 .execute ("DROP LOGIN " + AbstractSQLGenerator .escapeIdentifier (user ));
123
118
}
0 commit comments