File tree Expand file tree Collapse file tree 7 files changed +150
-1
lines changed
Expand file tree Collapse file tree 7 files changed +150
-1
lines changed Original file line number Diff line number Diff line change 1- /mvnw text eol =lf
1+ * /mvnw text eol =lf
22* .cmd text eol =crlf
33* .sh text eol =lf
Original file line number Diff line number Diff line change 2222# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
2323hs_err_pid *
2424replay_pid *
25+
26+ HELP.md
27+ target /
28+ ! .mvn /wrapper /maven-wrapper.jar
29+ ! ** /src /main /** /target /
30+ ! ** /src /test /** /target /
31+
32+ # ## STS ###
33+ .apt_generated
34+ .classpath
35+ .factorypath
36+ .project
37+ .settings
38+ .springBeans
39+ .sts4-cache
40+
41+ # ## IntelliJ IDEA ###
42+ .idea
43+ * .iws
44+ * .iml
45+ * .ipr
46+
47+ # ## NetBeans ###
48+ /nbproject /private /
49+ /nbbuild /
50+ /dist /
51+ /nbdist /
52+ /.nb-gradle /
53+ build /
54+ ! ** /src /main /** /build /
55+ ! ** /src /test /** /build /
56+
57+ # ## VS Code ###
58+ .vscode /
59+
60+ /logs /
Original file line number Diff line number Diff line change 1+ target /
Original file line number Diff line number Diff line change 1+ # sqldbmi
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5+ <modelVersion >4.0.0</modelVersion >
6+
7+ <groupId >com.example</groupId >
8+ <artifactId >demo</artifactId >
9+ <version >1.0-SNAPSHOT</version >
10+
11+ <properties >
12+ <maven .compiler.source>17</maven .compiler.source>
13+ <maven .compiler.target>17</maven .compiler.target>
14+
15+ <java .version>17</java .version>
16+ </properties >
17+
18+ <dependencies >
19+ <dependency >
20+ <groupId >com.microsoft.sqlserver</groupId >
21+ <artifactId >mssql-jdbc</artifactId >
22+ <version >10.2.0.jre11</version >
23+ </dependency >
24+
25+ </dependencies >
26+
27+ <build >
28+ <plugins >
29+ <plugin >
30+ <groupId >org.apache.maven.plugins</groupId >
31+ <artifactId >maven-shade-plugin</artifactId >
32+ <version >3.2.4</version >
33+ <executions >
34+ <execution >
35+ <phase >package</phase >
36+ <goals >
37+ <goal >shade</goal >
38+ </goals >
39+ <configuration >
40+ <transformers >
41+ <transformer implementation =" org.apache.maven.plugins.shade.resource.ManifestResourceTransformer" >
42+ <mainClass >com.example.MainSQL</mainClass >
43+ </transformer >
44+ </transformers >
45+ <filters >
46+ <filter >
47+ <artifact >*:*</artifact >
48+ <excludes >
49+ <exclude >META-INF/*.SF</exclude >
50+ <exclude >META-INF/*.DSA</exclude >
51+ <exclude >META-INF/*.RSA</exclude >
52+ </excludes >
53+ </filter >
54+ </filters >
55+ </configuration >
56+ </execution >
57+ </executions >
58+ </plugin >
59+ </plugins >
60+ </build >
61+ </project >
Original file line number Diff line number Diff line change 1+ package com .example ;
2+
3+ import java .io .FileInputStream ;
4+ import java .io .IOException ;
5+ import java .io .InputStream ;
6+ import java .util .Properties ;
7+
8+ import java .sql .*;
9+
10+ import com .microsoft .sqlserver .jdbc .SQLServerDataSource ;
11+
12+ public class MainSQL {
13+
14+
15+ public static void main (String [] args ) {
16+
17+ Properties properties = new Properties ();
18+ try (InputStream input = MainSQL .class .getClassLoader ().getResourceAsStream ("application.properties" )) {
19+ if (input == null ) {
20+ System .out .println ("Sorry, unable to find application.properties" );
21+ return ;
22+ }
23+ // Load the properties file
24+ properties .load (input );
25+ } catch (IOException ex ) {
26+ ex .printStackTrace ();
27+ return ;
28+ }
29+
30+ String connString = properties .getProperty ("AZURE_SQLDB_CONNECTIONSTRING" );
31+ String user = properties .getProperty ("AZURE_SQLDB_USER" );
32+ String password = properties .getProperty ("AZURE_SQLDB_PASSWORD" );
33+
34+ connString = connString + ";user=" + user + ";password=" + password ;
35+ System .out .print (connString );
36+
37+ SQLServerDataSource ds = new SQLServerDataSource ();
38+ ds .setURL (connString );
39+ try (Connection connection = ds .getConnection ()) {
40+ System .out .println ("Connected successfully." );
41+ } catch (SQLException e ) {
42+ e .printStackTrace ();
43+ }
44+ }
45+
46+
47+ }
Original file line number Diff line number Diff line change 1+ AZURE_SQLDB_CONNECTIONSTRING =jdbc:sqlserver://${AZ_DATABASE_SERVER_NAME}.database.windows.net:1433; database=demo;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;
2+ AZURE_SQLDB_USER =demo@$AZ_DATABASE_NAME
3+ AZURE_SQLDB_PASSWORD =$AZ_SQL_SERVER_PASSWORD
You can’t perform that action at this time.
0 commit comments