开发者

Specifying TCP protocol in JDBC to mysql connection

开发者 https://www.devze.com 2023-03-13 12:54 出处:网络
How do you specify that the JDBC connection to mysql in the typical line DriverManager.getConnection(u开发者_运维百科rl, username, password);

How do you specify that the JDBC connection to mysql in the typical line

DriverManager.getConnection(u开发者_运维百科rl, username, password);

is via TCP?

Thanks


As far as I know, TCP will be the underlying protocol despite the nature of the driver used. Unlike Derby or HSQLDB, MySQL does not support (at the time of writing this) any form of databases that operate in an embedded mode.

All connections made to the database for the purpose of executing SQL statements, made by the driver happen to be TCP connections.


Just use a JDBC type 3 or 4 driver.

Even more, as far as I know, all MySQL JDBC drivers are type 3/4 already.


is this what you are looking for?

DriverManager.getConnection("jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8", username, password);
0

精彩评论

暂无评论...
验证码 换一张
取 消