diff --git a/.github/workflows/main_app-0731.yml b/.github/workflows/main_app-0731.yml
new file mode 100644
index 000000000..8a55ef705
--- /dev/null
+++ b/.github/workflows/main_app-0731.yml
@@ -0,0 +1,53 @@
+# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
+# More GitHub Actions for Azure: https://github.com/Azure/actions
+
+name: Build and deploy JAR app to Azure Web App - app-0731
+
+on:
+ push:
+ branches:
+ - main
+ workflow_dispatch:
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Set up Java version
+ uses: actions/setup-java@v1
+ with:
+ java-version: '11'
+
+ - name: Build with Maven
+ run: mvn clean install
+
+ - name: Upload artifact for deployment job
+ uses: actions/upload-artifact@v2
+ with:
+ name: java-app
+ path: '${{ github.workspace }}/target/*.jar'
+
+ deploy:
+ runs-on: ubuntu-latest
+ needs: build
+ environment:
+ name: 'Production'
+ url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
+
+ steps:
+ - name: Download artifact from build job
+ uses: actions/download-artifact@v2
+ with:
+ name: java-app
+
+ - name: Deploy to Azure Web App
+ id: deploy-to-webapp
+ uses: azure/webapps-deploy@v2
+ with:
+ app-name: 'app-0731'
+ slot-name: 'Production'
+ publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_DBA25FDA44E341C3A8723E827ED244F5 }}
+ package: '*.jar'
diff --git a/.github/workflows/main_trial0727.yml b/.github/workflows/main_trial0727.yml
new file mode 100644
index 000000000..c41bc9cc0
--- /dev/null
+++ b/.github/workflows/main_trial0727.yml
@@ -0,0 +1,53 @@
+# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
+# More GitHub Actions for Azure: https://github.com/Azure/actions
+
+name: Build and deploy WAR app to Azure Web App - Trial0727
+
+on:
+ push:
+ branches:
+ - main
+ workflow_dispatch:
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Set up Java version
+ uses: actions/setup-java@v1
+ with:
+ java-version: '17'
+
+ - name: Build with Maven
+ run: mvn clean install
+
+ - name: Upload artifact for deployment job
+ uses: actions/upload-artifact@v2
+ with:
+ name: java-app
+ path: '${{ github.workspace }}/target/*.war'
+
+ deploy:
+ runs-on: ubuntu-latest
+ needs: build
+ environment:
+ name: 'Production'
+ url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
+
+ steps:
+ - name: Download artifact from build job
+ uses: actions/download-artifact@v2
+ with:
+ name: java-app
+
+ - name: Deploy to Azure Web App
+ id: deploy-to-webapp
+ uses: azure/webapps-deploy@v2
+ with:
+ app-name: 'Trial0727'
+ slot-name: 'Production'
+ publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_28168FF07CD24D5EB8D680AF25EA6AF6 }}
+ package: '*.war'
diff --git a/.github/workflows/v02_app-0731.yml b/.github/workflows/v02_app-0731.yml
new file mode 100644
index 000000000..6b034f925
--- /dev/null
+++ b/.github/workflows/v02_app-0731.yml
@@ -0,0 +1,53 @@
+# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
+# More GitHub Actions for Azure: https://github.com/Azure/actions
+
+name: Build and deploy JAR app to Azure Web App - app-0731
+
+on:
+ push:
+ branches:
+ - V02
+ workflow_dispatch:
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Set up Java version
+ uses: actions/setup-java@v1
+ with:
+ java-version: '11'
+
+ - name: Build with Maven
+ run: mvn clean install
+
+ - name: Upload artifact for deployment job
+ uses: actions/upload-artifact@v2
+ with:
+ name: java-app
+ path: '${{ github.workspace }}/target/*.jar'
+
+ deploy:
+ runs-on: ubuntu-latest
+ needs: build
+ environment:
+ name: 'Production'
+ url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
+
+ steps:
+ - name: Download artifact from build job
+ uses: actions/download-artifact@v2
+ with:
+ name: java-app
+
+ - name: Deploy to Azure Web App
+ id: deploy-to-webapp
+ uses: azure/webapps-deploy@v2
+ with:
+ app-name: 'app-0731'
+ slot-name: 'Production'
+ publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_19BD704EA8FC415C8E85984D78E3E9A2 }}
+ package: '*.jar'
diff --git a/pom.xml b/pom.xml
index 91de33819..12ca25889 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,6 +27,11 @@
spring-boot-starter-test
test
+
+ com.microsoft.sqlserver
+ mssql-jdbc
+ 12.2.0.jre11
+
diff --git a/src/main/java/com/example/demo/DemoApplication.java b/src/main/java/com/example/demo/DemoApplication.java
index f594b5bc3..720411062 100644
--- a/src/main/java/com/example/demo/DemoApplication.java
+++ b/src/main/java/com/example/demo/DemoApplication.java
@@ -4,6 +4,8 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
+import java.sql.*;
+import java.util.*;
@SpringBootApplication
@RestController
@@ -11,10 +13,31 @@ public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
+
+
}
-
@RequestMapping("/")
String sayHello() {
- return "Hello World!";
+ String connectionUrl =
+ "jdbc:sqlserver://pricedb07.database.windows.net:1433;database=Priceit;user=dbadmin@pricedb07;password=Admin123;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;";
+ String query = "Select * from First";
+ String result = new String();
+ result = " code did not work";
+ try{
+ Connection connection = DriverManager.getConnection(connectionUrl);
+ System.out.println(connection.toString());
+ Statement statement = connection.createStatement();
+
+ ResultSet resultSet = statement.executeQuery(query);
+ resultSet.next();
+ result = resultSet.getString(1) + " " + resultSet.getString(2);
+ System.out.println(result);
+
+ } catch(Exception e){
+ System.out.println("connection established hopefully");
+ e.printStackTrace();
+ }
+ return "Hello Shankar jdbc" + result;
+
}
}