When creating a configuration, it was found that Urlparser could not find it, so only the configuration file could be used, but it was more intuitive to use the configuration file than to initialize it with the URL.
New Configuration ( "localhost", 3306, "root", = Some ("123" ), = Some ("test") )
The configuration file itself is case class, and its code is
Case classConfiguration (username:string, host:string="localhost", Port:int=5432, password:option[string]=None, database:option[string]=None, Charset:charset=Configuration.defaultcharset, Maximummessagesize:int=16777216, Allocator:abstractbytebufallocator=Pooledbytebufallocator.default, Connecttimeout:duration=5. seconds, Testtimeout:duration=5. seconds)
It reminds me of slick,slick I can't even get a configuration file. Always feel that the design of slick some anti-human.
For single-Connection
def sinconnection:mysqlconnection = { = configurationwithpassword new Mysqlconnection (configuration) }
For thread pool connections
def poolconnection:connectionpool[mysqlconnection] = { = configurationpool New mysqlconnectionfactory (configuration) val pool new connectionpool[ Mysqlconnection] (factory, Poolconfiguration.default) pool }
ResultSet is not a java.sql.resultSet but a new type created by the author himself.
Trait ResultSet extends Indexseq[rowdata]
The rowdata represents a row of data and is also a sequential table
Trait RowData extends Indexedseq[any]
So, ResultSet is like a two-dimensional watch.
MySQL Asyn combat