main
黄海 2 years ago
parent 0925314263
commit ba1e8206b9

@ -50,6 +50,13 @@
<scope>system</scope> <scope>system</scope>
<systemPath>${project.basedir}/ExtendJar/aspose.slides-19.3.jar</systemPath> <systemPath>${project.basedir}/ExtendJar/aspose.slides-19.3.jar</systemPath>
</dependency> </dependency>
<dependency>
<groupId>org.opengauss</groupId>
<artifactId>opengauss-jdbc</artifactId>
<version>5.0.0</version>
<scope>system</scope> <!--system类似provided需要显式提供依赖的jar以后Maven就不会在Repository中查找它-->
<systemPath>${project.basedir}/ExtendJar/opengauss-jdbc-5.0.0.jar</systemPath>
</dependency>
<!--jfinal主框架--> <!--jfinal主框架-->
<dependency> <dependency>
<groupId>com.jfinal</groupId> <groupId>com.jfinal</groupId>
@ -250,12 +257,6 @@
<version>1.7.36</version> <version>1.7.36</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.opengauss/opengauss-jdbc -->
<dependency>
<groupId>org.opengauss</groupId>
<artifactId>opengauss-jdbc</artifactId>
<version>5.0.0</version>
</dependency>
<!--引入kafka--> <!--引入kafka-->
<dependency> <dependency>
<groupId>org.apache.kafka</groupId> <groupId>org.apache.kafka</groupId>

@ -22,13 +22,13 @@ import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.clients.producer.ProducerRecord; import org.apache.kafka.clients.producer.ProducerRecord;
import org.postgresql.PGProperty; import org.opengauss.PGProperty;
import org.postgresql.jdbc.PgConnection; import org.opengauss.jdbc.PgConnection;
import org.postgresql.replication.LogSequenceNumber; import org.opengauss.replication.LogSequenceNumber;
import org.postgresql.replication.PGReplicationStream; import org.opengauss.replication.PGReplicationStream;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;

@ -42,9 +42,9 @@ public class TestReadWriteSplit {
} }
public static void main(String[] args) { public static void main(String[] args) {
String MasterUrl = "jdbc:postgresql://10.10.14.61:15400/test_db"; String MasterUrl = "jdbc:opengauss://10.10.14.61:15400/test_db";
String SlaveUrl = "jdbc:postgresql://10.10.14.62:15400/test_db"; String SlaveUrl = "jdbc:opengauss://10.10.14.62:15400/test_db";
String driverClass = "org.postgresql.Driver"; String driverClass = "org.opengauss.Driver";
String userName = "postgres"; String userName = "postgres";
String passWord = "DsideaL147258369"; String passWord = "DsideaL147258369";
DruidPlugin dpMaster = createDruidPlugin(MasterUrl, userName, passWord, driverClass); DruidPlugin dpMaster = createDruidPlugin(MasterUrl, userName, passWord, driverClass);
@ -73,16 +73,16 @@ public class TestReadWriteSplit {
//启动 //启动
arp.start(); arp.start();
String sql = "truncate table test"; //String sql = "truncate table test";
Db.update(sql); //Db.update(sql);
for (int i = 1; i <= 100; i++) { for (int i = 1; i <= 100; i++) {
sql = "insert into test(id,txt) values(?,?)"; String sql = "insert into test(id,txt) values(?,?)";
Db.update(sql, i, "黄海——" + i); Db.update(sql, i, "黄海——" + i);
} }
for (int i = 1; i <= 100; i++) { for (int i = 1; i <= 100; i++) {
sql = "select * from test where id=?"; String sql = "select * from test where id=?";
List<Record> list = Db.find(sql, i); List<Record> list = Db.find(sql, i);
System.out.println(list); System.out.println(list);
} }

@ -42,8 +42,8 @@ public class TestReadWriteSplit2 {
} }
public static void main(String[] args) { public static void main(String[] args) {
String url = "jdbc:postgresql://10.10.14.61:15400,10.10.14.62:15400/test_db?autoBalance=roundrobin&targetServerType=master"; String url = "jdbc:opengauss://10.10.14.61:15400,10.10.14.62:15400/test_db?autoBalance=roundrobin&targetServerType=master";
String driverClass = "org.postgresql.Driver"; String driverClass = "org.opengauss.Driver";
String userName = "postgres"; String userName = "postgres";
String passWord = "DsideaL147258369"; String passWord = "DsideaL147258369";
DruidPlugin druidPlugin = createDruidPlugin(url, userName, passWord, driverClass); DruidPlugin druidPlugin = createDruidPlugin(url, userName, passWord, driverClass);
@ -55,7 +55,6 @@ public class TestReadWriteSplit2 {
arp.setDialect(new PostgreSqlDialect()); arp.setDialect(new PostgreSqlDialect());
arp.start(); arp.start();
String sql = "truncate table test"; String sql = "truncate table test";
Db.update(sql); Db.update(sql);

Loading…
Cancel
Save