<dependency>
<groupId>org.ethereum</groupId>
<artifactId>ethereumj</artifactId>
<version>2.5.1</version>
</dependency>
Properties props = new Properties();
props.setProperty("jdbcUrl", "jdbc:ethereumj://localhost:8545/myAccount");
props.setProperty("driverClass", "org.ethereum.jdbc.EthereumDriver");
Connection conn = DriverManager.getConnection(props);
String smartContractCode = "pragma solidity ^0.8.0;
contract MyContract {
\t uint256 public myVariable;
\t constructor() {
\t \t myVariable = 100;
\t }
\t function setVariable(uint256 newValue) public {
\t \t myVariable = newValue;
\t }
}";
String contractAddress = "";
Statement stmt = conn.createStatement();
stmt.executeUpdate("CREATE CONTRACT FROM CODE '" + smartContractCode + "' RETURNS '" + contractAddress + "'");
String newValue = "200";
PreparedStatement pstmt = conn.prepareStatement("CALL CONTRACT '" + contractAddress + "' SET_VARIABLE(?)");
pstmt.setString(1, newValue);
pstmt.executeUpdate();
ResultSet rs = pstmt.executeQuery("CALL CONTRACT '" + contractAddress + "' GET_MYVARIABLE()");
if (rs.next()) {
int currentValue = rs.getInt(1);
System.out.println("Current value of myVariable: " + currentValue);
}