16.01.2014 Views

Diploma Thesis Santiago Gómez Sáez - IAAS

Diploma Thesis Santiago Gómez Sáez - IAAS

Diploma Thesis Santiago Gómez Sáez - IAAS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

7.2. Validation<br />

5 "jdbc:mysql://" + "IPADDRESS" + ":3311/" + DB +"?allowMultiQueries=true;<br />

cacheServerConfiguration=true&" +<br />

6 "jdbcCompliantTruncation=false&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=<br />

false&allowMultiQueries=true&yearIsDateType=false",<br />

7 TENANT_ID + "#" + USER_ID,"tenant1password");<br />

8<br />

10<br />

11<br />

9 ...<br />

12 resultSet = executeQuery(connect, "select ID from customer; select * from mainInfoTest4;" +<br />

13 "select * from mainInfoTest4 as t1, mainInfoTest1 as t2 where t1.ID = t2.ID;");<br />

14 while (resultSet.next()) {<br />

15 System.out.println("IDs " + resultSet.getInt("C_CUSTKEY"));<br />

16 }<br />

17 if (statement.getMoreResults()) {<br />

18 ResultSet nextRs = statement.getResultSet();<br />

19 while (nextRs.next()) {<br />

20 System.out.println("ID_" + nextRs.getInt("ID"));<br />

21 System.out.println("Name_" + nextRs.getString("Name"));<br />

22 System.out.println("SecondName_" + nextRs.getString("SecondName"));<br />

23 }<br />

24 }<br />

25 if (statement.getMoreResults()) {<br />

26 ResultSet nextRs = statement.getResultSet();<br />

27 while (nextRs.next()) {<br />

28 System.out.println("ColumnCount:_" + nextRs.getMetaData().getColumnCount());<br />

29 System.out.println("ID1_" + nextRs.getInt(1));<br />

30 System.out.println("name_" + nextRs.getString(2));<br />

31 System.out.println("SecondName_" + nextRs.getString(3));<br />

32 System.out.println("ID2_" + nextRs.getInt(4));<br />

33 System.out.println("name_" + nextRs.getString(5));<br />

34 }<br />

35 }<br />

36<br />

37 ...<br />

Listing 7.4: Retrieve data via JDBC and MySQL protocol migrated to a backend Cloud<br />

data store, or local database system.<br />

In Listing 7.4 we provide part of a Java program which connects via the MySQL Connector/J<br />

native driver with the MySQL CDASMix Proxy component on the port 3311. The options<br />

attached to the connection URL must be set as in the provided code in order to increase the<br />

performance of the communication, e.g. multi-querying for multiple queries in one statement,<br />

cache server configuration in order not to request the server configuration data per request,<br />

etc. In the MySQL request in Listing 7.4, the tenant operator authenticates with the tenant<br />

and user UUID, and its password. Password is read in the system, but it is not compared in<br />

the authentication process, as the CDASMix MySQL proxy does not implement the hashing<br />

mechanisms of a MySQL server. After successful authentication, it executes a query which<br />

contains multiple queries in the same request. Each query is processed independently in the<br />

system when retrieving information from the different backend database systems, e.g. the<br />

customer table is stored in Amazon RDS, while mainInfoTest4 and mainInfoTest1 are stored<br />

79

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!