<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Data on JOURNAL.ROBBI.MY</title><link>https://journal.robbi.my/tags/data/</link><description>Recent content in Data on JOURNAL.ROBBI.MY</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 30 Jun 2026 03:01:59 +0000</lastBuildDate><atom:link href="https://journal.robbi.my/tags/data/index.xml" rel="self" type="application/rss+xml"/><item><title>[PART 2] Spring Boot - Multiple datasource (database) with JDBC and JPA</title><link>https://journal.robbi.my/posts/241102093844/</link><pubDate>Sat, 02 Nov 2024 09:38:44 +0800</pubDate><guid>https://journal.robbi.my/posts/241102093844/</guid><description>&lt;p&gt;We start with &lt;code&gt;postgreSQL&lt;/code&gt; because this our primary database connection and we do all CRUD stuff from here. We need 2 class, which use for connection and configuration of datasource.&lt;/p&gt;
&lt;h3 id="datasourceconfigurationpostgresql"&gt;DatasourceConfigurationPostgreSQL&lt;/h3&gt;
&lt;div class="code-block"&gt;
 &lt;div class="code-header font-mono"&gt;
 &lt;span class="code-lang"&gt;java&lt;/span&gt;
 &lt;div class="code-window-controls"&gt;
 &lt;button class="code-copy" onclick="copyCode(this)" title="Copy to clipboard"&gt;📋 Copy&lt;/button&gt;
 &lt;span class="ctrl-min"&gt;&lt;/span&gt;
 &lt;span class="ctrl-max"&gt;&lt;/span&gt;
 &lt;span class="ctrl-close"&gt;&lt;/span&gt;
 &lt;/div&gt;
 &lt;/div&gt;
 &lt;div class="code-content"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-java" data-lang="java"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff79c6"&gt;package&lt;/span&gt; com.robbi.demo.config.postgresql;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff79c6"&gt;import&lt;/span&gt; javax.sql.DataSource;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff79c6"&gt;import&lt;/span&gt; org.slf4j.Logger;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff79c6"&gt;import&lt;/span&gt; org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff79c6"&gt;import&lt;/span&gt; org.springframework.boot.context.properties.ConfigurationProperties;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff79c6"&gt;import&lt;/span&gt; org.springframework.context.annotation.Bean;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff79c6"&gt;import&lt;/span&gt; org.springframework.context.annotation.Configuration;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff79c6"&gt;import&lt;/span&gt; org.springframework.context.annotation.Primary;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff79c6"&gt;import&lt;/span&gt; com.robbi.demo.utils.LoggerFactoryUtil;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;@Configuration
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#8be9fd;font-style:italic"&gt;public&lt;/span&gt; &lt;span style="color:#8be9fd;font-style:italic"&gt;class&lt;/span&gt; &lt;span style="color:#50fa7b"&gt;DatasourceConfigurationPostgreSQL&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	&lt;span style="color:#8be9fd;font-style:italic"&gt;private&lt;/span&gt; &lt;span style="color:#8be9fd;font-style:italic"&gt;static&lt;/span&gt; &lt;span style="color:#8be9fd;font-style:italic"&gt;final&lt;/span&gt; Logger LOG &lt;span style="color:#ff79c6"&gt;=&lt;/span&gt; LoggerFactoryUtil.&lt;span style="color:#50fa7b"&gt;getLogger&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; @Bean
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; @ConfigurationProperties(&lt;span style="color:#f1fa8c"&gt;&amp;#34;spring.datasource.postgresql&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#8be9fd;font-style:italic"&gt;public&lt;/span&gt; DataSourceProperties &lt;span style="color:#50fa7b"&gt;dataSourcePropertiesPostgreSQL&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;		LOG.&lt;span style="color:#50fa7b"&gt;info&lt;/span&gt;(&lt;span style="color:#f1fa8c"&gt;&amp;#34;spring.datasource.postgresql&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ff79c6"&gt;return&lt;/span&gt; &lt;span style="color:#ff79c6"&gt;new&lt;/span&gt; DataSourceProperties();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; @Bean
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; @Primary
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#8be9fd;font-style:italic"&gt;public&lt;/span&gt; DataSource &lt;span style="color:#50fa7b"&gt;dataSourcePostgreSQL&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;		LOG.&lt;span style="color:#50fa7b"&gt;info&lt;/span&gt;(&lt;span style="color:#f1fa8c"&gt;&amp;#34;Initializing PostgreSQL DataSource: {}&amp;#34;&lt;/span&gt;, dataSourcePropertiesPostgreSQL().&lt;span style="color:#50fa7b"&gt;getUrl&lt;/span&gt;());
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	 &lt;span style="color:#ff79c6"&gt;return&lt;/span&gt; dataSourcePropertiesPostgreSQL()
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	 .&lt;span style="color:#50fa7b"&gt;initializeDataSourceBuilder&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	 .&lt;span style="color:#50fa7b"&gt;build&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Take note on anotation &lt;code&gt;@ConfigurationProperties&lt;/code&gt; and &lt;code&gt;@Primary&lt;/code&gt; that I applied here.&lt;/p&gt;</description></item><item><title>[PART 1] Spring Boot - Multiple datasource (database) with JDBC and JPA</title><link>https://journal.robbi.my/posts/240929095904/</link><pubDate>Sun, 29 Sep 2024 09:59:04 +0800</pubDate><guid>https://journal.robbi.my/posts/240929095904/</guid><description>&lt;p&gt;Assalamualaikum and hello! Spring Boot&amp;rsquo;s streamlined development process makes it a popular choice for many developers.
However, configuring it for multiple databases can present challenges.
While there are various tutorials available, I&amp;rsquo;ve encountered issues with their completeness and clarity.
In this tutorial, I&amp;rsquo;ll provide a detailed solution to this problem.&lt;/p&gt;
&lt;h2 id="database"&gt;Database&lt;/h2&gt;
&lt;p&gt;We require a connection to two databases: an existing MSSQL database and a new PostgreSQL database.
The PostgreSQL database will be used for all standard CRUD operations (create, read, update, delete).
The MSSQL database will be accessed in a read-only manner to retrieve specific data without making any modifications to its structure or content.&lt;/p&gt;</description></item><item><title>Use Cases for Java Records</title><link>https://journal.robbi.my/indieweb/240610054825/</link><pubDate>Mon, 10 Jun 2024 05:48:25 +0800</pubDate><guid>https://journal.robbi.my/indieweb/240610054825/</guid><description>&lt;p&gt;Mirror:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://archive.today/2024.06.09-213553/https://reflectoring.io/beginner-friendly-guide-to-java-records/"&gt;archive.today&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://web.archive.org/web/20240609213541/https://reflectoring.io/beginner-friendly-guide-to-java-records/"&gt;wayback machine&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>23 09 20 1218_bookmark Springboot Jackson Date Format</title><link>https://journal.robbi.my/indieweb/230920121815/</link><pubDate>Wed, 20 Sep 2023 12:18:15 +0800</pubDate><guid>https://journal.robbi.my/indieweb/230920121815/</guid><description>&lt;p&gt;Mirror:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://web.archive.org/web/20230920051937/https://www.springcloud.io/post/2022-09/springboot-date-format/#gsc.tab=0"&gt;WaybackMachine&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Delete / purge data from 3rd party social media periodically</title><link>https://journal.robbi.my/posts/210825085132/</link><pubDate>Wed, 25 Aug 2021 08:51:32 +0800</pubDate><guid>https://journal.robbi.my/posts/210825085132/</guid><description>&lt;p&gt;Have you ever thought about deleting your old content? Especially on centralize social media such as Twitter, Facebook, Instagram and many more.. which we are well aware that they will track, analyze and use your metadata and content for a certain purpose that only benefit for them self.&lt;/p&gt;
&lt;p&gt;Social network is not likely same as when you start register on they website. This is what you should expect anyway. They put you on free trial mode and let you lurk around and catch you connection, likes, post and more. After a certain period, you won&amp;rsquo;t notice they does not care much about us connecting with friends, it just want us to consume content as much as possible on their platform - while generating ad revenue. No matter what social media you use, they want you to be addict to they social network.&lt;/p&gt;</description></item></channel></rss>