diff --git a/docs/hol/HOL_GUIDE.md b/docs/hol/HOL_GUIDE.md deleted file mode 100644 index 772c9b45..00000000 --- a/docs/hol/HOL_GUIDE.md +++ /dev/null @@ -1,481 +0,0 @@ -# Hands-on-lab Guide - -## 1. Installation -### 1.1 Set up macOS M* -In this first step we are going to set up all the required components to run the AI Optimizer for Apps. As pre-requisites install **docker**. - -#### 1.1.1 Containers runtime engine -We begin by starting our container runtime engine. We will be using Colima here, -and assuming that you are using an Apple Silicon Mac. -Start the container runtime engine. If you already have a profile that you use, please double-check that it uses 4 -CPUs and 8GB of memory. -```bash -brew install colima -brew install qemu -colima start x86 --arch x86_64 --mount-type virtiofs --cpu 4 --memory 8 -``` - -#### 1.1.2 Install and start Oracle DB 23ai - -We are going to use Oracle Database 23ai to take advantage of the vector search feature among other things, so we spin up a container with it. Proceed as describd here: [DB](INSTALL_DB23AI.md) - - -#### 1.1.3 LLM runtime -We would like to interact with different LLMs locally and we are going to use Ollama for running them. We are going to use it in if Ollama isn't installed in your system already, you can use brew: - -```bash - brew install ollama -``` - -You can run Ollama as a service with: -```bash - brew services start ollama -``` - -Or, if you don't want/need a background service you can just run: -```bash - /opt/homebrew/opt/ollama/bin/ollama serve -``` - -We are going to interact with some LLM models, so we need to install them in Ollama (llama3.1 and mxbai for the embeddings): - -```bash -ollama pull llama3.1 -ollama pull mxbai-embed-large -``` - -For OpenAI you need the OPENAI_API_KEY to authenticate and use their services. - -### 1.2 Clone the right branch -* Make sure to clone the branch `cdb`. Proceed in this way: -```bash -git clone --branch cdb --single-branch https://github.com/oracle-samples/ai-optimizer.git -``` - -### 1.3 Install requirements: - -#### 1.3.1 Python version - -AI Optimizer for Apps requires exactly Python 3.11, neither older nor newer. If you are using a recent version of macOS, -you will need to install that version side by side with the builtin one. -Install Python 3.11: - - ```bash - brew install python@3.11 - python3.11 --version - ``` - -#### 1.3.2 Create environment - - ```bash - cd src/ - python3.11 -m venv .venv --copies - source .venv/bin/activate - pip3.11 install --upgrade pip wheel setuptools - ``` - -#### 1.3.3 Install the Python modules: - - ```bash - pip3.11 install -e ".[all]" - source .venv/bin/activate - ``` - - -### 1.4 Startup - -* Create a `server.sh` file in the : - - ```bash - export API_SERVER_KEY= - export API_SERVER_URL="http://localhost" - export API_SERVER_PORT=8000 - export OPENAI_API_KEY= - export DB_USERNAME=vector - export DB_PASSWORD=vector - export DB_DSN="localhost:1521/FREEPDB1" - - export ON_PREM_OLLAMA_URL="http://localhost:11434" - - cd src - source .venv/bin/activate - python launch_server.py - ``` - -The script `server.sh` hold env variables needed to connect the DB and OpenAI and the `API_SERVER_KEY` to authenticate the client. Set one, for example, `abc12345` and use the same in the following `client.sh`. Set the `OPENAI_API_KEY` in the server script. -If, for any reasons, you need to adapt the DBMS to a different instance and setup, change the variables accordingly. - -* Create a `launch_client.sh` file in the : - -```bash -export API_SERVER_KEY= -cd src -source .venv/bin/activate -streamlit run launch_client.py --server.port 8502 -``` - -Set the same `` to be authorized on the AI Optimizer. - -* In a separate shell: - - ```bash - source ./server.sh - ``` - -* in another terminal: - ```bash - source ./client.sh - ``` - -## 2. Explore the env -In a browser, open the link: `http://localhost:8502/` - -### 2.1 DB connection - -Let's check if the DB is correctly connected: - -![DB](images/db.png) - -* You should see the message: `Current Status: Connected` - -### 2.2 OCI Credentials - -In the OCI configuration tab, you can add your Oracle Cloud Infrastructure (OCI) credentials to authenticate with your OCI tenancy. This will enable access to objects and documents stored in your cloud compartments. - -![OCI](images/oci.png) - -Detailed information on obtaining the required credentials is available in the [Oracle Cloud Infrastructure Documentation](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm#Required_Keys_and_OCIDs). - -If you have previously created a .oci/config file, the AI Optimizer will automatically read this file at startup and load the credentials from the Default profile for authentication. - -After entering your credentials, click the Save button. If the credentials are correct, a green confirmation pop-up will appear, indicating successful authentication to your tenancy. - -![OCI-CREDENTIALS](images/oci-credentials-success.png) - -### 2.3 LLM config - -Let's check models available: - -![models menu](images/models.png) - - * The default LLMs for chat completions are: - - ![llms](images/llms.png) - - * The default LLMs for embeddings are: - - ![embeddings](images/emb.png) - - * **OPTIONAL**: We can configure the Ollama models so that they can reach a url endpoint where the models are already configured. For example, click on the *edit* button for llama3.1 LLM and fill the *API URL* field with this endpoint - - ```plaintext - http://:11434 - ``` - - ![llama3.1-endpoint](images/llama3.1-endpoint.png) - - Now repeat this step also for the *mxbai-embed-large* embedding model. - -* **OPTIONAL**: Let's add another LLM to Ollama (for local deployments only) and enable it in the model list. - - * Let's add the model LLama3.2: - - ```bash - ollama run llama3.2 - ``` - * Now, we will enable in the model list. Under left menu **Models** / **Language Models**, press button **Add**, and complete the form with the values shown in the following snapshot: - - ![new_llama32](images/addllama32.png) - - -### 2.4 Chat -The two LLMs availble could be tested straightful to understand their behaviour with generic questions. Before to access the chat GUI - -![chat](images/chat.png) - -scroll down the left side menu to find the **Chat model** menu: - -![chat models](images/chatmodel.png) - -and, with the **Enable RAG?** check-box not selected, choose the **gpt-4o-mini** and ask generic question like: -``` -Which kind of database you can use to run the Java Web example application? -Can I use any kind of development environment to run the example? -``` -NOTICE: *if you see a message on top **Database has no Vector Stores. Disabling RAG.** don't care since you haven't yet create a vector store and you can't use the RAG*. - -As you can see, even if the question mean to refer a specific example, the LLM answer in a generic way. - -* Click the button **Clear** under **History and Context**, and choose the other LLM available, **llama3.1**, -to start a conversation with the same questions, and compare the answers. Note that the History is enabled by default. The **Clear** button reset the “context window” and start a fresh interaction with a model. - -* Play with the **Temperature** parameter, and the others to compare the quality of the answers, for each LLM available. Clear the history pressing button **Clear** after each cycle. - - -### 2.5 Prepare vector store -Proceed as shown [here](SPLIT-EMBED.md) to prepare a vectorstore to augment the answers provided by the chatbot compare with a plain LLM that hasn't enough context info to answer on a topic. - -### 2.6 RAG test -Now that we have two vector store, let's start to test the second knowledge base created with the OpenAI service:`TEST2` to use classical public resources. - -* Clear history pressing button **Clear** and choose **gpt-4o-mini** model for initial test. - -* Scrolling down the left side pane, **Enable RAG?**. - -* In **Select Alias** dropdown box, select the `TEST2` vector store table. You will see the rest of the fields of **Vector Store** menu automatically populated, since each of them represent a search parameter that could be used to select the vector store created. In this case, the alias is enough to determine what you are looking for but, from the other side, you have the evidence of the parameteres used to create the chunk and related embeddings vector. - -* Let's ask again the same questions to which the LLM has provided generic anwers since not related to the document loaded that the LLM ignored in its training or not enough addressed in the questions: - -``` -Which kind of database you can use to run the Java Web example application? -Which Java environment should be used to run this example? -``` - -On TEST2 vector store you will try with the main params set in the following way, how will change the quality of the answers. -**IMPORTANT**: Clear history, pressing button **Clear** after each question, also if you change the parameters and repeat the same question. - - * LLM:gpt-4o-mini - * TopK: 4 - * Search Type: Similarity - * Temperature: 0 - -``` -Q: Which Java environment should be used to run this example? - -A: The example should be run in an integrated development environment (IDE), specifically using IntelliJ IDEA community version as recommended in the documentation. Additionally, it will require a Web server with a servlet and JSP container, with Apache Tomcat being the server suggested for deploying the JSP pages (as per the guide). -``` - - * LLM: gpt-4o-mini - * TopK: 10 - * Search Type: Similarity - * Temperature: 0 - -``` -Q: Which Java environment should be used to run this example? - -A: The example is recommended to be developed in an integrated development environment (IDE) like IntelliJ IDEA, specifically the community version, for ease of development. Additionally, the application uses Apache Tomcat as the web server for deploying the JavaServer Pages (JSP) technology in the HR Web application. For database connectivity, the Java code should be run on the Oracle Database, leveraging the capabilities of the Oracle JDBC Thin driver with a Java Virtual Machine (JVM) (Chapter 4 and Chapter 1). -``` - -**COMMENT**: as you can see with more chunks provided, the bot mentions also other technologies like Oracle JDBC, JVM and the Oracle Database. - - - * LLM: gpt-4o-mini - * TopK: 4 - * Search Type: Similarity - * Temperature: 0 -``` -Q: Which kind of database you can use to run the Java Web example application? - -A: You can use the Oracle Database, specifically the Autonomous Transaction Processing database, to run the Java Web example application. This is part of the requirements for developing the HR web application, which operates within the Oracle Database environment (see Chapter 4, "What You Need to Install"). -``` - - * LLM: gpt-4o-mini - * TopK: 10 - * Search Type: Similarity - * Temperature: 0 - -``` -Q: Which kind of database you can use to run the Java Web example application? - -A: You can use the Oracle Database to run the Java Web example application, specifically the HR schema within the Oracle Database. The application can be developed using either an on-premises installation of Oracle Database or Oracle Autonomous Database in the cloud (as part of Oracle Cloud Free Tier) which is recommended for its ease of access and automation (see Chapter 4). -``` - -**COMMENT**: In the second answer it mentions the Oracle Cloud Free Tier. - -* Conclusion: we can suppose that 10 chunks as TopK similar vector represents a better parameters than the deafult 4. - -* Play with Temperature to discover how much become reacher in terms of expressions the answers provided. - -* Follow a question by another like "more" to have the evidence that the history is considered providing the answer in the conversation. - -* Clear history, pressing button **Clear** - -### 2.6.1 OLLAMA test. -Repeat the tests with local LLMs based on the OLLAMA server and vector store: `TEST1`, and choose **llama3.1** in **Chat model** dropdown menu to have the same LLM provider. - - -### 2.7 Testbed -We are confident that changing some parameters the quality and accuracy of the answers improve. But are you sure that on a large scale deployment your setup it's reliable on hundreds or thousands of different questions? -Testbed helps you to massive test your chatbot, generating for you a Q&A test dataset and automatically try on your current configuration. Let's access to the Testbed from left pane menu: - -![testbed](./images/tesbed.png) - -#### Generate a Q&A Test dataset -The platform allows to generate as many questions and answer you desire, based on a single document, that it's part of the knowledge base you have store as vector store with their own embeddings. Selecting the proper radio button you will access to the AI Optimizer test dataset generation capabilities: - -![generate](./images/generatenew.png) - -* Upload the document used to create the vector store, getting from this [this link](https://docs.oracle.com/en/database/oracle/oracle-database/23/tdpjd/get-started-java-development.pdf). - -* Increase the number to be generated to 10 or more. Take in consideration that the process it's quite long, especially if you will use local LLM for Q&A generation without enough hardware capacity. In case of OpenAI remote model, the process it's less affected by increasing the number of Q&As than the private LLM approach. - -* Leave the default option for: - * Q&A Language Model: **gpt-4o-mini** - * Q&A Embedding Model: **text-embedding-3-small** - -* Click on **Generate Q&A** button and wait up to the process is over: - - ![patience](./images/patience.png) - -* Browse the questions and answers generated: - - ![qa_browse](./images/qa_browse.png) - - Note that the **Question** and the **Answer** fields are editable, since you can correct at your convenience the proposed Q&A pairs based on the **Context** that has been extracted randomly and not editable, as well as the **Metadata** that are set by the Testbed engine. In Metadata field you'll find a **topic** tag that classify the Q&A. The topic list is generated automatically analyzing the text and added to each Q&A. It will used in the final report to drilldown the **Overall Correctness Score** and identify area in which the chatbot lacks of precision. - The **Download** allow to export and modify in each part the Q&A dataset generated. Open it in Visual Studio Code to see the content: - - ![qa_json](./images/qa_json.png) - -* Update the **Test Set Name**, changing the default one automatically generated, in order to identify more easily later the test dataset for repeated tests on different chatbot configurations. For example, from: - - ![default_test_set](./images/default_test_set.png) - -change in : - - ![test_rename](./images/test_rename.png) - -* On the left pane menu: - - * Under **Language Model Parameters**, select in the **Chat model** dropdown list **gpt-4o-mini** - * **Enable RAG?** if for any reason hasn't been selected - * Choose in the **Select Alias** dropdown list the **TEST2** value. - * Leave unchanged the default parameters on the left pane. - -* Leaving the default one model to judge, **gpt-4o-mini**, click on **Start Evaluation** button and wait a few seconds. All the questions will be submitted to the chatbot as configured in the left pane: - - ![start_eval](./images/start_eval.png) - -* Let's examine the result report, starting from the first part: - - ![result](./images/result_topic.png) - -It shows: - * The chatbot's **Evaluation Settings** as it has been configured in the left side playground, before start the massive test - * The **RAG Settings** for the Database and the relative Vector Store selected, with the name of the embedding **model** used and all the parameters set, from **chunk_size**, to the **top_k**. - * The **Overall Correctness Score** that represents the percentage between the total number of questions submitted and the answers considered correct by the LLM used to judge the response compared the reference answer. - * The **Correctness By Topic**: each question in the test dataset comes with a tag that represents the topic it belongs to. The list of topics it's extracted automatically at the creation step of the Q&A synthetic dataset. - -The second part of the report provides details about each single questions submitted, with a focus on the collection by **Failures** and the **Full Report** list. To show all the fields, scrool from the right to left to see all info. In the following picture the second frame has been scrolled: - - ![result](./images/result_question.png) - - * **question**: question submitted - * **reference_asnwer**: represents the anwers that is considered correct an we aspect quite similar to the answer will be provided by the agent - * **reference_context**: the section of document extracted and used to create the Q&A - * **agent_answer**: the answer provided by the chatbot with the current configuration and knowledge base as vectorstore - * **correctness_reason**: it reports eventually why has been judged not correct. If the answer - has been considered right you'll see **None** as value. - -* You can get a copy of the results as an HTML page reporting the *Overall Correctness Score* and *Correctness By Topic* only, cliccking on the **Download Report** button. Click it to view how is the report. - -* You can also dowload the **Full Report** and **Failures** list as a *.csv* file selecting each frame as shown in the following snapshot: - - ![csv](./images/download_csv.png) - -* Now let's test through an external saved test datset, that you can download [here](getting_started-30_testset.json) with 30 questions already generated. If you want to drop some Q&A that are not meaningful in your opinion, update it, save and reload as local file, following the steps shown in this snapshot: - - ![load_tests](./images/load_tests.png) - -* Now redo the test to get the **Overall Correctness Score** with much more Q&A pairs. - -* Let's change the Chat model parameters, setting to **0** the Model **Temperature** in the left pane, section **Language Model Parameters**. Why? The Q&As generated are usually done with a low level of creativity to be less random in the content and express the core concepts avoiding "frills". So, repeat the test to check if there are any improvements in the **Overall Correctness Score**. - -* To compare with previous results, click on dropdown list unde **Previous Evaluations for...** and click on **View** button to show the overall report. - - ![previous](./images/previous.png) - -* Repeat the tests as many time you desire changing: **Vector Store**, **Search Type** and **Top K** to execute the same kind of tuning you have done at the previous steps with just a few interactive questions, now on a massive test on curated and comparable assets. - -## 3. Export and run the chatbot as a Spring AI microservice - -The AI Optimizer allows to export the chatbot defined as a ready-to-run microservice built in Java, Spring Boot and Spring AI framework, that will run independently by the AI Optimizer, leveraging only the vector store table created, and the LLM servers used. In the current relase are supported only fully Ollama configuration (embeddings + chat model) or OpenAI. - -### 3.1 Pre-requisites -To run the microservice exported you need: - * JDK 21.x - * Apache Maven 3.8.x - * curl command - -### 3.2 Execute the Ollama version - -* **Select Alias:** as **TEST1** vector store, and **LLama3.1** as **Chat model**. In this way the configuration will be based on the Ollama LLM server provider for both LLMs, embeddings and chat, and go to the **Settings** menu in the left pane side. You'll find the **Download SpringAI** button available. This - -If you'll find a message like this: - - ![notollama](./images/diff_llm_springai.png) - -don't worry: choose for the **Chat model:** the **llama3.1** and the button will appear. - -* Download one of them through the `Download SpringAI` button. - -* Unzip the file in a subdir. - -* Open a terminal and set the executable permission on the `env.sh` with `chmod 755 ./start.sh`. - -* Start the microservice a with: - -``` -./start.sh -``` - -* This microservice expose a web service that will accept HTTP GET requests at: - - * `http://localhost:8080/v1/chat/completions`: to use RAG via OpenAI REST API; - * `http://localhost:8080/v1/service/llm` : to chat straight with the LLM used; - * `http://localhost:8080/v1/service/search/`: to search for document similar to the message provided. - -* To test it, run a curl command like this in a new terminal: - - ``` - curl -X POST "localhost:8080/v1/chat/completions" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer your_api_key" \ - -d '{"message": "Can I use any kind of development environment to run the example?"}' - ``` - - The response with RAG, on the **TEST1** Vector store, it will be like this: - - ``` - { - "choices": [ - { - "message": { - "content": "Yes, you can use any kind of development environment to run the example, but for ease of development, the guide specifically mentions using an integrated development environment (IDE). It uses IntelliJ IDEA Community version as an example for creating and updating the files for the application (see Document 96EECD7484D3B56C). However, you are not limited to this IDE and can choose any development environment that suits your needs." - } - } - ] - } - ``` - - A request without leverage RAG: - ``` - curl --get --data-urlencode 'message=Can I use any kind of development environment to run the example?' localhost:8080/v1/service/llm - ``` - - it will produce a response not grounded like this: - - ``` - { - "completion": "Yes, you can use various development environments to run examples, depending on the programming language and the specific example you are working with. Here are some common options:\n\n1. **Integrated Development Environments (IDEs)**:\n - **Visual Studio Code**: A versatile code editor that supports many languages through extensions.\n - **PyCharm**: Great for Python development.\n - **Eclipse**: Commonly used for Java development.\n - **IntelliJ IDEA**: Another popular choice for Java and other languages.\n - **Xcode**: For macOS and iOS development (Swift, Objective-C).\n\n2. **Text Editors**:\n - **Sublime Text**: A lightweight text editor with support for many languages.\n - **Atom**: A hackable text editor for the 21st century.\n - **Notepad++**: A free source code editor for Windows.\n\n3. **Command Line Interfaces**:\n - You can run" - } - ``` - -### 3.3 Execute the OpenAI version -Proceed as in the previous step, choosing in **Select Alias:** the **TEST2** vector store, and **gpt-4o-mini** as **Chat model**. In the terminal where you'll run the Spring Boot microservice, be sure that the **OPENAI_API_KEY** is correctly set. - - -## 4. Backup Env -All the AI Optimizer server can be exported to save the configuration as backup and imported in another server. - -* Go to the left pane menu **Settings**: - -![Settings](images/settings.png) - -* Drilling down the tree, you can access to all the parameters related, for example, to one of the LLMs configured: - -![Settings_llama](images/settings_llama.png) - -* From this page you can: - * **Upload** and existing configuration file - * **Download Settings** of the current configuration - * Exclude by the download the credential parameters, unchecking the **Include Sensitive Settings** diff --git a/docs/hol/INSTALL_DB23AI.md b/docs/hol/INSTALL_DB23AI.md deleted file mode 100644 index c59b378e..00000000 --- a/docs/hol/INSTALL_DB23AI.md +++ /dev/null @@ -1,58 +0,0 @@ -# Install Oracle DB23ai - - - -## Description - -AI Vector Search in Oracle Database 23ai provides the ability to store and query private business data using a natural language interface. The **AI Optimizer** uses these capabilities to provide more accurate and relevant LLM responses via Retrieval-Augmented Generation (**RAG**). [Oracle Database 23ai Free](https://www.oracle.com/uk/database/free/get-started) provides an ideal, no-cost vector store for this walkthrough. - ---- - -⚠️ **Warning** - -If you are running this lab on a MacOS system, you would need to simulate podman using colima. Run this command to start colima with profile x86: - -```bash -alias podman=docker -colima start x86 -``` - ---- - -To start Oracle Database 23ai Free: - -1. Start the container: - -```bash -podman run -d --name db23ai -p 1521:1521 container-registry.oracle.com/database/free:23.7.0.0-amd64 -``` - -2. Alter the vector_memory_size parameter and create a new database user: - -```bash -podman exec -it db23ai sqlplus '/ as sysdba' -``` - -```bash -alter system set vector_memory_size=512M scope=spfile; - -alter session set container=FREEPDB1; - -CREATE USER "VECTOR" IDENTIFIED BY vector - DEFAULT TABLESPACE "USERS" - TEMPORARY TABLESPACE "TEMP"; -GRANT "DB_DEVELOPER_ROLE" TO "VECTOR"; -ALTER USER "VECTOR" DEFAULT ROLE ALL; -ALTER USER "VECTOR" QUOTA UNLIMITED ON USERS; -EXIT; -``` - -3. Bounce the database for the vector_memory_size to take effect: - -```bash -podman container restart db23ai -``` - -In the next steps of this lab, you will need to check the items inside your database 23ai. In order to do so, install the VS Code **SQL Developer** plugin: - -![sql-developer-plugin](images/sql-developer-plugin.png) \ No newline at end of file diff --git a/docs/hol/SPLIT-EMBED.md b/docs/hol/SPLIT-EMBED.md deleted file mode 100644 index c2b12ee0..00000000 --- a/docs/hol/SPLIT-EMBED.md +++ /dev/null @@ -1,53 +0,0 @@ -# Split/Embed Documents - - - -In the **Split/Embed** tab, the AI Optimizer allows you to upload various types of documents and transform their content into vector embeddings in a format that is interpretable by LLMs. - -![split-embed-interface](images/split-embed.png) - -You can choose from the embedding models you selected during the initial configuration using a drop-down menu and adjust their parameters accordingly. -For the first one choose **mxbai-embed-large**. The chunk size defines the length of each segment into which the document will be split, while the chunk overlap represents the percentage of overlap between consecutive chunks relative to the chunk size. - -Additionally, you can select different distance metrics and index types to experiment with various vector representations of the same document, allowing you to identify the configuration that best meets your needs. - -Once configured, scroll down to the Load and Split Documents section to upload the document you wish to store in your **Oracle Database 23ai**. - -![populate-vector-store](images/populate-vector-store.png) - -You can choose from three different file sources: - -* **OCI**: Navigate through your tenancy to select documents from the Object Storage. Ensure that your OCI credentials are properly configured in advance. -* **Local**: Upload a document directly from your local environment. -* **Web**: Import a document from a publicly accessible web URL. - -In this example, we will embed a document from the web, available at [this link](https://docs.oracle.com/en/database/oracle/oracle-database/23/tdpjd/get-started-java-development.pdf). We will give the alias ***TEST1*** to this vector store. - -You can then click on the **Populate Vector Store** button and start the embedding process. - -Once the process is complete, a green confirmation prompt will appear, indicating the number of chunks that have been generated and successfully stored in the database. - -![vector-store-populated](images/vector-store-populated.png) - -This means that 224 vectors representations of the information from the input document have been created and stored. - -As an example, you can query the vector store by connecting to your Oracle Database 23ai using the SQL Developer plugin we mentioned earlier: - -![query-vector-db](images/query-vector-db.png) - -Then, you can retrieve the rows from the newly created table with this command: - -```sql -select * from VECTOR.TEST1_MXBAI_EMBED_LARGE_512_103_COSINE_HNSW; -``` - -What you see in the image above are chunks of text from the input document, which have been transformed into vector format and stored in the Oracle database. Essentially, you’ve replicated the knowledge contained in the document within your database! - -By following the sames steps, we can creat another vector store using the same document but with a different embedding model, **text-embedding-3-small** from the OpenAI models. We will give the alias ***TEST2*** to this vector store. -In this case, we will get a smaller number of chunks, since the model supports a chunk size of 8191 instead of the 512 given by *mxbai-embed-large*: - -![text-embedding-3-small](images/text-embedding-3-small.png) - -You can now navigate to the Database tab in the AI Optimizer to see the list of all the vector stores that have been created. If needed, you can easily delete them with a single click. - -![database-vector-store-list](images/database-vector-store-list.png) diff --git a/docs/hol/getting_started-30_testset.json b/docs/hol/getting_started-30_testset.json deleted file mode 100644 index 18b8a04f..00000000 --- a/docs/hol/getting_started-30_testset.json +++ /dev/null @@ -1,422 +0,0 @@ -[ - { - "id":"7b6cf8d4-44bc-4c81-8221-3ca3bd6e0a33", - "question":"What are the two types of users in the HR Web Application?", - "reference_answer":"The two users in the HR Web Application are hradmin and hrstaff.", - "reference_context":"Document 52: 9\nCreate Login and Logout Functionality\nThe HR Web Application has two users, namely hradmin and hrstaff.\nOnce you login to the HR Application, you see the landing page, with details of the web\napplication. The hradmin and hrstaff have different privileges and access to different\nfeatures.\nThis chapter shows the required classes and additional code required to build the Login and\nLogout functionality in the application.\n\u2022 Create a XML file tomcat-users.xml for login functionality.\n\u2022 Create a HTML page login.html to login the user.\n\u2022 Create a HTML page login-failed.html to display the error message.\n\u2022 Create a web.xml to authenticate the users during login.\n\u2022 Create a HTML page about.html to show more details about the application.\n\u2022 Create a landing page index.html and define the html pages for redirection.\n\u2022 Add code to the servlet WebController.java to process logout.\n9-1", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"simple", - "seed_document_id":"52", - "topic":"Login and Logout Functionality" - } - }, - { - "id":"3cecbe31-3eee-469c-955c-70d32295cd9c", - "question":"What should you do after updating the connection variable with your database connection details?", - "reference_answer":"In the File menu, select Save All to save the changes.", - "reference_context":"Document 21: 4. Update the connection variable with the details of your database connection.\n5. In the File menu, select Save All to save the changes.\n6. In the Maven window on the right, double-click on clean to clean the source code.\nThe build progress is shown in the Run window at the bottom.\n7. Similarly, double-click on compile and package in the same order.\nChapter 4\nCompile the Application in IntelliJ\n4-6", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"simple", - "seed_document_id":"21", - "topic":"Others" - } - }, - { - "id":"b96db39f-42cb-4e33-a104-bdb8a75e9ba3", - "question":"What should you do after adding the dependency under the tag in the pom.xml file?", - "reference_answer":"In the Project window, expand the src folder, expand main and then Java folder. Under Java, expand com.oracle.jdbc.samples. In the bean folder, double-click JdbcBeanImpl.", - "reference_context":"Document 20: 2. Add the following dependency under the tag in pom.xml file. See JDBC\nDrivers for more information.\n3. In the Project window, expand the src folder, expand main and then Java folder. Under\nJava, expand com.oracle.jdbc.samples. In the bean folder, double-click\nJdbcBeanImpl.\nChapter 4\nCompile the Application in IntelliJ\n4-5", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"simple", - "seed_document_id":"20", - "topic":"Java Web Application Development" - } - }, - { - "id":"91c78fc2-a0d9-45fb-9c89-25053d316fd9", - "question":"What happens when the edit button is pressed for an employee record?", - "reference_answer":"If the edit button is pressed already, the function will make the column readonly and allow the user to edit the field names once the employee record is displayed.", - "reference_context":"Document 45: +' No records found for the given Fist_Name<\/div>'\n }\n else {\n var i;\n var out = \"\";\n \/\/ keys is global so that it can be used later as well\n keys = Object.keys(arr[0]);\n \/\/ Print headers\n out += \"
Trash<\/th>Edit<\/th>\"\n for(i = 0; i < keys.length; ++i) {\n out += \"\"+keys[i]+\"<\/th>\"\n }\n out += \"<\/tr>\";\n \/\/ Print values\n for(j = 0; j < arr.length; j++) {\n pk = arr[j][keys[0]];\n out += '
'\n +'<\/span>'\n +'<\/a><\/td>'\n +''\n +'<\/span>'\n +'<\/a><\/td>';\n \/\/ 0 is the primary key\n for(i = 0; i < keys.length; ++i) {\n \/\/ creating an id to each column\n out += \" \"+arr[j][keys[i]]+\"<\/\ntd>\";\n }\n out += \"<\/tr>\"\n }\n out += \"<\/table>\";\n }\n $('#id-emp').html(out);\n}\n5. Add the allowEditSalary(pk) function to make the field names editable once the employee\nrecord is displayed.\nfunction allowEditSalary(pk) {\n \/\/ If the edit button is pressed already\n if(typeof currentPK != 'undefined' && currentPK == pk) {\n console.log('Make column readonly');\n for(i = 1; i < keys.length; ++i) {\n var x = '#' +pk +\"_\" +keys[i];\n var value = $(x).text().trim();\n console.log(value);\n $(x).val(value);\n }\n $('#UpdateButton').hide();\nChapter 7\nCreate a New HTML for Search by Employee Id\n7-7", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"simple", - "seed_document_id":"45", - "topic":"Java Employee Management" - } - }, - { - "id":"ed733096-71d5-400d-ab25-28748aa31a40", - "question":"What is the first step to update an employee record in the database?", - "reference_answer":"You must search for an employee in the records.", - "reference_context":"Document 39: 7\nUpdate an Employee Record\nThe Update functionality modifies an employee record in the database according to the user\nedits on the web page.\nFirst, you must search for an employee in the records. Once you retrieve the information\nrelated to the employee, you will find the Edit button to modify details related to the\nemployee.\nIn this chapter, you learn to add code required to build the Update functionality. You will learn\nhow to:\n1. Declare a new method getEmployeeByFn(String) in JavaBean.java.\n2. Declare a new method updateEmployee(int) in JavaBean.java.\n3. Implement a new method getEmployeeByFn(String) in JavaBeanImpl.java.\n4. Implement a new method updateEmployee(int) in JavaBeanImpl.java.\n5. Add new code to WebController.java to process the request and response.\n6. Create a HTML page listByName.html to display the results.\nNote:\nThe hradmin user has the privilege to update an employee record. The hrstaff\nuser does not have the privilege to update an employee record.\nDeclare a new method getEmployeeByFn(String) in\nEmployeeBean.java\nTo modify the details of an employee, the hradmin must first search for the employee based\non his\/her first name. The getEmployeeByFn(String) method searches employees based on\ntheir first name.\nClass Name: src\/main\/java\/com\/oracle\/jdbc\/samples\/bean\/EmployeeBean.java\nGithub Location: EmployeeBean.java\n7-1", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"simple", - "seed_document_id":"39", - "topic":"Java Employee Management" - } - }, - { - "id":"86357f8a-550d-434e-b2f0-a1202c65da36", - "question":"What should you do if you find errors in the documentation?", - "reference_answer":"If you find any errors, please report them to us in writing.", - "reference_context":"Document 1: Oracle Database Get Started with Java Development, 23ai\nF47017-03\nCopyright \u00a9 2007, 2024, Oracle and\/or its affiliates.\nPrimary Author: Tulika Das\nContributing Authors: Apoorva Srinivas, Tanmay Choudhury\nContributors: Kuassi Mensah, Nirmala Sundarappa\nThis software and related documentation are provided under a license agreement containing restrictions on\nuse and disclosure and are protected by intellectual property laws. Except as expressly permitted in your\nlicense agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license,\ntransmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse\nengineering, disassembly, or decompilation of this software, unless required by law for interoperability, is\nprohibited.\nThe information contained herein is subject to change without notice and is not warranted to be error-free. If\nyou find any errors, please report them to us in writing.\nIf this is software, software documentation, data (as defined in the Federal Acquisition Regulation), or related\ndocumentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S.\nGovernment, then the following notice is applicable:\nU.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software,\nany programs embedded, installed, or activated on delivered hardware, and modifications of such programs)\nand Oracle computer documentation or other Oracle data delivered to or accessed by U.S. Government end\nusers are \"commercial computer software,\" \"commercial computer software documentation,\" or \"limited rights\ndata\" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental\nregulations. As such, the use, reproduction, duplication, release, display, disclosure, modification, preparation\nof derivative works, and\/or adaptation of i) Oracle programs (including any operating system, integrated\nsoftware, any programs embedded, installed, or activated on delivered hardware, and modifications of such\nprograms), ii) Oracle computer documentation and\/or iii) other Oracle data, is subject to the rights and\nlimitations specified in the license contained in the applicable contract. The terms governing the U.S.\nGovernment's use of Oracle cloud services are defined by the applicable contract for such services. No other\nrights are granted to the U.S. Government.\nThis software or hardware is developed for general use in a variety of information management applications.\nIt is not developed or intended for use in any inherently dangerous applications, including applications that\nmay create a risk of personal injury. If you use this software or hardware in dangerous applications, then you\nshall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its\nsafe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this\nsoftware or hardware in dangerous applications.\nOracle\u00ae, Java, MySQL and NetSuite are registered trademarks of Oracle and\/or its affiliates. Other names\nmay be trademarks of their respective owners.\nIntel and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are\nused under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Epyc,\nand the AMD logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered\ntrademark of The Open Group.\nThis software or hardware and documentation may provide access to or information about content, products,\nand services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly\ndisclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise\nset forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not be\nresponsible for any loss, costs, or damages incurred due to your access to or use of third-party content,\nproducts, or services, except as set forth in an applicable agreement between you and Oracle.", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"simple", - "seed_document_id":"1", - "topic":"Java Web Application Development" - } - }, - { - "id":"ce5fd492-f8c5-4454-90dd-207e331146ab", - "question":"What is the purpose of the variable FN_KEY in the WebController class?", - "reference_answer":"The variable FN_KEY is declared to capture the first name of the employee and is a global variable, hence, it is declared outside the method processRequest() but within the WebController class.", - "reference_context":"Document 43: 2. Declare a variable FN_KEY to capture first name of the employee. This is a global variable,\nhence, declare it outside the method processRequest() but within the WebController\nclass.\nprivate static final String FN_KEY = \"firstName\";\n3. The method processRequest() is already created in the ListAll feature. Now, we add the\ncode to implement Update an Employee functionality. Add an ELSEIF condition to\nhandle the new functionality. Get the employee id entered by the user and invoke the\nmethod getEmployee(int) to verify if the employee record exists.\nif ((value = request.getParameter(ID_KEY)) != null) {\n int empId = Integer.valueOf(value).intValue();\n employeeList = employeeBean.getEmployee(empId);\n } \n\/* New code added below *\/\nelse if ((value = request.getParameter(FN_KEY)) != null) {\n employeeList = jdbcBean.getEmployeeByFn(value);\n}\nelse { \n \/* Previously used getEmployees() method for Listall feature *\/\n employeeList = employeeBean.getEmployees();\n }\nCreate a New HTML for Search by Employee Id\nA HTML page that shows an input placeholder for the user to enter the employee first name.\nIf the employee record is found, then the details of the employee is displayed on the page,\notherwise, an error message will be displayed.\nClass Name:src\/main\/webapp\/listById.html\nGithub Location: listByName.html\nSteps to create the HTML page:\n1. Create the title, stylesheet, and body for the HTML page.\n\n\n\n\nList Employee by Id<\/title>\n<!-- Specify the stylesheet here -->\n<link rel=\"stylesheet\" type=\"text\/css\" href=\"css\/app.css\" >\n<!-- Bootstrap JS for the UI -->\n<link rel=\"stylesheet\" \nhref=\"http:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.6\/css\/\nbootstrap.min.css\">\n<script src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.12.2\/\njquery.min.js\"><\/script>\n<\/head>\nChapter 7\nCreate a New HTML for Search by Employee Id\n7-5\n\nDocument 36: 2. Declare a variable ID_KEY to capture the employee id. This is a global variable, hence,\ndeclare it outside the method processRequest() but within the WebController class.\nprivate static final String ID_KEY = \"id\";\n3. The method processRequest() is already created in the ListAll feature. Now, we add the\ncode to implement Search by employee id functionality. Declare a variable value of the\nString type to capture the input from the user.\nString value = null;\n4. Add an IF condition to handle the new functionality. Get the employee id entered by the\nuser and invoke the method getEmployee(int) to verify if the employee record exists.\nif ((value = request.getParameter(ID_KEY)) != null) {\n int empId = Integer.valueOf(value).intValue();\n employeeList = employeeBean.getEmployee(empId);\n } else { \n \/\/ Previously used getEmployees() method for Listall feature\n employeeList = employeeBean.getEmployees();\n }\nCreate a New HTML for Search by Employee Id\nA HTML page that shows an input placeholder for the user to enter the employee id. If the\nemployee record is found, then the details of the employee is displayed on the page,\notherwise, an error message will be displayed.\nClass Name:src\/main\/webapp\/listById.html\nGithub Location: listById.html\nSteps to create the HTML page:\n1. Create the title, stylesheet, and body for the HTML page.\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<title>List Employee by Id<\/title>\n<!-- Specify the stylesheet here -->\n<link rel=\"stylesheet\" type=\"text\/css\" href=\"css\/app.css\" >\n<!-- Bootstrap JS for the UI -->\n<link rel=\"stylesheet\" \nhref=\"http:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.6\/css\/\nbootstrap.min.css\">\n<\/head>\n2. Start the <body> tag and a <input> tag for capturing the employee id.\n<body>\n<div><label>Employee Id: <\/label>\n<input id=\"empId\" type=\"textfield\"\nChapter 6\nCreate a New HTML for Search by Employee Id\n6-3", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"simple", - "seed_document_id":"43", - "topic":"Java Employee Management" - } - }, - { - "id":"2618274b-ab53-4011-9052-2d9b8a07a583", - "question":"What can you do through the increment salary tab in the HR application?", - "reference_answer":"You can alter (increase or decrease) the percentage of salary for hike.", - "reference_context":"Document 15: \u2022 Increment Salary\nThrough the increment salary tab, you can alter (increase or decrease) the\npercentage of salary for hike.\n\u2022 About\nThis page provides an overview of the HR Application and explains the various\nfunctionalities it offers.\nChapter 3\nFunctionalities of the HR Web Application\n3-2", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"simple", - "seed_document_id":"15", - "topic":"Java Employee Management" - } - }, - { - "id":"ccce862e-223c-43ea-8f90-ccb510be884b", - "question":"What is the purpose of the variable ID_KEY in the WebController class?", - "reference_answer":"The variable ID_KEY is declared to capture the employee id and is a global variable, hence, it is declared outside the method processRequest() but within the WebController class.", - "reference_context":"Document 36: 2. Declare a variable ID_KEY to capture the employee id. This is a global variable, hence,\ndeclare it outside the method processRequest() but within the WebController class.\nprivate static final String ID_KEY = \"id\";\n3. The method processRequest() is already created in the ListAll feature. Now, we add the\ncode to implement Search by employee id functionality. Declare a variable value of the\nString type to capture the input from the user.\nString value = null;\n4. Add an IF condition to handle the new functionality. Get the employee id entered by the\nuser and invoke the method getEmployee(int) to verify if the employee record exists.\nif ((value = request.getParameter(ID_KEY)) != null) {\n int empId = Integer.valueOf(value).intValue();\n employeeList = employeeBean.getEmployee(empId);\n } else { \n \/\/ Previously used getEmployees() method for Listall feature\n employeeList = employeeBean.getEmployees();\n }\nCreate a New HTML for Search by Employee Id\nA HTML page that shows an input placeholder for the user to enter the employee id. If the\nemployee record is found, then the details of the employee is displayed on the page,\notherwise, an error message will be displayed.\nClass Name:src\/main\/webapp\/listById.html\nGithub Location: listById.html\nSteps to create the HTML page:\n1. Create the title, stylesheet, and body for the HTML page.\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<title>List Employee by Id<\/title>\n<!-- Specify the stylesheet here -->\n<link rel=\"stylesheet\" type=\"text\/css\" href=\"css\/app.css\" >\n<!-- Bootstrap JS for the UI -->\n<link rel=\"stylesheet\" \nhref=\"http:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.6\/css\/\nbootstrap.min.css\">\n<\/head>\n2. Start the <body> tag and a <input> tag for capturing the employee id.\n<body>\n<div><label>Employee Id: <\/label>\n<input id=\"empId\" type=\"textfield\"\nChapter 6\nCreate a New HTML for Search by Employee Id\n6-3\n\nDocument 43: 2. Declare a variable FN_KEY to capture first name of the employee. This is a global variable,\nhence, declare it outside the method processRequest() but within the WebController\nclass.\nprivate static final String FN_KEY = \"firstName\";\n3. The method processRequest() is already created in the ListAll feature. Now, we add the\ncode to implement Update an Employee functionality. Add an ELSEIF condition to\nhandle the new functionality. Get the employee id entered by the user and invoke the\nmethod getEmployee(int) to verify if the employee record exists.\nif ((value = request.getParameter(ID_KEY)) != null) {\n int empId = Integer.valueOf(value).intValue();\n employeeList = employeeBean.getEmployee(empId);\n } \n\/* New code added below *\/\nelse if ((value = request.getParameter(FN_KEY)) != null) {\n employeeList = jdbcBean.getEmployeeByFn(value);\n}\nelse { \n \/* Previously used getEmployees() method for Listall feature *\/\n employeeList = employeeBean.getEmployees();\n }\nCreate a New HTML for Search by Employee Id\nA HTML page that shows an input placeholder for the user to enter the employee first name.\nIf the employee record is found, then the details of the employee is displayed on the page,\notherwise, an error message will be displayed.\nClass Name:src\/main\/webapp\/listById.html\nGithub Location: listByName.html\nSteps to create the HTML page:\n1. Create the title, stylesheet, and body for the HTML page.\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<title>List Employee by Id<\/title>\n<!-- Specify the stylesheet here -->\n<link rel=\"stylesheet\" type=\"text\/css\" href=\"css\/app.css\" >\n<!-- Bootstrap JS for the UI -->\n<link rel=\"stylesheet\" \nhref=\"http:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.6\/css\/\nbootstrap.min.css\">\n<script src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.12.2\/\njquery.min.js\"><\/script>\n<\/head>\nChapter 7\nCreate a New HTML for Search by Employee Id\n7-5", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"simple", - "seed_document_id":"36", - "topic":"Java Employee Management" - } - }, - { - "id":"866b8f03-5582-4d03-8549-6fd40f696107", - "question":"Could you explain the specific functionality and intended outcome of the getEmployees() method within the JavaBeanImpl class, particularly in relation to its interaction with the EMPLOYEES table and error handling mechanisms?", - "reference_answer":"The getEmployees() method is used to retrieve a list of employees from the EMPLOYEES table.", - "reference_context":"Document 28: 2. Create a method getEmployees() to retrieve a list of employees from the EMPLOYEES\ntable. Update the SELECT query to be used by choosing the columns that you want from\nthe EMPLOYEES table.\na. Inside the JavaBeanImpl class, declare the method getEmployees().\nb. Use try and catch blocks to establish a database connection and fetch the\nemployee details using a SQL SELECT statement.\nc. Store the employee details in an array returnValue.\nd. Catch the SQLException and log the message in logger.\npublic List<Employee> getEmployees() {\n List<Employee> returnValue = new ArrayList<>();\n try (Connection connection = getConnection()) {\n try (Statement statement = connection.createStatement()) {\n try (ResultSet resultSet = statement.executeQuery(\"\n SELECT Employee_Id, First_Name, Last_Name, Email, \nPhone_Number, Job_Id, Salary \n FROM EMPLOYEES\")) {\n while(resultSet.next()) {\n returnValue.add(new Employee(resultSet));\n }\n }\n }\n } catch (SQLException ex) {\nlogger.log(Level.SEVERE, null, ex);\n ex.printStackTrace();\n }\nreturn returnValue;\n}\nNote:\nThis topic describes how to add the implementation method of List All functionality.\nSimilarly, you learn to add getEmployee, updateEmployee, getEmployeeByFn and\nincrementSalary implementation methods for other functionalities of the HR Web\nApplication in the upcoming chapters.\nCreating a Servlet to Process the Request\nIn this section, you learn to create a Servlet to process a request.\nClass Name: src\/main\/java\/com\/oracle\/jdbc\/samples\/web\/WebController.java\nGithub Location: WebController.java\nDescription: This is the main servlet that controls all the flows of the application. For every\nnew functionality of the application, we will be adding the code to handle the new requests\nand responses in doPost() and processResponse() respectively.\nChapter 5\nCreating a Servlet to Process the Request\n5-5", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"complex", - "seed_document_id":"28", - "topic":"Java Employee Management" - } - }, - { - "id":"0a15bfa3-9bd9-40db-a6fc-a5412c878436", - "question":"Could you elaborate on the specific functionality and intended outcome of the incrementSalary(int) method, particularly in the context of how it interacts with employee salary adjustments based on a given percentage input?", - "reference_answer":"The incrementSalary(int) method updates the salary value of all employees by incrementing the value according to a given percentage.", - "reference_context":"Document 47: 8\nIncrement Salary\nThe Increment Salary functionality modifies the salaries of all employees by incrementing the\nvalues according to the input percentage.\nEnter a percentage for salary hike in the placeholder on the web page. Click confirm to\nmodify the salaries of all employees in the database table. You can verify the changes by\nclicking on the List All tab.\nIn this chapter, you learn how to add code required to build the Increment Salary\nfunctionality. You will learn how to:\n1. Declare a new method incrementSalary(int) in JavaBean.java.\n2. Implement a new method incrementSalary(int) in JavaBeanImpl.java.\n3. Add new code to WebController.java to process the request and response.\n4. Create a HTML page incrementSalary.html to display the results.\nDeclare a new method incrementSalary(int)\nThe incrementSalary(int) method updates the salary value of all employees by\nincrementing the value according to a given percentage.\nClass Name: src\/main\/java\/com\/oracle\/jdbc\/samples\/bean\/JavaBean.java.\nGithub Location: JavaBean.java\nSteps to declare a new method:\n1. Open the JdbcBean.java file in IntelliJ. To create the JdbcBean.java class, refer to \nCreating a Java Bean Interface for a JDBC Connection. Use the same class and declare\nnew methods for each one of the functionalities.\n2. Declare a method incrementSalary(int) that takes an integer for percentage as an\ninput parameter.\npublic List<Employee> incrementSalary(int incrementPct);\n8-1\n\nDocument 48: Implement a new method incrementSalary(int)\nThe incrementSalary(int) method enables you to increment the salary of all\nemployees according to a given percentage.\nClass Name: src\/main\/java\/com\/oracle\/jdbc\/samples\/bean\/JavaBeanImpl.java\nGithub Location: JavaBeanImpl.java\nSteps to Implement a new method:\n1. Open the JdbcBeanImpl.java file in IntelliJ. To create the JdbcBeanImpl.java\nclass, refer to Creating a Java Bean Implementation for a JDBC Connection. Use\nthe same class and add new implementation methods for each one of the\nfunctionalities.\n2. Add the following code snippet to implement the incrementSalary(int) method:\npublic List<Employee> incrementSalary (int incrementPct) {\n List<Employee> returnValue = new ArrayList<>();\n \n\/* Get the database connection*\/\n try (Connection connection = getConnection()) {\n try (CallableStatement callableStatement = \n connection.prepareCall(\"begin ? := \nrefcur_pkg.incrementsalary(?); end;\")) {\n callableStatement.registerOutParameter(1, \nOracleTypes.CURSOR);\n callableStatement.setInt(2, incrementPct);\n callableStatement.execute();\n try (ResultSet resultSet = (ResultSet) \ncallableStatement.getObject(1)) {\n while (resultSet.next()) {\n returnValue.add(new Employee(resultSet));\n }\n }\n }\n } catch (SQLException ex) {\n\/* Catch the SQLException and log the message in the logger*\/\n logger.log(Level.SEVERE, null, ex);\n ex.printStackTrace();\n }\nreturn returnValue;\n}\nAdd the Code to a Servlet\nAdd the relevant code to WebController.java to give a salary raise to all employees.\nClass Name: src\/main\/java\/com\/oracle\/jdbc\/samples\/web\/WebController.java\nChapter 8\nImplement a new method incrementSalary(int)\n8-2", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"complex", - "seed_document_id":"47", - "topic":"Java Employee Management" - } - }, - { - "id":"036c54cd-0da0-4633-a3a7-e4c6ee80047d", - "question":"What are the detailed steps you need to follow in order to successfully initiate the HR Web application after you have deployed the .war file on the Tomcat server, including any necessary configurations or file placements?", - "reference_answer":"Start the tomcat server and then access the HR web application from a browser using the URL http:\/\/localhost:8080\/JdbcWebSamples\/.", - "reference_context":"Document 22: 8. Once the source code is packaged successfully, a war file is generated. Locate the\nJdbcWebSamples.war under the target folder.\nRun the HR Web Application\nThe HR Web application is run using the Tomcat server.\nDeploy the .war file on the Apache server\n1. Navigate to the HRWebApp folder on your local machine. Under the target folder, locate\nJdbcWebSamples.war file.\n2. Place JdbcWebSamples.war file under TOMCAT_HOME\/webapps\/.\n3. Navigate to the HRWebApp folder on your local machine. Locate tomcat-users.xml file.\n4. Place tomcat-users.xml file under TOMCAT_HOME\/conf\/.\n5. Start the tomcat server.\n6. Once the tomcat is started, access the HR web application from a browser using the URL\nhttp:\/\/localhost:8080\/JdbcWebSamples\/.\nVerify the HR Web Application\n1. Login to the application with either hradmin or hrstaff user.\nChapter 4\nRun the HR Web Application\n4-7", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"complex", - "seed_document_id":"22", - "topic":"Others" - } - }, - { - "id":"37c21809-488e-4b64-8c35-88950def34ba", - "question":"Could you elaborate on the specific types of information that the about.html file presents regarding the HR Application, including its users and functionalities, as well as any relevant steps for accessing this file?", - "reference_answer":"The about.html file displays information about the HR Application, users, and functionalities.", - "reference_context":"Document 56: <\/security-constraint>\n<login-config>\n<auth-method>FORM<\/auth-method>\n<form-login-config>\n<form-login-page>\/login.html<\/form-login-page>\n<form-error-page>\/login-failed.html<\/form-error-page>\n<\/form-login-config>\n<\/login-config>\n<\/web-app>\nCreate about.html\nThe about.html file displays information about the HR Application, users and functionalities.\nClass Name: src\/main\/webapp\/about.html\nGithub Location: about.html\nSteps to use the HTML page: Download the about.html and use it in your application.\nCreate index.html\nThe index.html file consists of all details about the HR Web Application. It describes in detail\nits users and functionalities.\nClass Name: src\/main\/webapp\/index.html\nGithub Location: index.html\nSteps to create the HTML page:\n1. Create the title, head, and stylesheet for index.html.\n<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<title>Employee table listing<\/title>\n<link rel=\"stylesheet\" type=\"text\/css\" href=\"css\/app.css\" >\n<style>\niframe:focus {\noutline: none;\n}\niframe[seamless] {\ndisplay: block;\n}\n<\/style>\n<\/head>\n<body>\n2. Create <body> and actions for the features through navigation links and logout.\n<body>\n<div id=\"sideNav\" class=\"sidenav\">\nChapter 9\nCreate about.html\n9-5", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"complex", - "seed_document_id":"56", - "topic":"Login and Logout Functionality" - } - }, - { - "id":"bd02d150-d035-42c3-8f42-3b1066752aca", - "question":"What specific details about employees can be retrieved and displayed when utilizing the List All functionality in the HR Web Application, and how does this information correlate with the data stored in the Employees table?", - "reference_answer":"The List All functionality displays employees' details such as Employee_id, First_name, Last_Name, Email, Phone_number, Job_id, Salary, etc.", - "reference_context":"Document 23: Note:\n\u2022 For more information about the hradmin and hrstaff users, see \nOverview of the HR Web Application and Create Login and Logout\nFunctionality.\n\u2022 Refer tomcat-users.xml file for the username and password\ninformation required to login to the HR Web Application.\n2. HR Web Application has several functionalities. List All displays the employees'\ndetails such as Employee_id, First_name, Last_Name, Email, Phone_number,\nJob_id, Salary etc. The details are retrieved from the Employees table and\ndisplayed on a web page. See the screenshot below that shows List All\nfunctionality.\n3. Similarly, verify the remaining functionalities such as Search by ID, Update\nEmployee Record and Increment Salary by giving appropriate inputs.\nChapter 4\nRun the HR Web Application\n4-8", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"complex", - "seed_document_id":"23", - "topic":"Others" - } - }, - { - "id":"3fdbecce-bc15-4c6d-9606-9f9b0b458912", - "question":"After deploying the application, what specific errors or messages should I look for in the Tomcat log file located at TOMCAT_HOME\/logs\/catalina.out to effectively troubleshoot any potential issues?", - "reference_answer":"Check TOMCAT_HOME\/logs\/catalina.out for any errors after deploying the application.", - "reference_context":"Document 61: 11\nTroubleshooting and Debugging\n1. Tomcat log file:\nCheck TOMCAT_HOME\/logs\/catalina.out for any errors after deploying the application.\n2. Additional Logging:\nEnable logging in Tomcat to find logging messages in the code.\nNote:\nRefer https:\/\/tomcat.apache.org\/tomcat-8.0-doc\/logging.html for more information\nDebugging UI Related Issues\n1. Browser Version:\nThis application has been tested on Firefox (version 52) and Chrome (version 58)\nsuccessfully.\n2. Browser Console:\nLook for errors in the browser console to find and debug issues.\n3. Monitor Network Traffic:\nTrack network traffic to find out the requests being made, and the responses to the requests.\nA return status higher than 400 indicates errors. If you find errors in the range of 400 t 500\ninspect the Tomcat log files for debugging.\nInspect the JSON responses from various calls to the backend server.\n4. Additional Logging:\nEdit the packaged HTML files, and add console.log(...) to add extra logging.\n11-1", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"complex", - "seed_document_id":"61", - "topic":"Others" - } - }, - { - "id":"a145968d-43a5-4aa3-b1a9-df6afee1d0d8", - "question":"Could you please identify the title of Table 1-1 as referenced in Document 5, specifically in relation to the overall architecture of the web application?", - "reference_answer":"Architecture of the Web Application", - "reference_context":"Document 5: List of Tables\n1-1 Architecture of the Web Application 1-2\n1-2 Components Required for the Application 1-2\n4-1 Github Repository Details 4-3\nvi", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"complex", - "seed_document_id":"5", - "topic":"Others" - } - }, - { - "id":"83be1d4f-8884-4d4b-a496-fd26dcdc6a0a", - "question":"What specific error message is presented to users on the login-failed.html page in the event that their login attempt is unsuccessful, and how does this message inform them of the issue?", - "reference_answer":"Sorry, login failed!", - "reference_context":"Document 54: td {\n height: 30px;\n }\n<\/style>\n<\/head>\n2. Create the <body> and <form> to submit the login credentials entered by the user.\n<body>\n<div id=\"cent\">\n<form method=\"POST\" action=\"j_security_check\">\n<table>\n<tr>\n<td colspan=\"2\">Login to the Jdbc Web Sample application:<\/td>\n<\/tr>\n<td>Name:<\/td>\n<td><input type=\"text\" name=\"j_username\" \/><\/td>\n<\/tr>\n<tr>\n<td>Password:<\/td>\n<td><input type=\"password\" name=\"j_password\"\/><\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\"><input type=\"submit\" value=\"Go\" \/><\/td>\n<\/tr>\n<\/table>\n<\/form>\n<\/div>\n<\/body>\nCreate login-failed.html\nA html page to display the error messgae if the login is unsuccessful.\nClass Name: src\/main\/webapp\/login-failed.html\nGithub Location: login-failed.html\nSteps to create the HTML page:\n1. Create the login-failed.html as shown below.\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<title>Login Failed<\/title>\n<\/head>\n<body>\n<p>\nSorry, login failed!\n<\/p>\nChapter 9\nCreate login-failed.html\n9-3", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"complex", - "seed_document_id":"54", - "topic":"Login and Logout Functionality" - } - }, - { - "id":"fd7d5bed-f867-4943-a6f0-87a741f53beb", - "question":"Considering the context of developing an HR web application, what is one of the most effective practices for establishing a database, particularly in terms of utilizing cloud services and built-in schemas?", - "reference_answer":"Use the Oracle Database Service on Cloud (DBCS) to create a database on cloud.", - "reference_context":"Document 60: 10\nBest Practices\n1. Use Database Service on Cloud:\nUse the Oracle Database Service on Cloud (DBCS) to create a database on cloud. DBCS\ncomes with an in-built HR schema and tables that you can use when you build the HR web\napplication.\n2. JDBC Driver, UCP:\nUse the latest 23ai versions of JDBC drivers and UCP.\nNote:\nDownload the latest JDBC drivers and UCP from the JDBC and UCP Downloads\npage\n3. JDK Version\nUse a JDK version that is compatible with Oracle Database Release 23ai. Refer to Version\nCompatibility for Oracle JDBC Drivers for more details.\n4. Auto-Closeable Statements\nStarting JDK7, \u2018Auto-closeable statements\u2019 has been introduced, that close by default without\nan explicit catch statement.\n5. Use PreparedStatement instead of Statement objects:\nStatement in JDBC must be localized to being used for DDL (ALTER, CREATE, GRANT etc)\nsince these commands cannot accept bind variables.\nUse PreparedStatement or CallableStatement for any other type of statement. These\nstatements can accept bind variables.\n10-1", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"complex", - "seed_document_id":"60", - "topic":"Java Web Application Development" - } - }, - { - "id":"8b0b433c-12df-41f7-b582-ead979a4b4ec", - "question":"Could you identify the title of the document referenced in the provided context, specifically focusing on its relevance to Oracle Database and Java Development?", - "reference_answer":"Get Started with Java Development", - "reference_context":"Document 0: Oracle\u00ae Database\nGet Started with Java Development\n23ai\nF47017-03\nMay 2024", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"complex", - "seed_document_id":"0", - "topic":"Java Web Application Development" - } - }, - { - "id":"41889a0d-2f18-4da8-b377-b7947b12e86d", - "question":"Could you elaborate on the specific role and functionality of the getConnection() method within the JavaBeanImpl class, particularly in terms of how it facilitates database connectivity and handles exceptions?", - "reference_answer":"The getConnection() method registers the driver and establishes the database connection by passing the connection string, the database username, and the database password.", - "reference_context":"Document 27: a. Declare the package for the JavaBean.java class. Import the Employee class\nas it contains the employee details.\npackage com.oracle.jdbc.samples.bean;\nimport com.oracle.jdbc.samples.entity.Employee;\nb. Import the other dependent classes as shown in the following code snippet. If\na particular class is not imported, then IntelliJ displays a message reminding\nyou to import the required package.\nimport java.sql.*;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\nimport java.sql.PreparedStatement;\nimport oracle.jdbc.OracleStatement;\nimport oracle.jdbc.OracleConnection;\nimport oracle.jdbc.driver.OracleDriver;\nimport oracle.jdbc.OracleTypes;\nimport java.sql.PreparedStatement;\nimport oracle.jdbc.OracleStatement;\nimport oracle.jdbc.OracleConnection;\nimport oracle.ucp.jdbc.PoolDataSourceFactory;\nimport oracle.ucp.jdbc.PoolDataSource;\nc. Declare the JavaBeanImpl class that implements JavaBean.\npublic class JavaBeanImpln implements JavaBean { }\nd. Inside the JavaBeanImpl class, create a logger to log exceptions.\nstatic final Logger logger = \nLogger.getLogger(\"com.oracle.jdbc.samples.bean.JdbcBeanImpl\");\ne. Inside the JavaBeanImpl class, declare a static method getConnection(). The\ngetConection() method registers the driver and establishes the database\nconnection by passing the connection string, the database username and the\ndatabase password as shown in the following code snippet.\npublic static Connection getConnection() throws SQLException {\n DriverManager.registerDriver(new oracle.jdbc.OracleDriver());\n Connection connection = \nDriverManager.getConnection(\"jdbc:oracle:thin:@\/\/myorclhost:5521\/\nmyorcldbservice\", \"hr\", \"hr\");\n return connection;\n}\nChapter 5\nCreating a Java Bean Implementation for a JDBC Connection\n5-4", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"complex", - "seed_document_id":"27", - "topic":"Others" - } - }, - { - "id":"789217ff-ba0a-4d97-9358-77af90f16db9", - "question":"Could you elaborate on the specific role and functionality of the constructor within the Employee class, particularly in relation to how it initializes the employee's attributes using a ResultSet and handles potential SQLExceptions?", - "reference_answer":"The constructor for the Employee class takes ResultSet as the input and throws a SQLException. In this constructor, it sets all the values for the attributes of the Employee class.", - "reference_context":"Document 25: Creating a Java Bean Entity for an Employee\nThe Employee class contains the getter and setter methods for all attributes of an\nemployee. For example, the First_name has a getter and a setter method like\ngetFirst_Name and setFirst_Name respectively.\nClass Name: src\/main\/java\/com\/oracle\/jdbc\/samples\/entity\/Employee.java\nGithub Location: Employee.java\nSteps to create Employee.java:\n1. Declare the package for the class Employee.java.\npackage com.oracle.jdbc.samples.entity;\n2. Import the following packages required for the Employee class.\nimport java.sql.ResultSet;\nimport java.sql.SQLException;\nimport java.sql.Timestamp;\n3. Declare an Employee class. Add a pair of parenthesis ({ }). Place the cursor in\nbetween the parenthesis:\npublic class Employee {}\n4. Declare the following variables for each one of the attributes of an employee.\nprivate int Employee_Id;\nprivate String First_Name;\nprivate String Last_Name;\nprivate String Email;\nprivate String Phone_Number;\nprivate String Job_Id;\nprivate int Salary;\n5. Create a constructor for the Employee class which takes ResultSet as the input\nand throws a SQLException. In this constructor, set all the values for the attributes\nof the Employee class.\npublic Employee(ResultSet resultSet) throws SQLException {\n this.Employee_Id = resultSet.getInt(1);\n this.First_Name = resultSet.getString(2);\n this.Last_Name = resultSet.getString(3);\n this.Email = resultSet.getString(4);\n this.Phone_Number = resultSet.getString(5);\n this.Job_Id = resultSet.getString(6);\n this.Salary = resultSet.getInt(7);\n}\n6. Create the Getter and Setter methods, that is, getX and setX methods to get and\nset the values for all attributes of the Employee such as Employee_id, first_name,\nChapter 5\nCreating a Java Bean Entity for an Employee\n5-2", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"complex", - "seed_document_id":"25", - "topic":"Java Employee Management" - } - }, - { - "id":"a050d8f5-cd1f-4ae4-9ece-01843fa126aa", - "question":"What specific actions are available to you when utilizing the increment salary tab in the HR Application, particularly regarding the modification of salary percentages for hikes, and how does this feature integrate with the overall functionalities of the application?", - "reference_answer":"You can alter (increase or decrease) the percentage of salary for hike.", - "reference_context":"Document 15: \u2022 Increment Salary\nThrough the increment salary tab, you can alter (increase or decrease) the\npercentage of salary for hike.\n\u2022 About\nThis page provides an overview of the HR Application and explains the various\nfunctionalities it offers.\nChapter 3\nFunctionalities of the HR Web Application\n3-2", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"complex", - "seed_document_id":"15", - "topic":"Java Employee Management" - } - }, - { - "id":"a12745b4-e743-47c5-8fd8-20849958de0d", - "question":"Could you elaborate on the primary objectives and key tasks addressed in the chapter titled 'Getting Started with the Application', particularly focusing on the necessary prerequisites and setup processes required for effectively building the application?", - "reference_answer":"The chapter helps you understand the prerequisites for building the application and how to get the environment ready, including signing up for the Oracle Cloud Free Tier or installing the Oracle Database on premise, installing IntelliJ, and downloading tools like Maven.", - "reference_context":"Document 10: 2. Overview of the HR Web Application: This chapter discusses the HR Web\napplication in depth and familiarize you with the flows of the Web application,\npackages and files that you create as a part of the web application.\n3. Getting Started with the Application: In this chapter, you understand the\nprerequisites for building the application and how to get the environment ready. It\nstarts with signing up for the Oracle Cloud Free Tier or installing the Oracle\nDatabase on premise. Later, you install IntelliJ, an IDE to build the application. You\nuse Tomcat Java EE container to deploy and run the application.\nThe chapter also helps you download any other tools, such as Maven, that helps\nyou to build the application.\n4. List All Employees: This chapter helps you to put all the components together\nand build an initial functionality to connect to the Oracle Database, and retrieve\nemployee details from the database.\n5. Search By Employee ID: This chapter provides details on how to implement the\n\u2018Search by Employee ID\u2019 functionality.\n6. Update an Employee Record: In this chapter, you learn how to update employee\nrecords. This is a two step process. Firstly, you search the employee\u2019s records,\nbased on first name. Once you retrieve the required results, you can update the\nsalary, job ID, firstname, lastname and other details.\n7. Delete an Employee Record: In this chapter, you learn how to delete an\nemployee record, in a two-step process.\n8. Increase Salary to All Employees: In this chapter, you understand how to\nprovide an increment to the salary of the employees listed in the table, using \u2018Java\nin the database\u2019.\n9. Creating Application Users: This chapter shows how to create \u2018hradmin\u2019 and\n\u2018hrstaff\u2019 users in Tomcat and IntelliJ.\n10. Summary: This chapter summarizes all that you have learnt so far. It also\nprovides appropriate references and links for enhancing your use of the web\napplication.\nChapter 1\nObjectives and Tasks\n1-4", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"complex", - "seed_document_id":"10", - "topic":"Java Web Application Development" - } - }, - { - "id":"f5c4a4c3-2dd6-4c64-b165-5017fd8c077d", - "question":"What is required to create and compile Java applications according to the provided context?", - "reference_answer":"You need the full Java 2 Platform, Standard Edition, Software Development Kit (J2SE SDK), formerly known as the Java Development Kit (JDK).", - "reference_context":"Document 17: See Also:\nProvisioning an ATP Database instance video for instructions\nOption 2: Oracle Database Free Available on OTN\nAs an alternate option, you can install Oracle Database Free on your system.\nSee Also:\nOracle Database Free Installation Guide\nInstall the HR schema\nThe HR web application uses the tables and data from the HR sample schema\nprovided by Oracle. You need to install the HR schema in your database.\nOnce you provision an Autonomous Database or install Oracle Database Free, see \nInstalling HR Schema for detailed instructions to install the sample schema.\nJ2SE or JDK\nTo create and compile Java applications, you need the full Java 2 Platform, Standard\nEdition, Software Development Kit (J2SE SDK), formerly known as the Java\nDevelopment Kit (JDK).\n1. Download and install the Java SE. Refer http:\/\/www.oracle.com\/technetwork\/java\/\njavase\/downloads\/index.html.\n2. Set the PATH environment variable for JDK. Refer JDK Installation Instructions for\nWindows for detailed instructions.\nJDBC Drivers\nYou need to download certain JDBC drivers for running the HR application.\nThis guide uses Maven Central to download the necessary JDBC drivers required for\nthe application. Later in this guide, you learn to add the following dependency to your\nproject's pom.xml file:\n<dependencies>\n <dependency>\n <groupId>com.oracle.database.jdbc<groupId>\n <artifactId>ojdbc8-production<\/artifactId>\n <version>19.7.0.0<\/version>\n <type>pom<\/type>\n <\/dependency>\n<\/dependencies>\nChapter 4\nWhat You Need to Install\n4-2", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"simple", - "seed_document_id":"17", - "topic":"Java Web Application Development" - } - }, - { - "id":"b36c40d9-34b2-4827-b686-dc7e36554149", - "question":"What is the purpose of the function processResponse() in the provided code?", - "reference_answer":"The function processResponse() is designed to display the JSON results on an HTML page by parsing the response, creating a table, and populating it with the data.", - "reference_context":"Document 51: }\n else {\n console.log(\"Salary not updated\");\n showStatus(\"alert alert-warning\", \"Updating records, attempt \ncancelled\");\n }\n}\n<\/script>\n3. Create the function processRequest() to display the JSON results on HTML page.\nunction processResponse(response) {\n var arr = JSON.parse(response);\n var i;\n var out = \"<table>\";\nkeys = Object.keys(arr[0]);\n \/* Print headers *\/\n out += \"<tr>\"\nfor(i = 0; i < keys.length; ++i) {\n out += \"<th>\"+keys[i]+\"<\/th>\"\n}\nout += \"<\/tr>\";\n\/* Print values *\/\nfor(j = 0; j < arr.length; j++) {\nout += \"<tr>\"\nfor(i = 0; i < keys.length; ++i) {\nout += \"<td>\"+arr[j][keys[i]]+\"<\/td>\"\n}\nout += \"<\/tr>\"\n}\nout += \"<\/table>\";\ndocument.getElementById(\"id-emp\").innerHTML = out;\n}\nChapter 8\nCreate a new HTML for Increment Salary\n8-5", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"simple", - "seed_document_id":"51", - "topic":"Java Employee Management" - } - }, - { - "id":"cd931a92-d06a-4fe0-8975-c71019fcedf6", - "question":"What should be used instead of Statement objects for executing queries that can accept bind variables?", - "reference_answer":"Use PreparedStatement or CallableStatement for any type of statement that can accept bind variables.", - "reference_context":"Document 60: 10\nBest Practices\n1. Use Database Service on Cloud:\nUse the Oracle Database Service on Cloud (DBCS) to create a database on cloud. DBCS\ncomes with an in-built HR schema and tables that you can use when you build the HR web\napplication.\n2. JDBC Driver, UCP:\nUse the latest 23ai versions of JDBC drivers and UCP.\nNote:\nDownload the latest JDBC drivers and UCP from the JDBC and UCP Downloads\npage\n3. JDK Version\nUse a JDK version that is compatible with Oracle Database Release 23ai. Refer to Version\nCompatibility for Oracle JDBC Drivers for more details.\n4. Auto-Closeable Statements\nStarting JDK7, \u2018Auto-closeable statements\u2019 has been introduced, that close by default without\nan explicit catch statement.\n5. Use PreparedStatement instead of Statement objects:\nStatement in JDBC must be localized to being used for DDL (ALTER, CREATE, GRANT etc)\nsince these commands cannot accept bind variables.\nUse PreparedStatement or CallableStatement for any other type of statement. These\nstatements can accept bind variables.\n10-1", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"simple", - "seed_document_id":"60", - "topic":"Java Web Application Development" - } - }, - { - "id":"4a6a7958-ff36-47c5-a87d-050d5e64a18d", - "question":"What should be logged if the record could not be updated?", - "reference_answer":"If the record could not be updated, the message 'Unable to update record' should be logged.", - "reference_context":"Document 42: employee id *\/\n \"UPDATE employees SET FIRST_NAME = ?, LAST_NAME = ?, EMAIL \n= ?, PHONE_NUMBER = ?,\n SALARY = ? WHERE EMPLOYEE_ID = ?\")) {\n \/*Set the new values entered by the user for each attribute \n and execute the prepapredStatement *\/\n preparedStatement.setString(1, \nemployee.getFirst_Name());\n preparedStatement.setString(2, \nemployee.getLast_Name());\n preparedStatement.setString(3, employee.getEmail());\n preparedStatement.setString(4, \nemployee.getPhone_Number());\n preparedStatement.setInt(5, employee.getSalary());\n preparedStatement.setInt(6, \nemployee.getEmployee_Id());\n updateCount = preparedStatement.executeUpdate();\n }\n }catch (SQLException ex) { \/* Catch the SQLException and log \nthe message in the logger*\/\n logger.log(Level.SEVERE, \"Unable to update record\", ex);\n throw new SQLException(\"Alert! Record could not be updated, \n\"+ex.getMessage(), ex);\n }\n\/* Log the message with the number of records updated to the logger \n*\/\n logger.fine(\"Update count: \" +updateCount);\n\/* If none of the records were updated, enter an alert message *\/\n if (updateCount != 1) { \n logger.severe(\"Unable to update record\");\n throw new SQLException(\"Alert! Record could not be updated\");\n }\n\/* Return the success message if the record was updated *\/\n return \"Success: Record updated\"; \n}\n \nAdd the code to a Servlet to process the request\nAdd the relevant code to WebController.java to update an employee.\nClass Name: src\/main\/java\/com\/oracle\/jdbc\/samples\/web\/WebController.java\nGithub Location: WebController.java\nSteps to add the code:\n1. Open the WebController.java class. To create the WebController.java, refer to \nCreating a Servlet to Process the Request. Use the same class and add the\nrequired code.\nChapter 7\nAdd the code to a Servlet to process the request\n7-4", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"simple", - "seed_document_id":"42", - "topic":"Java Employee Management" - } - }, - { - "id":"c4ef5c88-6eec-498c-8110-1b39ba67d7e7", - "question":"What file must be double-clicked in the Project window to compile the HRWebApp in IntelliJ?", - "reference_answer":"The pom.xml file must be double-clicked in the Project window.", - "reference_context":"Document 19: 2. Navigate to the location where the HRWebApp is downloaded. Select HRWebApp\nand click OK.\n3. A project with all the files required to build the HR Web application is displayed.\nCompile the Application in IntelliJ\nThe code requires a few updates before you compile the application.\nThe HRWebApp must be downloaded and opened in IntelliJ.\n1. In the Project window on the left, double-click on pom.xml file.\nChapter 4\nCompile the Application in IntelliJ\n4-4", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"simple", - "seed_document_id":"19", - "topic":"Others" - } - }, - { - "id":"ec27414a-8ff0-4ade-97c8-015cb860f989", - "question":"What message is displayed on the login-failed.html page when the login is unsuccessful?", - "reference_answer":"Sorry, login failed!", - "reference_context":"Document 54: td {\n height: 30px;\n }\n<\/style>\n<\/head>\n2. Create the <body> and <form> to submit the login credentials entered by the user.\n<body>\n<div id=\"cent\">\n<form method=\"POST\" action=\"j_security_check\">\n<table>\n<tr>\n<td colspan=\"2\">Login to the Jdbc Web Sample application:<\/td>\n<\/tr>\n<td>Name:<\/td>\n<td><input type=\"text\" name=\"j_username\" \/><\/td>\n<\/tr>\n<tr>\n<td>Password:<\/td>\n<td><input type=\"password\" name=\"j_password\"\/><\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\"><input type=\"submit\" value=\"Go\" \/><\/td>\n<\/tr>\n<\/table>\n<\/form>\n<\/div>\n<\/body>\nCreate login-failed.html\nA html page to display the error messgae if the login is unsuccessful.\nClass Name: src\/main\/webapp\/login-failed.html\nGithub Location: login-failed.html\nSteps to create the HTML page:\n1. Create the login-failed.html as shown below.\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<title>Login Failed<\/title>\n<\/head>\n<body>\n<p>\nSorry, login failed!\n<\/p>\nChapter 9\nCreate login-failed.html\n9-3", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"simple", - "seed_document_id":"54", - "topic":"Login and Logout Functionality" - } - }, - { - "id":"bea4478c-ff3e-455b-a035-0c661e1db6b2", - "question":"In the event that executing the update statement results in no records being modified, what specific steps should you take to troubleshoot this issue, considering the potential logging and exception handling mechanisms outlined in the provided context?", - "reference_answer":"If none of the records were updated, you should log a severe message stating 'Unable to update record' and throw a SQLException with the message 'Alert! Record could not be updated'.", - "reference_context":"Document 42: employee id *\/\n \"UPDATE employees SET FIRST_NAME = ?, LAST_NAME = ?, EMAIL \n= ?, PHONE_NUMBER = ?,\n SALARY = ? WHERE EMPLOYEE_ID = ?\")) {\n \/*Set the new values entered by the user for each attribute \n and execute the prepapredStatement *\/\n preparedStatement.setString(1, \nemployee.getFirst_Name());\n preparedStatement.setString(2, \nemployee.getLast_Name());\n preparedStatement.setString(3, employee.getEmail());\n preparedStatement.setString(4, \nemployee.getPhone_Number());\n preparedStatement.setInt(5, employee.getSalary());\n preparedStatement.setInt(6, \nemployee.getEmployee_Id());\n updateCount = preparedStatement.executeUpdate();\n }\n }catch (SQLException ex) { \/* Catch the SQLException and log \nthe message in the logger*\/\n logger.log(Level.SEVERE, \"Unable to update record\", ex);\n throw new SQLException(\"Alert! Record could not be updated, \n\"+ex.getMessage(), ex);\n }\n\/* Log the message with the number of records updated to the logger \n*\/\n logger.fine(\"Update count: \" +updateCount);\n\/* If none of the records were updated, enter an alert message *\/\n if (updateCount != 1) { \n logger.severe(\"Unable to update record\");\n throw new SQLException(\"Alert! Record could not be updated\");\n }\n\/* Return the success message if the record was updated *\/\n return \"Success: Record updated\"; \n}\n \nAdd the code to a Servlet to process the request\nAdd the relevant code to WebController.java to update an employee.\nClass Name: src\/main\/java\/com\/oracle\/jdbc\/samples\/web\/WebController.java\nGithub Location: WebController.java\nSteps to add the code:\n1. Open the WebController.java class. To create the WebController.java, refer to \nCreating a Servlet to Process the Request. Use the same class and add the\nrequired code.\nChapter 7\nAdd the code to a Servlet to process the request\n7-4", - "conversation_history":[ - - ], - "metadata":{ - "question_type":"complex", - "seed_document_id":"42", - "topic":"Java Employee Management" - } - } -] \ No newline at end of file diff --git a/docs/hol/images/addllama32.png b/docs/hol/images/addllama32.png deleted file mode 100644 index 89844627..00000000 Binary files a/docs/hol/images/addllama32.png and /dev/null differ diff --git a/docs/hol/images/api-key.png b/docs/hol/images/api-key.png deleted file mode 100644 index d170cb45..00000000 Binary files a/docs/hol/images/api-key.png and /dev/null differ diff --git a/docs/hol/images/chat.png b/docs/hol/images/chat.png deleted file mode 100644 index 47c45ad2..00000000 Binary files a/docs/hol/images/chat.png and /dev/null differ diff --git a/docs/hol/images/chatmodel.png b/docs/hol/images/chatmodel.png deleted file mode 100644 index 79be755a..00000000 Binary files a/docs/hol/images/chatmodel.png and /dev/null differ diff --git a/docs/hol/images/database-vector-store-list.png b/docs/hol/images/database-vector-store-list.png deleted file mode 100644 index be651690..00000000 Binary files a/docs/hol/images/database-vector-store-list.png and /dev/null differ diff --git a/docs/hol/images/db.png b/docs/hol/images/db.png deleted file mode 100644 index 13e2043d..00000000 Binary files a/docs/hol/images/db.png and /dev/null differ diff --git a/docs/hol/images/default_test_set.png b/docs/hol/images/default_test_set.png deleted file mode 100644 index 11a047ea..00000000 Binary files a/docs/hol/images/default_test_set.png and /dev/null differ diff --git a/docs/hol/images/diff_llm_springai.png b/docs/hol/images/diff_llm_springai.png deleted file mode 100644 index 7a2aef82..00000000 Binary files a/docs/hol/images/diff_llm_springai.png and /dev/null differ diff --git a/docs/hol/images/download_csv.png b/docs/hol/images/download_csv.png deleted file mode 100644 index 22f87dbb..00000000 Binary files a/docs/hol/images/download_csv.png and /dev/null differ diff --git a/docs/hol/images/emb.png b/docs/hol/images/emb.png deleted file mode 100644 index 99811cf7..00000000 Binary files a/docs/hol/images/emb.png and /dev/null differ diff --git a/docs/hol/images/generate.png b/docs/hol/images/generate.png deleted file mode 100644 index f8337a00..00000000 Binary files a/docs/hol/images/generate.png and /dev/null differ diff --git a/docs/hol/images/generatenew.png b/docs/hol/images/generatenew.png deleted file mode 100644 index 9c1fdc47..00000000 Binary files a/docs/hol/images/generatenew.png and /dev/null differ diff --git a/docs/hol/images/llama3.1-endpoint.png b/docs/hol/images/llama3.1-endpoint.png deleted file mode 100644 index d43b5ab2..00000000 Binary files a/docs/hol/images/llama3.1-endpoint.png and /dev/null differ diff --git a/docs/hol/images/llms.png b/docs/hol/images/llms.png deleted file mode 100644 index 6ba8a763..00000000 Binary files a/docs/hol/images/llms.png and /dev/null differ diff --git a/docs/hol/images/load_tests.png b/docs/hol/images/load_tests.png deleted file mode 100644 index 89a38e14..00000000 Binary files a/docs/hol/images/load_tests.png and /dev/null differ diff --git a/docs/hol/images/models.png b/docs/hol/images/models.png deleted file mode 100644 index 8eae9364..00000000 Binary files a/docs/hol/images/models.png and /dev/null differ diff --git a/docs/hol/images/oci-credentials-success.png b/docs/hol/images/oci-credentials-success.png deleted file mode 100644 index b21e8118..00000000 Binary files a/docs/hol/images/oci-credentials-success.png and /dev/null differ diff --git a/docs/hol/images/oci.png b/docs/hol/images/oci.png deleted file mode 100644 index 5c6e3b57..00000000 Binary files a/docs/hol/images/oci.png and /dev/null differ diff --git a/docs/hol/images/patience.png b/docs/hol/images/patience.png deleted file mode 100644 index 0d9cc381..00000000 Binary files a/docs/hol/images/patience.png and /dev/null differ diff --git a/docs/hol/images/populate-vector-store.png b/docs/hol/images/populate-vector-store.png deleted file mode 100644 index eed69dc8..00000000 Binary files a/docs/hol/images/populate-vector-store.png and /dev/null differ diff --git a/docs/hol/images/previous.png b/docs/hol/images/previous.png deleted file mode 100644 index 7afb2529..00000000 Binary files a/docs/hol/images/previous.png and /dev/null differ diff --git a/docs/hol/images/qa_browse.png b/docs/hol/images/qa_browse.png deleted file mode 100644 index 3f27c005..00000000 Binary files a/docs/hol/images/qa_browse.png and /dev/null differ diff --git a/docs/hol/images/qa_json.png b/docs/hol/images/qa_json.png deleted file mode 100644 index 6ff0506e..00000000 Binary files a/docs/hol/images/qa_json.png and /dev/null differ diff --git a/docs/hol/images/query-vector-db.png b/docs/hol/images/query-vector-db.png deleted file mode 100644 index 7710e8a0..00000000 Binary files a/docs/hol/images/query-vector-db.png and /dev/null differ diff --git a/docs/hol/images/result_question.png b/docs/hol/images/result_question.png deleted file mode 100644 index dd70853d..00000000 Binary files a/docs/hol/images/result_question.png and /dev/null differ diff --git a/docs/hol/images/result_topic.png b/docs/hol/images/result_topic.png deleted file mode 100644 index b0490aa4..00000000 Binary files a/docs/hol/images/result_topic.png and /dev/null differ diff --git a/docs/hol/images/settings.png b/docs/hol/images/settings.png deleted file mode 100644 index a6c351cc..00000000 Binary files a/docs/hol/images/settings.png and /dev/null differ diff --git a/docs/hol/images/settings_llama.png b/docs/hol/images/settings_llama.png deleted file mode 100644 index 5f758063..00000000 Binary files a/docs/hol/images/settings_llama.png and /dev/null differ diff --git a/docs/hol/images/split-embed.png b/docs/hol/images/split-embed.png deleted file mode 100644 index 7376ab30..00000000 Binary files a/docs/hol/images/split-embed.png and /dev/null differ diff --git a/docs/hol/images/sql-developer-plugin.png b/docs/hol/images/sql-developer-plugin.png deleted file mode 100644 index 795caa33..00000000 Binary files a/docs/hol/images/sql-developer-plugin.png and /dev/null differ diff --git a/docs/hol/images/start_eval.png b/docs/hol/images/start_eval.png deleted file mode 100644 index 13e7a05a..00000000 Binary files a/docs/hol/images/start_eval.png and /dev/null differ diff --git a/docs/hol/images/tesbed.png b/docs/hol/images/tesbed.png deleted file mode 100644 index 866808cd..00000000 Binary files a/docs/hol/images/tesbed.png and /dev/null differ diff --git a/docs/hol/images/test_rename.png b/docs/hol/images/test_rename.png deleted file mode 100644 index afa52e1b..00000000 Binary files a/docs/hol/images/test_rename.png and /dev/null differ diff --git a/docs/hol/images/text-embedding-3-small.png b/docs/hol/images/text-embedding-3-small.png deleted file mode 100644 index 805b7ffd..00000000 Binary files a/docs/hol/images/text-embedding-3-small.png and /dev/null differ diff --git a/docs/hol/images/vector-store-populated.png b/docs/hol/images/vector-store-populated.png deleted file mode 100644 index 3eac54b7..00000000 Binary files a/docs/hol/images/vector-store-populated.png and /dev/null differ