Java – Run a transactional query in SQL Server on Ubuntu No9

How to execute a transactional query in SQL Server on Ubuntu using Java is shown in this blog. Contents ▼1. How to execute a transactional query in SQL Server on Linux▼2. Implement insert query using transaction in SQL Server on Linux2-1. Creating Java code2-2. 実行結果▼3. Reference▼1. How to execute a transactional query in SQL Server on Linux Commit or Rollback by transaction can keep consistency of data when the query fails in the middle of the process. setAutoCommit method of SQLServerConnection class in JDBC Driver can use commit and rollback to implement a transactional query. ▼2. Implement insert query using transaction in SQL Server on Linux 2-1. Creating Java code … Continue reading “Java – Run a transactional query in SQL Server on Ubuntu No9”

Java – Error handling & Retry in SQL Server on Ubuntu No.6

How to implement the error handling and retry with some interval in SQL Server on Ubuntu by Java is shown in this blog. Contents ▼1. An error handling and a retry logic with interval are mandatory▼2. Creating Java code to implement Error handling & Retry logic2-1. Creating a Java code2-2. Results for this code▼3. Reference▼1. An error handling and a retry logic with interval are mandatory When we connect to cloud services, we often experience the intermittent network issue. in this case, an error handling and a retry logic with some interval are mandatory to keep application working on. ▼2. Creating Java code to implement Error handling & Retry logic … Continue reading “Java – Error handling & Retry in SQL Server on Ubuntu No.6”

Java -AutoRetry connection by JDBC Driver for SQLServer No53

How to implement auto retry with some internal by Java is shown in this blog. the connection string using Microsoft JDBC Driver for SQL Server “Connection String” has a feature of auto retry with some internal. Contents ▼1. Auto retry with some interval feature of Connection String of Microsoft JDBC Driver for SQL Server (Version 9.4 以上)▼2. Writing Java code to implement auto-retry when failing to connect to SQL Server2.2. Showing logs when the connection succeeded.2.3. Showing logs when the connection failed▼3. Reference▼1. Auto retry with some interval feature of Connection String of Microsoft JDBC Driver for SQL Server (Version 9.4 以上) As the mandatory setting for a cloud service, … Continue reading “Java -AutoRetry connection by JDBC Driver for SQLServer No53”

Java – Execute a Select query in SQL Server on Ubuntu No.8

How to run a select query in SQL Server on Ubuntu using Java is shown in this blog. Contents ▼1. Prerequisites▼2. Executing a query in SQL Server on Ubuntu by Java2-1. Creating Java code to execute Select query1-2. Results of this code▼2. Reference▼1. Prerequisites Creating a table “t1” in a database “TestDB” and inserting data intho this table are executed by sqlcmd utility. “sa” user is used in this sample. ▼2. Executing a query in SQL Server on Ubuntu by Java 2-1. Creating Java code to execute Select query 1-2. Results of this code Current Timestamps: 2020-05-26 06:52:10.564 [main] INFO ExecuteQSQLSvr – Connect to SQL Server successfully retrieve c1    c2 … Continue reading “Java – Execute a Select query in SQL Server on Ubuntu No.8”

Java – Put SQL Server select results into a csv file No.70

How to put results of select in SQL Server on Ubuntu into a csv file by Java is shown in this blog. Contents ▼1. Prerequisites1-1. Installing SQL Server1-2. Installing Visual Studio Code1-3. Installing Maven1-4. Generating sample data in SQL Server1-5. Executing a select query in SQL Server using Java▼2. Executing select statement in SQL Server and this results are put into a csv file using Java2-1.Creating a directory2-2. Creating a project using Apache Maven2-3. Deleting the existing App.java and AppTest.java2-4. Starting Visual Studio Code2-5. Updating pom.xml to use libraries of operations in SQL Server (Ctrl+S)2-6. Creating sqlsrvlocaloutput.java2-7. Confirming the csv file after executing this Java code▼3. Reference▼1. Prerequisites There are … Continue reading “Java – Put SQL Server select results into a csv file No.70”

Java – Update Statistics in SQL Server on Ubuntu No.91

