I'm having a Java class and I'm really new to Database Connectivity.. My professor and everyone else on this class use Windows and an Access Database, and I'm the only one using GNU/Linux
with a MYSQL Database
.
Now as you know Windows programmers use ODBC
, but as I searched, I got that it's only for windows. I found a Unix/Linux ODBC
from easysoft but it doesn't support MYSQL
Is there any Open-Source ODBC
you know of that supports MYSQL?
Moreover how should I use this Driver in java?
Couldn't find neither a documentation nor a tutorial for GNU/Linux..
Asked
Active
Viewed 4,496 times
1

geekybedouin
- 549
- 1
- 11
- 23
3 Answers
2
Just install MySQL Connectors from this link
Code to connect to mysql via jdbc :
import java.lang.*;
import java.sql.*;
public class Demo {
public static void main(String[] args){
try{
Connection conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/test?" + "user=test&password=123456");
}catch(SQLException ex){
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
}catch(Exception ex){
System.out.println("Exception: " + ex.getMessage());
}
}
}

Up_One
- 5,213
- 3
- 33
- 65
1
MySQL provides both ODBC and JDBC drivers. Check their web site. Documentation is also provided.

Jess Balint
- 1,667
- 13
- 9
0
Don't worry about ODBC drivers. You just need the MySQL JDBC driver.
https://dev.mysql.com/downloads/connector/j/
Here is also some info on setting up the connection:

Community
- 1
- 1

Roy Gabbard
- 11
- 3