ソースを参照

commit pertama

unknown 6 年 前
コミット
b509f218b4
共有4 個のファイルを変更した60 個の追加0 個の削除を含む
  1. BIN
      bin/com/fusi24/LatihanJava.class
  2. 33 0
      pom.xml
  3. 27 0
      src/com/fusi24/LatihanJava.java
  4. BIN
      target/classes/com/fusi24/LatihanJava.class

BIN
bin/com/fusi24/LatihanJava.class


+ 33 - 0
pom.xml

@@ -0,0 +1,33 @@
1
+<project xmlns="http://maven.apache.org/POM/4.0.0"
2
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4
+	<modelVersion>4.0.0</modelVersion>
5
+	<groupId>TrainingJava</groupId>
6
+	<artifactId>TrainingJava</artifactId>
7
+	<version>0.0.1-SNAPSHOT</version>
8
+	<name>TrainingMaven</name>
9
+
10
+	<dependencies>
11
+		<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
12
+		<dependency>
13
+			<groupId>mysql</groupId>
14
+			<artifactId>mysql-connector-java</artifactId>
15
+			<version>5.1.40</version>
16
+		</dependency>
17
+
18
+	</dependencies>
19
+
20
+	<build>
21
+		<sourceDirectory>src</sourceDirectory>
22
+		<plugins>
23
+			<plugin>
24
+				<artifactId>maven-compiler-plugin</artifactId>
25
+				<version>3.7.0</version>
26
+				<configuration>
27
+					<source>1.8</source>
28
+					<target>1.8</target>
29
+				</configuration>
30
+			</plugin>
31
+		</plugins>
32
+	</build>
33
+</project>

+ 27 - 0
src/com/fusi24/LatihanJava.java

@@ -0,0 +1,27 @@
1
+package com.fusi24;
2
+
3
+import java.sql.Connection;
4
+import java.sql.DriverManager;
5
+
6
+public class LatihanJava {
7
+	
8
+	  static {
9
+	    try {
10
+	      Class.forName("com.mysql.jdbc.Driver");
11
+	    } catch(ClassNotFoundException ex) {
12
+	      System.err.println("Unable to load MySQL Driver");
13
+	    }
14
+	    }
15
+	 
16
+	  
17
+	public static void main(String args[]) throws Exception {
18
+		
19
+		String jdbcUrl = "jdbc:mysql://db.fusi24.com:3306/employees?user=training&password=training";
20
+		Connection con = DriverManager.getConnection(jdbcUrl);
21
+	    System.out.println("Connected!");
22
+	    con.close();
23
+		
24
+	    
25
+		
26
+	}
27
+}

BIN
target/classes/com/fusi24/LatihanJava.class