Mysql Connector/J; Overview Of Mysql Connector/J; Connector/J Versions - Oracle 5.0 Reference Manual

Table of Contents

Advertisement

}
}
}

20.3. MySQL Connector/J

This section explains how to configure and develop Java applications with MySQL Connector/J, the
JDBC driver that is integrated with MySQL.
For release notes detailing the changes in each release of Connector/J, see
Release
Notes.

20.3.1. Overview of MySQL Connector/J

MySQL provides connectivity for client applications developed in the Java programming language
through a JDBC driver, which is called MySQL Connector/J.
MySQL Connector/J is a JDBC Type 4 driver. Different versions are available that are compatible with
the JDBC 3.0 and JDBC 4.0 specifications. The Type 4 designation means that the driver is a pure
Java implementation of the MySQL protocol and does not rely on the MySQL client libraries.
For large-scale programs that use common design patterns of data access, consider using one of the
popular persistence frameworks such as Hibernate,
reduce the amount of JDBC code for you to debug, tune, secure, and maintain.
Key Topics
• For help with connection strings, connection options, and setting up your connection through JDBC,
see
Section 20.3.5.1, "Driver/Datasource Class Names, URL Syntax and Configuration Properties for
Connector/J".

20.3.2. Connector/J Versions

There are currently four versions of MySQL Connector/J available:
MySqlCommandBuilder cb = new MySqlCommandBuilder(da);
MySqlCommand cmd = new MySqlCommand();
cmd.Connection = conn;
cmd.CommandText = sql;
// use Cloned object to avoid .NET rebuilding the object, and
// thereby throwing away our command text additions.
MySqlCommand insertCmd = cb.GetInsertCommand().Clone();
insertCmd.CommandText = insertCmd.CommandText + ";SELECT last_insert_id() AS id";
insertCmd.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
da.InsertCommand = insertCmd;
cb.DataAdapter = null; // Unhook RowUpdating event handler
DataTable dt = new DataTable();
da.Fill(dt);
DataRow row = dt.NewRow();
row["name"] = "Joe Smith";
dt.Rows.Add(row);
da.Update(dt);
System.Console.WriteLine("ID after update: " + row["id"]);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
conn.Close();
Console.WriteLine("Done.");
MySQL Connector/J
Spring's JDBC templates
2047
MySQL Connector/J
or
Ibatis SQL Maps
to

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 5.0 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Mysql 5.0

Table of Contents