Re: com.mysql.jdbc.UpdatableResultSet.updateBlob gives AbstractMethodError
- From: Arne Vajhøj <arne@xxxxxxxxxx>
- Date: Thu, 04 Oct 2007 21:38:17 -0400
Lew wrote:
pjvleeuwen@xxxxxxxxx wrote:public static void main(String[] args)...
throws MalformedURLException,
IOException, SQLException {
// write to DB
Connection con = null;
try {
Class
.forName(
"com.mysql.jdbc.Driver")
.newInstance();
Why are you creating a throwaway instance here?
That is a common practice when loading the MySQL JDBC
driver.
My guess is that some very old version of the driver
registered itself with DriverManager in the constructor,
so that it was necessary.
It is not necessary today and has not been for many years,
but you will see that code all the time.
The MySQL docs even use it even though they blame Java:
<quote>
Example 3.1. Registering the Driver With the DriverManager
The following section of Java code shows how you might register MySQL Connector/J from the main() method of your application.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
// Notice, do not import com.mysql.jdbc.*
// or you will have problems!
public class LoadDriver {
public static void main(String[] args) {
try {
// The newInstance() call is a work around for some
// broken Java implementations
Class.forName("com.mysql.jdbc.Driver").newInstance();
} catch (Exception ex) {
// handle the error
}
</quote>
Arne
.
- References:
- com.mysql.jdbc.UpdatableResultSet.updateBlob gives AbstractMethodError
- From: pjvleeuwen@xxxxxxxxx
- Re: com.mysql.jdbc.UpdatableResultSet.updateBlob gives AbstractMethodError
- From: David Harper
- Re: com.mysql.jdbc.UpdatableResultSet.updateBlob gives AbstractMethodError
- From: pjvleeuwen@xxxxxxxxx
- Re: com.mysql.jdbc.UpdatableResultSet.updateBlob gives AbstractMethodError
- From: David Harper
- Re: com.mysql.jdbc.UpdatableResultSet.updateBlob gives AbstractMethodError
- From: pjvleeuwen@xxxxxxxxx
- Re: com.mysql.jdbc.UpdatableResultSet.updateBlob gives AbstractMethodError
- From: Lew
- com.mysql.jdbc.UpdatableResultSet.updateBlob gives AbstractMethodError
- Prev by Date: Binding table with backened bean in JSF
- Next by Date: Re: Searching CLOBs through Hibernate
- Previous by thread: Re: com.mysql.jdbc.UpdatableResultSet.updateBlob gives AbstractMethodError
- Next by thread: Re: com.mysql.jdbc.UpdatableResultSet.updateBlob gives AbstractMethodError
- Index(es):
Relevant Pages
|