aspose file tools*
The moose likes JDBC and the fly likes Connecting MySql through ODBC drivers in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connecting MySql through ODBC drivers in java" Watch "Connecting MySql through ODBC drivers in java" New topic
Author

Connecting MySql through ODBC drivers in java

asim satti
Greenhorn

Joined: Nov 10, 2012
Posts: 11

hi,
i want to connect mysql using odbc driver without creating datasource. can this be possible to connect mysql database using odbc driver wihout using data source
if yes then please help me. thanks in advance
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3433
    
  47

Don't use ODBC. Use ConnectorJ, MySQL's own JDBC type 4 driver. It is written in pure Java and - unlike ODBC - doesn't need any setup on the machine it is used on. Furthermore, the JDBC-ODBC bridge has some specific problems. You should use ODBC only when an alternative doesn't exist.

It should be possible to google ConnectorJ easily.
asim satti
Greenhorn

Joined: Nov 10, 2012
Posts: 11

actually i want to know that if i use odbc driver to connect with mysql, is it necessary to create a data source for it, or i can connect without datasource
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3433
    
  47

Yes, you need to create a data source. After all, this is what ODBC is all about. There are several ways to set up a datasource (system, user, file etc.) and some of them might be easier than others.

Why do you want to use ODBC, against the official recommendation, instead of the MySQL native driver? It should be pretty easy to switch to ConnectorJ, if you're lucky, you need to change just the connection URL.

(You should also note that ODBC support will be removed from Java 8.)
asim satti
Greenhorn

Joined: Nov 10, 2012
Posts: 11

ok i got it thanks for help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Connecting MySql through ODBC drivers in java
 
Similar Threads
How to connect MySQL to Java program?
How to rollback multiple prepared statements
Windows 2003 ODBC error code 126
Need Suggestion
Connecting Java Application with a Database