How to update statistics for the table in SQL Server on Ubuntu by Java is shown in this blog. Contents ▼1. The latency of a query execution in SQL Server▼2. Prerequisites2-1. Reference Java – Creating sample data for SQL Server on Ubuntu No.89▼3. Updating statistics and re-generate a query execution plan by Java3-1. Creating a project using Apache Maven3-2. Deleting the existing App.java and AppTest.java files3-3. Starting Visual Studio Code3-4. Adding a library in pom.xml for the operation in SQL Server and saving pom.xml (Ctrl+S) 3-5. Creating sqlupdstat.java code3-6. The results of this Java code▼4. Reference▼1. The latency of a query execution in SQL Server We often see the latency … Continue reading “Java – Update Statistics in SQL Server on Ubuntu No.91”

Java – Creating sample data for SQL Server on Ubuntu No.89

In this blog, how to create sample records for SQL Server on Ubuntu using Java is shown. Contents ▼1. Creating sample data using Java▼2. Prerequisites2-1. Checking Java – Generating the sample data on SQL Server No.87 to execute below.▼3. Creating sample data for SQL Server by Java3-1. Create an Apache Maven project3-2. Remove the existed both App.java and AppTest.java3-3. Start Visual Studio Code3-4. Update pom.xml as below to run query on SQL Server and save it (Ctrl+S)3-5. Creating Java code sqlsample2.java3-6. Results of this code▼4. Reference▼1. Creating sample data using Java In the past blog, these blogs are shared. they use .sql file to create data by sqlcmd. In this … Continue reading “Java – Creating sample data for SQL Server on Ubuntu No.89”

Java – Calculate the compound interest No.88

How to calculate the compound interest using Java in VS code on Ubuntu is shown in this blog. Contents ▼1. Calculate the compound interest▼2. Prerequisites2-1. Installing Visual Studio Code2-2. Installing Maven2-3. Creating a project by Apache Maven2-4. Removing the existed both App.java and AppTest.java2-5. Starting Visual Studio Code▼3. Calculating compound interest by Java3-1. Creating a Java file to calculate compound interest3-2.  Error happens without inputs3-3, Setting lunch.json for the initial parameters3-4. The results by Debug3-5. Principal, Rate, time/Years can be changed and can be recalculated.▼4. Reference▼1. Calculate the compound interest Rob advisor “WealthNavi” and accumulation NISA and private government bounds etc are executed by myself. the compound interest is implemented … Continue reading “Java – Calculate the compound interest No.88”

Java –Save records for MySQL into Azure Blob Storage No.86 

In this blog, how to save the results of select query for MySQL into Azure Blob Storage by Java. Contents ▼1. Prerequisites1-1. Install MySQL and create a table with some records▼2. Save the results of select for MySQL on Ubuntu into Azure Blob Storage by Java2-1. Create an Apache Maven project2-2. Remove the existed both App.java and AppTest.java2-3. Start Visual Studio Code2-4. Update pom.xml as below and save it (Ctrl+S)2-5. Save the results of select for MySQL into Azure Blob Storage2-6. Run the code▼3. Reference▼1. Prerequisites 1-1. Install MySQL and create a table with some records Java – Connect to MySQL on Ubuntu and run select query No.80 # Create a table … Continue reading “Java –Save records for MySQL into Azure Blob Storage No.86 “

Java -Save the results of select for MySQL into a file No.85

In this blog, how to save the results of select for MySQL on Ubuntu into a file is shown. Contents ▼1. Prerequisites1-1. Install MySQL and create a table with some records▼2. Save the results of select for MySQL on Ubuntu into a file by Java2-1. Create an Apache Maven project2-2. Remove the existed both App.java and AppTest.java2-3. Start Visual Studio Code2-4. Update pom.xml as below and save it (Ctrl+S)2-5. Save the results of select for MySQL on Ubuntu into a file2-6. Run the code▼3. Reference▼1. Prerequisites 1-1. Install MySQL and create a table with some records Java – Connect to MySQL on Ubuntu and run select query No.80 # Create … Continue reading “Java -Save the results of select for MySQL into a file No.85”