`JdbcAspect.getConnection` will execute `SELECT USER()` every time
See original GitHub issueI find the getConnection()
method is slower than expected.
So I check the source code:
public Object getConnection(final ProceedingJoinPoint pjp) throws Throwable {
Connection conn = (Connection) pjp.proceed();
String url = conn.getMetaData().getURL();
String user = conn.getMetaData().getUserName();
String dbType;
boolean withActiveSpanOnly = false;
try {
dbType = url.split(":")[1];
} catch (Throwable t) {
throw new IllegalArgumentException(
"Invalid JDBC URL. Expected to find the database type after the first ':'. URL: " + url);
}
return new TracingConnection(conn, dbType, user, withActiveSpanOnly);
}
For this line: String user = conn.getMetaData().getUserName();
mysql-connector-java
will execute SELECT USER()
every time.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:9 (8 by maintainers)
Top Results From Across the Web
"select user()" is executed before every SQL - Stack Overflow
i make my best to find the answer: why "select user()" is executed before every SQLs. i try two way to create dataSource,...
Read more >JDBC - a short guide - Marco Behler
You can use this guide to learn the basics of JDBC: How to connect to any database and execute SQL queries.
Read more >30 Application Continuity for Java - Oracle Help Center
You can use both oracle.jdbc.replay. ... The callback is executed every time when both of the following happen: A connection is borrowed from...
Read more >MySQL programming in Java with JDBC - ZetCode
We will use this database throughout the tutorial. ... The executeQuery() method of the connection object executes the given SQL statement, ...
Read more >4.22 Troubleshooting Problems Connecting to MySQL
To find out where the socket file is, you can use this command: ... from the client machine, use a SELECT USER() query...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@pavolloffay please help me to review the pr
Ok, i’ll try to fix it within a few days