Connector-odbc or Connector-java ?

C

carmelo

Hi everybody,
I need to develop a java app which have to connect to a remote mysql
db. Which one between Connector-odbc and Connector-java should I use?


Thank you very much in advance
 
R

Roland de Ruiter

Hi everybody,
I need to develop a java app which have to connect to a remote mysql
db. Which one between Connector-odbc and Connector-java should I use?


Thank you very much in advance

Use Connector/J. It's the most concise way to connect to a MySQL
database using JDBC.

Connector/ODBC would allow you to connect to a MySQL using the ODBC. For
a Java application you then could use the JDBC-ODBC bridge, but that
would be "a bridge too far".

<http://dev.mysql.com/usingmysql/java/>
<http://www.mysql.com/products/connector/j/>
 
R

Roland de Ruiter

Measurably?

Sure. In a project I was involved a couple of years ago, direct JDBC
proved to be faster than going through the JDBC-ODBC bridge.
 
A

Arne Vajhøj

carmelo said:
I need to develop a java app which have to connect to a remote mysql
db. Which one between Connector-odbc and Connector-java should I use?

Connector/J is much better.

The JDBC-ODBC bridge has serious bugs in multithreaded apps.

ODBC is very hard to troubleshoot due to cryptic error messages.

It will perform better.

Arne
 
C

carmelo

Connector/J is much better.

The JDBC-ODBC bridge has serious bugs in multithreaded apps.

ODBC is very hard to troubleshoot due to cryptic error messages.

It will perform better.

Arne

Ok, thank you guys!
 
A

Arne Vajhøj

Lew said:
Measurably?

Interesting question.

I expected it to be very significant.

But for the fun of it I tried creating a small test
program.

The results were:

MySQL Connector/J:
INSERT 10000 rows: 1828 milliseconds
SELECT 10000 rows 50 times: 1797 milliseconds
SELECT 1 row 10000 times: 2453 milliseconds
JDBC ODBC bridge:
INSERT 10000 rows: 1781 milliseconds
SELECT 10000 rows 50 times: 5641 milliseconds
SELECT 1 row 10000 times: 3031 milliseconds
MySQL Connector/J:
INSERT 10000 rows: 1656 milliseconds
SELECT 10000 rows 50 times: 1609 milliseconds
SELECT 1 row 10000 times: 2000 milliseconds
JDBC ODBC bridge:
INSERT 10000 rows: 1656 milliseconds
SELECT 10000 rows 50 times: 5609 milliseconds
SELECT 1 row 10000 times: 2891 milliseconds
MySQL Connector/J:
INSERT 10000 rows: 1625 milliseconds
SELECT 10000 rows 50 times: 1578 milliseconds
SELECT 1 row 10000 times: 2000 milliseconds
JDBC ODBC bridge:
INSERT 10000 rows: 1625 milliseconds
SELECT 10000 rows 50 times: 5609 milliseconds
SELECT 1 row 10000 times: 2735 milliseconds

For this particular test program with my versions of the
drivers and my version of MySQL it seems as if:
- INSERT is the same speed
- SELECT is 50%-250% slower
with JDBC-ODBC bridge.

Measurable !!

Arne
 
R

Roland de Ruiter

So if you measured it, how much was the difference?
IIRC, JDBC-ODBC bridge was about 20%-25% slower. We reused connections
(i.e. connection pooling) and the project involved data retrieval only,
i.e. it only used SELECT statements, no INSERTs or UPDATEs.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top