Difference between revisions of "IT-SDK-Java"
Jump to navigation
Jump to search
Samerhijazi (talk | contribs) (→Setting) |
(→Setting) |
||
| Line 14: | Line 14: | ||
* JDK_HOME=%JAVA_HOME% | * JDK_HOME=%JAVA_HOME% | ||
* JRE_HOME=C:\sdk\Java\jre_1.8.0_65 | * JRE_HOME=C:\sdk\Java\jre_1.8.0_65 | ||
| − | * PATH=%JAVA_HOME%/bin | + | * Windows: PATH=%JAVA_HOME%/bin |
| − | * PATH=$JAVA_HOME/bin:$PATH | + | * Linux: PATH=$JAVA_HOME/bin:$PATH |
=Maven= | =Maven= | ||
Revision as of 11:08, 29 July 2021
Contents
Links
- Books: https://www.manning.com/
- Tutorial: https://www.javatpoint.com/java-tutorial
- Tutorial: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/object-oriented-programming
- Tutorial: https://www.tutorialspoint.com/design_pattern/index.htm
- Tutorial: https://howtodoinjava.com/
- Patterns: https://en.wikipedia.org/wiki/Facade_pattern
- Patterns: https://www.baeldung.com/java-core-structural-patterns
- https://www.jrebel.com/blog/what-is-jrebel
- Hibernate: http://hibernate.org/
Setting
- JAVA_HOME=C:\sdk\Java\jdk_1.8.0_65
- JDK_HOME=%JAVA_HOME%
- JRE_HOME=C:\sdk\Java\jre_1.8.0_65
- Windows: PATH=%JAVA_HOME%/bin
- Linux: PATH=$JAVA_HOME/bin:$PATH
Maven
wget https://www-us.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
sudo tar xzf apache-maven-3.6.3-bin.tar.gz
sudo ln -s apache-maven-3.6.3 maven
sudo vi /etc/profile.d/maven.sh
-------------------------------------
export MAVEN_HOME=/opt/maven
export PATH=${MAVEN_HOME}/bin:${PATH}
-------------------------------------
source /etc/profile.d/maven.sh
mvn -version
Code-Collections
import java.util.concurrent.TimeUnit;
---------------------------------------------
try {
TimeUnit.SECONDS.sleep(secondsToSleep);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
}
---------------------------------------------
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import io.agroal.api.AgroalDataSource;
public class SettingDatabase{
AgroalDataSource dataSource;
String db = "jdbc:db2://localhost:5245/DATABASE:user=db2;password=db2;";
String sql = "SELECT * FROM users";
public void init_DriverManager()throws SQLException{
try{
Connection connection = DriverManager.getConnection(db); //Connection connection = AgroalDataSource.getConnection(db);
PreparedStatement ps = connection.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
}
}
}
Architekture
Database
- JDBC is a low level standard for interaction with databases. JPA is higher level standard for the same purpose.
- JDBC allows you to do more things with the Database directly. JPA allows you to use an object model in your application.
- Datasource & Pooling (JDBC) >> Agroal
- Datasource & Pooling (Reactive) >> Vert.x
- Agroal is a datasource connection pool implementation with integration with transaction, security and other systems.
- Agroal library allows the definition of java.sql.DataSource with connection pooling.
- JPA (Java Persistence API) & Hibernate ORM (Object-relational mapping). JPA is only a specification. Hibernate is an implementation of JPA.
- JDBC: https://quarkus.io/guides/datasource
- Reactive: https://quarkus.io/guides/reactive-sql-clients
- Oracle: https://blogs.oracle.com/developers/configuring-the-oracle-jdbc-drivers-with-quarkus
RESTFul
- RESTEasy is an implementation of JAX-RS and it is used to implement RestFul-services.
- Microservices communicating either synchronously via REST or asynchronously using Kafka.
- https://quarkus.io/guides/rest-json
- https://quarkus.io/guides/rest-client
- https://quarkus.io/guides/resteasy-reactive
- https://lankydan.dev/building-a-rest-api-with-quarkus
- https://dzone.com/articles/building-a-rest-api-with-quarkus