Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
Source Code for Connector/J 8.0.31 - Core API
Where to get the Java source code for Connector/J 8.0 Core API module?
✍: FYIcenter.com
Java source code files for Connector/J 8.0 Core API module are:
⏎ com/mysql/cj/protocol/Protocol.java
/* * Copyright (c) 2015, 2022, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License, version 2.0, as published by the * Free Software Foundation. * * This program is also distributed with certain software (including but not * limited to OpenSSL) that is licensed under separate terms, as designated in a * particular file or component or in included license documentation. The * authors of MySQL hereby grant you an additional permission to link the * program and your derivative works with the separately licensed software that * they have included with MySQL. * * Without limiting anything contained in the foregoing, this file, which is * part of MySQL Connector/J, is also subject to the Universal FOSS Exception, * version 1.0, a copy of which can be found at * http://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0, * for more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ package com.mysql.cj.protocol; import java.io.IOException; import java.io.InputStream; import java.util.function.Supplier; import com.mysql.cj.MessageBuilder; import com.mysql.cj.QueryResult; import com.mysql.cj.Session; import com.mysql.cj.TransactionEventHandler; import com.mysql.cj.conf.PropertySet; import com.mysql.cj.exceptions.CJException; import com.mysql.cj.exceptions.ExceptionInterceptor; import com.mysql.cj.protocol.Protocol.ProtocolEventListener.EventType; /** * A protocol provides the facilities to communicate with a MySQL server. * * @param <M> * Message type */ public interface Protocol<M extends Message> { /** * Init method takes the place of constructor. * * A constructor should be used unless the encapsulation of ProtocolFactory is necessary. * * @param session * {@link Session} * @param socketConnection * {@link SocketConnection} * @param propertySet * {@link PropertySet} * @param transactionManager * {@link TransactionEventHandler} */ void init(Session session, SocketConnection socketConnection, PropertySet propertySet, TransactionEventHandler transactionManager); PropertySet getPropertySet(); void setPropertySet(PropertySet propertySet); MessageBuilder<M> getMessageBuilder(); /** * Retrieve ServerCapabilities from server. * * @return {@link ServerCapabilities} */ ServerCapabilities readServerCapabilities(); ServerSession getServerSession(); SocketConnection getSocketConnection(); AuthenticationProvider<M> getAuthenticationProvider(); ExceptionInterceptor getExceptionInterceptor(); PacketSentTimeHolder getPacketSentTimeHolder(); void setPacketSentTimeHolder(PacketSentTimeHolder packetSentTimeHolder); PacketReceivedTimeHolder getPacketReceivedTimeHolder(); void setPacketReceivedTimeHolder(PacketReceivedTimeHolder packetReceivedTimeHolder); /** * Create a new session. This generally happens once at the beginning of a connection. * * @param user * DB user name * @param password * DB user password * @param database * database name */ void connect(String user, String password, String database); void negotiateSSLConnection(); void beforeHandshake(); void afterHandshake(); void changeDatabase(String database); /** * Re-authenticates as the given user and password * * @param user * DB user name * @param password * DB user password * @param database * database name * */ void changeUser(String user, String password, String database); boolean versionMeetsMinimum(int major, int minor, int subminor); /** * Read one message from the MySQL server into the reusable buffer if provided or into the new one. * * @param reuse * {@link Message} instance to read into, may be null * @return the message from the server. */ M readMessage(M reuse); /** * Read one message from the MySQL server, checks for errors in it, and if none, * returns the message, ready for reading * * @return a message ready for reading. */ M checkErrorMessage(); /** * @param message * {@link Message} instance * @param packetLen * length of header + payload */ void send(Message message, int packetLen); ColumnDefinition readMetadata(); /** * Send a command to the MySQL server. * * @param queryPacket * a packet pre-loaded with data for the protocol (eg. * from a client-side prepared statement). The first byte of * this packet is the MySQL protocol 'command' from MysqlDefs * @param skipCheck * do not call checkErrorPacket() if true * @param timeoutMillis * timeout * * @return the response packet from the server * * @throws CJException * if an I/O error or SQL error occurs */ M sendCommand(Message queryPacket, boolean skipCheck, int timeoutMillis); <T extends ProtocolEntity> T read(Class<T> requiredClass, ProtocolEntityFactory<T, M> protocolEntityFactory) throws IOException; /** * Read protocol entity. * * @param requiredClass * required Resultset class * @param maxRows * the maximum number of rows to read (-1 means all rows) * @param streamResults * should the driver leave the results on the wire, * and read them only when needed? * @param resultPacket * the first packet of information in the result set * @param isBinaryEncoded * true if the binary protocol is used (for server prepared statements) * @param metadata * use this metadata instead of the one provided on wire * @param protocolEntityFactory * {@link ProtocolEntityFactory} instance * @param <T> * object extending the {@link ProtocolEntity} * @return * {@link ProtocolEntity} instance * @throws IOException * if an error occurs */ <T extends ProtocolEntity> T read(Class<Resultset> requiredClass, int maxRows, boolean streamResults, M resultPacket, boolean isBinaryEncoded, ColumnDefinition metadata, ProtocolEntityFactory<T, M> protocolEntityFactory) throws IOException; /** * Sets an InputStream instance that will be used to send data * to the MySQL server for a "LOAD DATA LOCAL INFILE" statement * rather than a FileInputStream or URLInputStream that represents * the path given as an argument to the statement. * * This stream will be read to completion upon execution of a * "LOAD DATA LOCAL INFILE" statement, and will automatically * be closed by the driver, so it needs to be reset * before each call to execute*() that would cause the MySQL * server to request data to fulfill the request for * "LOAD DATA LOCAL INFILE". * * If this value is set to NULL, the driver will revert to using * a FileInputStream or URLInputStream as required. * * @param stream * input stream */ void setLocalInfileInputStream(InputStream stream); /** * Returns the InputStream instance that will be used to send * data in response to a "LOAD DATA LOCAL INFILE" statement. * * This method returns NULL if no such stream has been set * via setLocalInfileInputStream(). * * @return input stream */ InputStream getLocalInfileInputStream(); /** * Returns the comment that will be prepended to all statements * sent to the server. * * @return query comment string */ String getQueryComment(); /** * Sets the comment that will be prepended to all statements * sent to the server. Do not use slash-star or star-slash tokens * in the comment as these will be added by the driver itself. * * @param comment * query comment string */ void setQueryComment(String comment); /** * Read messages from server and deliver them to resultBuilder. * * @param resultBuilder * {@link ResultBuilder} instance * @param <T> * result type * @return {@link QueryResult} */ <T extends QueryResult> T readQueryResult(ResultBuilder<T> resultBuilder); void close() throws IOException; void configureTimeZone(); void initServerSession(); /** * Return Protocol to its initial state right after successful connect. */ void reset(); String getQueryTimingUnits(); public static interface ProtocolEventListener { public enum EventType { SERVER_SHUTDOWN, SERVER_CLOSED_SESSION; } void handleEvent(EventType type, Object info, Throwable reason); } public static interface ProtocolEventHandler { /** * Add listener for this protocol events. * * @param l * {@link ProtocolEventListener} instance. */ void addListener(ProtocolEventListener l); /** * Remove protocol listener. * * @param l * {@link ProtocolEventListener} instance. */ void removeListener(ProtocolEventListener l); void invokeListeners(EventType type, Throwable reason); } Supplier<ValueEncoder> getValueEncoderSupplier(Object obj); }
⏎ com/mysql/cj/protocol/Protocol.java
Or download all of them as a single archive file:
File name: mysql-connector-java-core-api-8.0.31.zip File size: 309381 bytes Release date: 2022-09-03 Download
⇒ Source Code for Connector/J 8.0.31 - Core Impl
⇐ What Is mysql-connector-j-8.0.31.jar?
2023-05-31, 6249👍, 0💬
Popular Posts:
Jettison is a collection of Java APIs (like STaX and DOM) which read and write JSON. This allows nea...
What Is mail.jar of JavaMail 1.4? I got the JAR file from javamail-1_4.zip. mail.jar in javamail-1_4...
How to download and install JDK (Java Development Kit) 1.4? If you want to write Java applications, ...
Apache Commons Codec library provides implementations of common encoders and decoders such as Base64...
How to download and install ojdbc6.jar for Oracle 11g R2? ojdbc6.jar for Oracle 11g R2 is a Java 6, ...