Python -Error handling & Retry in SQL Server on Ubuntu No.93

How to implement the error handling and retry with some interval in SQL Server on Ubuntu by Python is shown in this blog. ▼1. Why do we need an error handling and an retry logic? We often use a cloud service and a remote service through the network. if the network intermittently cause something problems, the client application cannot access these services and will stop. to avoid this case, we need to add an error handling and an retry logic in an client application. ▼2. Prerequisites An error handling and a retry logic will be added into the code that was shown in the following blog. Python – How to … Continue reading “Python -Error handling & Retry in SQL Server on Ubuntu No.93”

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. ▼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 Transactional insert query will add (6,7) and (7,8) into the table “t1”. after the transaction get started, an insert query is executed and then commit is executed. … 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. ▼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 2-1. Creating a Java code This Java code implements 3 retries with 30 seconds interval using while after a connection failure. To cause the connection failure, listening port of SQL Server … 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. ▼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, the following retry with some interval in a connection string can be used after “Microsoft JDBC Driver 9.4 for SQL Server”. ▼2. Writing Java code to implement auto-retry when failing to connect to SQL Server 2.1. Creating a Java code for auto-retry connection This code uses … 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. ▼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 for t1 table 1    2 2    3 3    4 4    5 5    6 Current Timestamps: 2020-05-26 06:52:11.83 [main] INFO ExecuteQSQLSvr – The connection is … Continue reading “Java – Execute a Select query in SQL Server on Ubuntu No.8”

Python -Create, write and read file -VS Code on Ubuntu No.35

How to create, write and read a file using Python in Visual Studio Code on Ubuntu is shown in this blog. ▼1. Creating, write and read a file using Python open() function is used to create a file or edit a file. there are 2 elementary parameters of open() Python function for specifying a file name and the mode of a file operation. There are some modes as below. Mode Description ‘r’ open for reading (default) ‘w’ open for writing, truncating the file first ‘x’ open for exclusive creation, failing if the file already exists ‘a’ open for writing, appending to the end of file if it exists ‘b’ binary mode ‘t’ text … Continue reading “Python -Create, write and read file -VS Code on Ubuntu No.35”

Python – Using Visual Studio Code on Ubuntu No.34

How to run python code in Visual Studio Code on Ubuntu is shown in this blog. ▼1. Let’s write python code in Visual Studio Code In Visual Studio Code, there are many available programming languages. e.g) Java, C, C++, Python etc on Windows OS, Mac OS and Linux. in this case, I will try to use python. Python doesn’t require compile and it’s an interpreted language. Ref: Get Started Tutorial for Python in Visual Studio Code ▼2. Prerequisites 2-1. Using Ubuntu 20.04.2 LTS Ref: https://releases.ubuntu.com/20.04/ 2-2. Installing Visual Studio Code Ref: https://code.visualstudio.com/docs/setup/linux 2-3. Installing Python extension Ref: Get Started Tutorial for Python in Visual Studio Code Confirming the installed python … Continue reading “Python – Using Visual Studio Code on Ubuntu No.34”

Python – Creating sample data in SQL Server on Ubuntu No.62

How to create sample data in SQL Server on Ubuntu is shown in this blog. These steps are available for Windows OS, too. ▼1. What is Microsoft SQL Server ? There are many kinds of SQL Server. for example, Azure SQL Database in cloud, Azure Synapse Analytics – SQL pool (SQL Data Warehouse) and on-premise SQL Server on Azure Virtual Machine (VM) etc We can find the version of SQL Server and hot fixes in this site Microsoft SQL Server Versions List . as Free trial version, SQL Server Express edition on Windows and Linux are available. On windows OS, we can download Express edition by clicking “Download Now”. SQL2022-SSEI-Expr.exe … Continue reading “Python – Creating sample data in SQL Server on Ubuntu No.62”

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. ▼1. Prerequisites There are needed for executing a select query in SQL Server on Ubuntu. 1-1. Installing SQL Server Quickstart: Install SQL Server and create a database on Ubuntu 1-2. Installing Visual Studio Code https://code.visualstudio.com/docs/setup/linux 1-3. Installing Maven Apache Kafka Word Count – Java No.44 “2-3. Installing Apache Maven”Maven – Download Apache Maven 1-4. Generating sample data in SQL Server Python – Creating sample data in SQL Server on Ubuntu No.62 1-5. Executing a select query in SQL Server using Java Java SQL Server on Linux で select … Continue reading “Java – Put SQL Server select results into a csv file No.70”

Python – How to connect to SQL Server on Ubuntu  No.92

How to connect and run select query for a table in SQL Server on Ubuntu using Microsoft ODBC Driver for SQL Server by Python are shown in this blog. ▼1. Connecting to SQL Server on Ubuntu In the past, how to connect and run queries using Java are shown in this blog as below. (As of 2022/12) ▼2. Connecting to SQL Server and Select using Python 2-1. Installing SQL Server on Linux SQL Server 2022 is GA (General Avaiable) on Dec 2022.Quickstart: Install SQL Server and create a database on Ubuntu 2-2. Installing Microsoft ODBC Driver for SQL Server 2-3. Creating a python code to connect to SQL Server on … Continue reading “Python – How to connect to SQL Server on Ubuntu  No.92”