Сервер GRIDDB был настроен на использование FIXER_LIST вместо многоадресной рассылки и функционирует правильно. В то время как образцы C_Client и Java в GRIDDB работают в зависимости от того, что образцы для JDBC не работают.
GRIDDB Конфигурации: < /p>
conf/gs_cluster.json:
{
"dataStore":{
"partitionNum":128,
"storeBlockSize":"64KB"
},
"cluster":{
"clusterName":"cluster1",
"replicationNum":2,
"notificationInterval":"5s",
"heartbeatInterval":"5s",
"loadbalanceCheckInterval":"180s",
"notificationMember" : [
{
"cluster": {"address": "127.0.0.1", "port": 10010},
"sync": {"address": "127.0.0.1", "port": 10020},
"system": {"address": "127.0.0.1", "port": 10040},
"transaction": {"address": "127.0.0.1", "port": 10001},
"sql": {"address": "127.0.0.1", "port": 20001}
},
{
"cluster": {"address": "127.0.0.2", "port": 10010},
"sync": {"address": "127.0.0.2", "port": 10020},
"system": {"address": "127.0.0.2", "port": 10040},
"transaction": {"address": "127.0.0.2", "port": 10001},
"sql": {"address": "127.0.0.2", "port": 20001}
},
]
},
}
< /code>
conf/repository.json:
{
"clusters":[
"name" : "cluster1",
"mode" : "FIXED_LIST"
]
}
< /code>
Minimal reproducible code sample:
import java.net.URLEncoder;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;
public class JDBCSelect {
public static void main(String[] args){
try {
//===============================================
// Connecting to a cluster
//===============================================
// Connection information of JDBC
String jdbcAddress = "127.0.0.2";
String jdbcPort = "10001";
String clusterName = "cluster1";
String databaseName = "public";
String username = "admin";
String password = "admin";
String applicationName = "SampleJDBC";
// Encoding a cluster name and a database name
String encodeClusterName = URLEncoder.encode(clusterName, "UTF-8");
String encodeDatabaseName = URLEncoder.encode(databaseName, "UTF-8");
// Creating a URL (Multicast method)
String jdbcUrl = "jdbc:gs://"+jdbcAddress+":"+jdbcPort+"/"+encodeClusterName+"/"+encodeDatabaseName;
Properties prop = new Properties();
prop.setProperty("user", username);
prop.setProperty("password", password);
prop.setProperty("applicationName", applicationName);
// Connecting
Connection con = DriverManager.getConnection(jdbcUrl, prop);
//===============================================
// Creating a container and registering data
//===============================================
{
Statement stmt = con.createStatement();
// (Delete the container if it already exists)
stmt.executeUpdate("DROP TABLE IF EXISTS SampleJDBC_Select");
// Creating a container
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS SampleJDBC_Select ( id integer PRIMARY KEY, value string )");
System.out.println("SQL Create Table name=SampleJDBC_Select");
// Registering a row
int ret1 = stmt.executeUpdate("INSERT INTO SampleJDBC_Select values "+
"(0, 'test0'),(1, 'test1'),(2, 'test2'),(3, 'test3'),(4, 'test4')");
System.out.println("SQL Insert count=" + ret1);
stmt.close();
}
//===============================================
// Executing a search
//===============================================
// (1) Creating a statement
Statement stmt = con.createStatement();
// (2) Executing a SQL command
ResultSet rs = stmt.executeQuery("SELECT * from SampleJDBC_Select where ID > 2");
// (3) Getting a result
while( rs.next() ){
int id = rs.getInt(1);
String value = rs.getString(2);
System.out.println("SQL row(id=" + id + ", value=" + value + ")");
}
//===============================================
// Terminating process
//===============================================
stmt.close();
con.close();
System.out.println("success!");
} catch ( Exception e ){
e.printStackTrace();
}
}
}
< /code>
ERROR:
java.sql.SQLException: [10054:TXN_CLIENT_VERSION_NOT_ACCEPTABLE] (connectClientVersion=-9,serverVersion=15) (address=127.0.0.2:10001, partitionId=0)
< /code>
Based on a prior encounter with this error, the issue is likely related to the GridDB server's FIXED_LIST configuration. While the c_client and native Java samples for GridDB are functioning correctly, the Java Database Connectivity (JDBC) samples are not. I suppose there is a need to update the java sample from multicast to fixed list but don't know how. All java samples are using multicast and jdbc driver repo didn't mention any settings there too.
Although took a guess and tried adding a parameter for notificationMember but that didn't worked either.
//prop.setProperty("notificationMember", "127.0.0.2:10001")
java.sql.SQLException: [10054:JDBC_ILLEGAL_PARAMETER] Notification property and other network address can not specified at the same time (uri=gs://127.0.0.2:10001/cluster1/public, notificationMember=127.0.0.2:10001, otherAdress=[/127.0.0.2:10001])
< /code>
I suppose this needs to be fixed but not sure how?
// Creating a URL (Multicast method)
String jdbcUrl = "jdbc:gs://"+jdbcAddress+":"+jdbcPort+"/"+encodeClusterName+"/"+encodeDatabaseName;
Подробнее здесь: https://stackoverflow.com/questions/797 ... dbc-driver
Как использовать Fixed_list вместо многоадресной рассылки в Griddb с помощью драйвера JDBC ⇐ JAVA
Программисты JAVA общаются здесь
1759080167
Anonymous
Сервер GRIDDB был настроен на использование FIXER_LIST вместо многоадресной рассылки и функционирует правильно. В то время как образцы C_Client и Java в GRIDDB работают в зависимости от того, что образцы для JDBC не работают.
GRIDDB Конфигурации: < /p>
conf/gs_cluster.json:
{
"dataStore":{
"partitionNum":128,
"storeBlockSize":"64KB"
},
"cluster":{
"clusterName":"cluster1",
"replicationNum":2,
"notificationInterval":"5s",
"heartbeatInterval":"5s",
"loadbalanceCheckInterval":"180s",
"notificationMember" : [
{
"cluster": {"address": "127.0.0.1", "port": 10010},
"sync": {"address": "127.0.0.1", "port": 10020},
"system": {"address": "127.0.0.1", "port": 10040},
"transaction": {"address": "127.0.0.1", "port": 10001},
"sql": {"address": "127.0.0.1", "port": 20001}
},
{
"cluster": {"address": "127.0.0.2", "port": 10010},
"sync": {"address": "127.0.0.2", "port": 10020},
"system": {"address": "127.0.0.2", "port": 10040},
"transaction": {"address": "127.0.0.2", "port": 10001},
"sql": {"address": "127.0.0.2", "port": 20001}
},
]
},
}
< /code>
conf/repository.json:
{
"clusters":[
"name" : "cluster1",
"mode" : "FIXED_LIST"
]
}
< /code>
Minimal reproducible code sample:
import java.net.URLEncoder;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;
public class JDBCSelect {
public static void main(String[] args){
try {
//===============================================
// Connecting to a cluster
//===============================================
// Connection information of JDBC
String jdbcAddress = "127.0.0.2";
String jdbcPort = "10001";
String clusterName = "cluster1";
String databaseName = "public";
String username = "admin";
String password = "admin";
String applicationName = "SampleJDBC";
// Encoding a cluster name and a database name
String encodeClusterName = URLEncoder.encode(clusterName, "UTF-8");
String encodeDatabaseName = URLEncoder.encode(databaseName, "UTF-8");
// Creating a URL (Multicast method)
String jdbcUrl = "jdbc:gs://"+jdbcAddress+":"+jdbcPort+"/"+encodeClusterName+"/"+encodeDatabaseName;
Properties prop = new Properties();
prop.setProperty("user", username);
prop.setProperty("password", password);
prop.setProperty("applicationName", applicationName);
// Connecting
Connection con = DriverManager.getConnection(jdbcUrl, prop);
//===============================================
// Creating a container and registering data
//===============================================
{
Statement stmt = con.createStatement();
// (Delete the container if it already exists)
stmt.executeUpdate("DROP TABLE IF EXISTS SampleJDBC_Select");
// Creating a container
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS SampleJDBC_Select ( id integer PRIMARY KEY, value string )");
System.out.println("SQL Create Table name=SampleJDBC_Select");
// Registering a row
int ret1 = stmt.executeUpdate("INSERT INTO SampleJDBC_Select values "+
"(0, 'test0'),(1, 'test1'),(2, 'test2'),(3, 'test3'),(4, 'test4')");
System.out.println("SQL Insert count=" + ret1);
stmt.close();
}
//===============================================
// Executing a search
//===============================================
// (1) Creating a statement
Statement stmt = con.createStatement();
// (2) Executing a SQL command
ResultSet rs = stmt.executeQuery("SELECT * from SampleJDBC_Select where ID > 2");
// (3) Getting a result
while( rs.next() ){
int id = rs.getInt(1);
String value = rs.getString(2);
System.out.println("SQL row(id=" + id + ", value=" + value + ")");
}
//===============================================
// Terminating process
//===============================================
stmt.close();
con.close();
System.out.println("success!");
} catch ( Exception e ){
e.printStackTrace();
}
}
}
< /code>
[b]ERROR:[/b]
java.sql.SQLException: [10054:TXN_CLIENT_VERSION_NOT_ACCEPTABLE] (connectClientVersion=-9,serverVersion=15) (address=127.0.0.2:10001, partitionId=0)
< /code>
Based on a prior encounter with this error, the issue is likely related to the GridDB server's FIXED_LIST configuration. While the c_client and native Java samples for GridDB are functioning correctly, the Java Database Connectivity (JDBC) samples are not. I suppose there is a need to update the java sample from multicast to fixed list but don't know how. All java samples are using multicast and jdbc driver repo didn't mention any settings there too.
Although took a guess and tried adding a parameter for notificationMember but that didn't worked either.
//prop.setProperty("notificationMember", "127.0.0.2:10001")
java.sql.SQLException: [10054:JDBC_ILLEGAL_PARAMETER] Notification property and other network address can not specified at the same time (uri=gs://127.0.0.2:10001/cluster1/public, notificationMember=127.0.0.2:10001, otherAdress=[/127.0.0.2:10001])
< /code>
I suppose this needs to be fixed but not sure how?
// Creating a URL (Multicast method)
String jdbcUrl = "jdbc:gs://"+jdbcAddress+":"+jdbcPort+"/"+encodeClusterName+"/"+encodeDatabaseName;
Подробнее здесь: [url]https://stackoverflow.com/questions/79777322/how-to-use-fixed-list-instead-of-multicast-in-griddb-using-jdbc-driver[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия