Skip to content

Commit cce2a39

Browse files
authored
Merge pull request oracle-samples#119 from oracle/RemoveScott
Remove scott
2 parents 4db5160 + 60a1921 commit cce2a39

File tree

11 files changed

+65
-67
lines changed

11 files changed

+65
-67
lines changed

java/AoJ/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ To run the sample file you will need a SQL database and corresponding JDBC drive
5555
has been run with [Oracle Database 12c](http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html)
5656
and [Oracle Database 12c JDBC](http://www.oracle.com/technetwork/database/application-development/jdbc/downloads/index.html),
5757
but it should work with any reasonably standard compliant SQL database and JDBC
58-
driver. The sample file uses the scott/tiger schema available
59-
[here](https://github.com/oracle/dotnet-db-samples/blob/master/schemas/scott.sql).
58+
driver. The sample file uses the table 'emp' and 'dept'. So, you can create a user "testuser" and 'emp' and 'dept' tables using
59+
[JDBCSampleData.sql](https://github.com/oracle/oracle-db-examples/blob/master/java/jdbc/BasicSamples/JDBCSampleData.sql).
6060

61-
Start the database and load ```scott.sql```. Edit ```com.oracle.adbaoverjdbc.test.FirstLight.java```
61+
Start the database and make sure to create 'testuser' and needed tables using [JDBCSampleData.sql](https://github.com/oracle/oracle-db-examples/blob/master/java/jdbc/BasicSamples/JDBCSampleData.sql). Edit ```com.oracle.adbaoverjdbc.test.FirstLight.java```
6262
and set the constant ```URL``` to an appropriate value. AoJ will pass this value
6363
to ```java.sql.DriverManager.getSession```. If you are using a database other
6464
than Oracle you should change the value of the constant ```TRIVIAL``` to some
@@ -67,7 +67,7 @@ very trivial ```SELECT``` query.
6767
## Sample Code
6868

6969
The following test case should give you some idea of what AoJ can do. It should
70-
run with any JDBC driver connecting to a database with the scott schema. This is
70+
run with any JDBC driver connecting to a database with the 'testuser' schema. This is
7171
the last test in ```com.oracle.adbaoverjdbc.test.FirstLight.java```. For an
7272
introduction to ADBA see the
7373
[JavaOne 2017 presentation](http://www.oracle.com/technetwork/database/application-development/jdbc/con1491-3961036.pdf).

java/AoJ/src/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ To run the sample file you will need a SQL database and corresponding JDBC drive
5050
has been run with [Oracle Database 12c](http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html)
5151
and [Oracle Database 12c JDBC](http://www.oracle.com/technetwork/database/application-development/jdbc/downloads/index.html),
5252
but it should work with any reasonably standard compliant SQL database and JDBC
53-
driver. The sample file uses the scott/tiger schema available
54-
[here](https://github.com/oracle/dotnet-db-samples/blob/master/schemas/scott.sql).
53+
driver. The sample file uses the table 'emp' and 'dept'. So, you can create a user "testuser" and 'emp' and 'dept' tables using [JDBCSampleData.sql](https://github.com/oracle/oracle-db-examples/blob/master/java/jdbc/BasicSamples/JDBCSampleData.sql).
5554

56-
Start the database and load ```scott.sql```. Edit ```com.oracle.adbaoverjdbc.test.FirstLight.java```
55+
Start the database and make sure to create 'testuser' and needed tables using [JDBCSampleData.sql](https://github.com/oracle/oracle-db-examples/blob/master/java/jdbc/BasicSamples/JDBCSampleData.sql). Edit ```com.oracle.adbaoverjdbc.test.FirstLight.java```
5756
and set the constant ```URL``` to an appropriate value. AoJ will pass this value
5857
to ```java.sql.DriverManager.getSession```. If you are using a database other
5958
than Oracle you should change the value of the constant ```TRIVIAL``` to some
@@ -62,7 +61,7 @@ very trivial ```SELECT``` query.
6261
## Sample Code
6362

6463
The following test case should give you some idea of what AoJ can do. It should
65-
run with any JDBC driver connecting to a database with the scott schema. This is
64+
run with any JDBC driver connecting to a database with the 'testuser' schema. This is
6665
the last test in ```com.oracle.adbaoverjdbc.test.FirstLight.java```. For an
6766
introduction to ADBA see the
6867
[JavaOne 2017 presentation](http://www.oracle.com/technetwork/database/application-development/jdbc/con1491-3961036.pdf).

java/AoJ/test/com/oracle/adbaoverjdbc/test/SessionPropertyTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void testUser() {
3838
assertEquals("USER", USER.name());
3939
assertEquals(String.class, USER.range());
4040
assertFalse(USER.validate(1234));
41-
assertTrue(USER.validate("SCOTT"));
41+
assertTrue(USER.validate("testuser"));
4242
assertNull(USER.defaultValue());
4343
assertFalse(USER.isSensitive());
4444
}

java/AoJ/test/com/oracle/adbaoverjdbc/test/TestConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@
3838
* For example, this -D command line option would configure the database user:
3939
* <br>
4040
* <code>
41-
* java -Dcom.oracle.adbaoverjdbc.test.TestConfig.USER=SCOTT ...
41+
* java -Dcom.oracle.adbaoverjdbc.test.TestConfig.USER=testuser ...
4242
* </code>
4343
* <br>
4444
* For convenience, configurable values can be identified by their short name,
4545
* without the <em>com.oracle.adbaoverjdbc.test.TestConfig</em> prefix. For
4646
* example, this -D command line option would also configure the database user:
4747
* <br>
4848
* <code>
49-
* java -DUSER=SCOTT ...
49+
* java -DUSER=testuser ...
5050
* </code>
5151
* <br>
5252
* While convenient, potential collisions can arise if some other component

java/jdbc/BasicSamples/JDBCSampleData.sql

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -12,57 +12,20 @@ Rem
1212
Rem MODIFIED (MM/DD/YY)
1313
Rem nbsundar 04/06/18 - Created
1414

15-
Rem Create a new user "jdbcuser" that will be used in all JDBC code samples
15+
Rem Create a new user "testuser" that will be used in all JDBC code samples
1616
Rem Login as sysadmin before executing the script
17-
CREATE USER jdbcuser IDENTIFIED BY jdbcuser123;
17+
CREATE USER testuser IDENTIFIED BY testuser123;
1818

19-
Rem Grant connect and resource access to the new "jdbcuser"
19+
Rem Grant connect and resource access to the new "testuser"
2020
Rem so that the user can connect and create objects
21-
GRANT CONNECT, RESOURCE TO jdbcuser;
21+
GRANT CONNECT, RESOURCE TO testuser;
2222

23-
Rem Grant required access to the new "jdbcuser"
24-
GRANT UNLIMITED TABLESPACE TO jdbcuser;
23+
Rem Grant required access to the new "testuser"
24+
GRANT UNLIMITED TABLESPACE TO testuser;
2525

26-
Rem Switch the current session to the new jdbcuser session
27-
ALTER SESSION SET CURRENT_SCHEMA=jdbcuser;
26+
Rem Switch the current session to the new testuser session
27+
ALTER SESSION SET CURRENT_SCHEMA=testuser;
2828

29-
Rem Used in the SQLXMLSample.java code sample
30-
CREATE TABLE SQLXML_JDBC_SAMPLE (DOCUMENT XMLTYPE, ID NUMBER);
31-
32-
Rem Used in the PLSQLSample.java code sample
33-
CREATE TABLE PLSQL_JDBC_SAMPLE
34-
(NUM NUMBER(4) NOT NULL,
35-
NAME VARCHAR2(20) NOT NULL,
36-
INSERTEDBY VARCHAR2(20));
37-
38-
Rem Used in LOBBasic.java code sample
39-
CREATE TABLE LOB_JDBC_SAMPLE
40-
(LOB_ID INT NOT NULL,
41-
BLOB_DATA BLOB,
42-
CLOB_DATA CLOB,
43-
NCLOB_DATA NCLOB);
44-
45-
Rem Used in DateTimeStampSample.java code sample
46-
CREATE TABLE EMP_DATE_JDBC_SAMPLE
47-
(EMP_ID INTEGER PRIMARY KEY,
48-
DATE_OF_BIRTH DATE,
49-
DATE_OF_JOINING TIMESTAMP WITH LOCAL TIME ZONE,
50-
DATE_OF_RESIGNATION TIMESTAMP WITH TIME ZONE,
51-
DATE_OF_LEAVING TIMESTAMP);
52-
53-
Rem Used in JSONBasicDemo.java code sample
54-
CREATE TABLE JSON_EMP_JDBC_SAMPLE
55-
(EMP_ID RAW(16) NOT NULL PRIMARY KEY,
56-
DATE_LOADED TIMESTAMP WITH TIME ZONE,
57-
EMPLOYEE_DOCUMENT CLOB CONSTRAINT
58-
ENSURE_JSON CHECK (EMPLOYEE_DOCUMENT IS JSON));
59-
60-
Rem Used in JSONBasicDemo.java code sample
61-
INSERT INTO JSON_EMP_JDBC_SAMPLE VALUES (SYS_GUID(), SYSTIMESTAMP, '{"employee_number": 1, "employee_name": "John Doe", "salary": 2000}');
62-
INSERT INTO JSON_EMP_JDBC_SAMPLE VALUES (SYS_GUID(), SYSTIMESTAMP, '{"employee_number": 2, "employee_name": "Jane Doe", "salary": 2010}');
63-
INSERT INTO JSON_EMP_JDBC_SAMPLE VALUES (SYS_GUID(), SYSTIMESTAMP, '{"employee_number": 3, "employee_name": "John Smith", "salary": 3000, "sons": [{"name": "Angie"}, {"name": "Linda"}]}');
64-
INSERT INTO JSON_EMP_JDBC_SAMPLE VALUES (SYS_GUID(), SYSTIMESTAMP, '{"employee_number": 3, "employee_name": "Jane Williams", "salary": 1000, "sons": [{"name": "Rosie"}]}');
65-
6629
Rem General DEPT table for other code samples
6730
CREATE TABLE DEPT
6831
(DEPTNO NUMBER(2) CONSTRAINT PK_DEPT PRIMARY KEY,
@@ -102,6 +65,42 @@ INSERT INTO EMP VALUES(7900,'JAMES','CLERK',7698,to_date('3-12-1981','dd-mm-yyyy
10265
INSERT INTO EMP VALUES(7902,'FORD','ANALYST',7566,to_date('3-12-1981','dd-mm-yyyy'),3000,NULL,20);
10366
INSERT INTO EMP VALUES(7934,'MILLER','CLERK',7782,to_date('23-1-1982','dd-mm-yyyy'),1300,NULL,10);
10467

68+
Rem Used in the SQLXMLSample.java code sample
69+
CREATE TABLE SQLXML_JDBC_SAMPLE (DOCUMENT XMLTYPE, ID NUMBER);
70+
71+
Rem Used in the PLSQLSample.java code sample
72+
CREATE TABLE PLSQL_JDBC_SAMPLE
73+
(NUM NUMBER(4) NOT NULL,
74+
NAME VARCHAR2(20) NOT NULL,
75+
INSERTEDBY VARCHAR2(20));
76+
77+
Rem Used in LOBBasic.java code sample
78+
CREATE TABLE LOB_JDBC_SAMPLE
79+
(LOB_ID INT NOT NULL,
80+
BLOB_DATA BLOB,
81+
CLOB_DATA CLOB,
82+
NCLOB_DATA NCLOB);
83+
84+
Rem Used in DateTimeStampSample.java code sample
85+
CREATE TABLE EMP_DATE_JDBC_SAMPLE
86+
(EMP_ID INTEGER PRIMARY KEY,
87+
DATE_OF_BIRTH DATE,
88+
DATE_OF_JOINING TIMESTAMP WITH LOCAL TIME ZONE,
89+
DATE_OF_RESIGNATION TIMESTAMP WITH TIME ZONE,
90+
DATE_OF_LEAVING TIMESTAMP);
91+
92+
Rem Used in JSONBasicDemo.java code sample
93+
CREATE TABLE JSON_EMP_JDBC_SAMPLE
94+
(EMP_ID RAW(16) NOT NULL PRIMARY KEY,
95+
DATE_LOADED TIMESTAMP WITH TIME ZONE,
96+
EMPLOYEE_DOCUMENT CLOB CONSTRAINT
97+
ENSURE_JSON CHECK (EMPLOYEE_DOCUMENT IS JSON));
98+
99+
Rem Used in JSONBasicDemo.java code sample
100+
INSERT INTO JSON_EMP_JDBC_SAMPLE VALUES (SYS_GUID(), SYSTIMESTAMP, '{"employee_number": 1, "employee_name": "John Doe", "salary": 2000}');
101+
INSERT INTO JSON_EMP_JDBC_SAMPLE VALUES (SYS_GUID(), SYSTIMESTAMP, '{"employee_number": 2, "employee_name": "Jane Doe", "salary": 2010}');
102+
INSERT INTO JSON_EMP_JDBC_SAMPLE VALUES (SYS_GUID(), SYSTIMESTAMP, '{"employee_number": 3, "employee_name": "John Smith", "salary": 3000, "sons": [{"name": "Angie"}, {"name": "Linda"}]}');
103+
INSERT INTO JSON_EMP_JDBC_SAMPLE VALUES (SYS_GUID(), SYSTIMESTAMP, '{"employee_number": 3, "employee_name": "Jane Williams", "salary": 1000, "sons": [{"name": "Rosie"}]}');
105104

106105
Rem commit the changes to the database
107106
commit;

java/jdbc/BasicSamples/UCPMultiUsers.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ public class UCPMultiUsers {
4242
static String user = DEFAULT_USER;
4343
static String password = DEFAULT_PASSWORD;
4444

45-
// Modify these if user "scott" is locked in DB.
46-
final static String USER2 = "scott";
47-
final static String PASSWORD2 = "tiger";
45+
// Modify these if user "testuser" is locked in DB.
46+
final static String USER2 = "testuser";
47+
final static String PASSWORD2 = "<your_db_password>";
4848

4949
public static void main(String args[]) throws Exception {
5050
getRealUserPasswordUrl(args);

java/ojvm/TrimLob.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ public static void main (String args []) throws SQLException {
4444

4545
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
4646
conn =
47-
DriverManager.getConnection("jdbc:oracle:thin:@localhost:1522/orcl", "scott",
48-
"tiger");
47+
DriverManager.getConnection("jdbc:oracle:thin:@localhost:1522/orcl", "testuser",
48+
"<your_db_password>");
4949
}
5050
long t0,t1;
5151
/*

java/ojvm/TrimLob.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
REM replace scott/tiger with you database username/password
1+
REM Create a table basic_lob_table
22
REM
3-
connect scott/tiger;
3+
connect testuser/<your_db_password>;
44
drop table basic_lob_table;
55
create table basic_lob_table (x varchar2 (30), b blob, c clob);

java/ojvm/TrimLobSp.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public class TrimLob
3838

3939
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
4040
conn =
41-
DriverManager.getConnection("jdbc:oracle:thin:", "scott",
42-
"tiger");
41+
DriverManager.getConnection("jdbc:oracle:thin:", "testuser",
42+
"<your_db_password>");
4343
}
4444
long t0,t1;
4545
/*

java/ojvm/Workers_OJVM.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class Workers
6262

6363
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
6464
conn = DriverManager.getConnection("jdbc:oracle:thin:",
65-
"scott", "tiger");
65+
"testuser", "<your_db_password>");
6666
System.out.println ("Running in JDK VM, outside the database!");
6767
}
6868

0 commit comments

Comments
 (0)