@@ -49,6 +49,17 @@ To compile and run tests, execute the following Maven command:
49
49
``` bash
50
50
mvn clean package
51
51
```
52
+
53
+ #### Some considerations about running tests
54
+
55
+ If for some reason the tests using DataStax Enterprise server (` *DseContainerTest ` ) fail in your local environment, you
56
+ might disable them using the Maven profile ` disableDseTests ` :
57
+ ``` bash
58
+ mvn clean package -PdisableDseTests
59
+ ```
60
+
61
+ The test suite also includes integration tests with AstraDB (` DbaasAstraIntegrationTest ` ). These tests require an
62
+ AstraDB token configured in the environment variable ` ASTRA_DB_APPLICATION_TOKEN ` , otherwise they are skipped.
52
63
53
64
### Integration in Maven projects
54
65
@@ -265,8 +276,11 @@ For further information about custom implementations of `SslEngineFactory`, see
265
276
266
277
### Connecting to DBaaS
267
278
268
- In order to connect to the cloud [ Cassandra-based DBaaS AstraDB] ( https://www.datastax.com/astra ) cluster, one would
269
- need to specify:
279
+ An alternative JDBC driver based on this one exists to ease the connection to the cloud
280
+ [ Cassandra-based DBaaS AstraDB] ( https://www.datastax.com/astra ) cluster:
281
+ [ Astra JDBC driver] ( https://github.com/DataStax-Examples/astra-jdbc-connector/tree/main ) . Do not hesitate to use it if you are in this specific situation.
282
+
283
+ It's still possible to connect to AstraDB using this JDBC wrapper, so one would need to specify:
270
284
* ` secureconnectbundle ` : the fully qualified path of the cloud secure connect bundle file
271
285
* ` keyspace ` : the keyspace to connect to
272
286
* ` user ` : the username
@@ -352,14 +366,16 @@ CREATE TABLE example_table (
352
366
varint_col varint,
353
367
string_set_col set<text>,
354
368
string_list_col list<text>,
355
- string_map_col map<text, text>
369
+ string_map_col map<text, text>,
370
+ vector_col vector<float, 5>
356
371
);
357
372
```
358
373
359
374
To insert a record into ` example_table ` using a prepared statement:
360
375
361
376
``` java
362
377
import com.datastax.oss.driver.api.core.data.CqlDuration ;
378
+ import com.datastax.oss.driver.api.core.data.CqlVector ;
363
379
364
380
import java.io.ByteArrayInputStream ;
365
381
import java.sql.Date ;
@@ -370,8 +386,8 @@ public class HelloCassandra {
370
386
final String insertCql = " INSERT INTO example_table (bigint_col, ascii_col, blob_col, boolean_col, decimal_col, "
371
387
+ " double_col, float_col, inet_col, int_col, smallint_col, text_col, timestamp_col, time_col, date_col, "
372
388
+ " tinyint_col, duration_col, uuid_col, timeuuid_col, varchar_col, varint_col, string_set_col, "
373
- + " string_list_col, string_map_col) "
374
- + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, now(), ?, ?, ?, ?, ?);" ;
389
+ + " string_list_col, string_map_col, vector_col ) "
390
+ + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, now(), ?, ?, ?, ?, ?, ? );" ;
375
391
final PreparedStatement preparedStatement = connection. prepareStatement(insertCql);
376
392
preparedStatement. setObject(1 , 1L ); // bigint
377
393
preparedStatement. setObject(2 , " test" ); // ascii
@@ -401,14 +417,16 @@ public class HelloCassandra {
401
417
sampleSet. add(" test1" );
402
418
sampleSet. add(" test2" );
403
419
preparedStatement. setObject(20 , sampleSet); // set
404
- ArrayList<String > sampleList = new ArrayList<String > ();
420
+ final ArrayList<String > sampleList = new ArrayList<String > ();
405
421
sampleList. add(" test1" );
406
422
sampleList. add(" test2" );
407
423
preparedStatement. setObject(21 , sampleList); // list
408
- HashMap<String , String > sampleMap = new HashMap<String , String > ();
424
+ final HashMap<String , String > sampleMap = new HashMap<String , String > ();
409
425
sampleMap. put(" 1" , " test1" );
410
426
sampleMap. put(" 2" , " test2" );
411
427
preparedStatement. setObject(22 , sampleMap); // map
428
+ final CqlVector<Float > sampleVector = CqlVector . newInstance(1.0f , 0.0f , 1.0f , 0.5f , 0.2f );
429
+ preparedStatement. setObject(23 , sampleVector); // vector
412
430
// Execute the prepare statement.
413
431
preparedStatement. execute();
414
432
}
@@ -696,6 +714,7 @@ We use [SemVer](http://semver.org/) for versioning.
696
714
* Madhavan Sridharan - ** [ @msmygit ] ( https://github.com/msmygit ) **
697
715
* Marius Jokubauskas - ** [ @mjok ] ( https://github.com/mjok ) **
698
716
* Sualeh Fatehi - ** [ @sualeh ] ( https://github.com/sualeh ) **
717
+ * Cedrick Lunven - ** [ @clun ] ( https://github.com/clun ) **
699
718
700
719
And special thanks to the developer of the original project on which is based this one:
701
720
* Alexander Dejanovski - ** [ @adejanovski ] ( https://github.com/adejanovski ) **
0 commit comments