unknown před 6 roky
revize
b509f218b4

binární
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ární
target/classes/com/fusi24/LatihanJava.class