GeeCON Prague 2014*
The moose likes JDBC and the fly likes How do i setup ODBC  data source for mysql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "How do i setup ODBC  data source for mysql" Watch "How do i setup ODBC  data source for mysql" New topic
Author

How do i setup ODBC data source for mysql

Henry Addo
Greenhorn

Joined: Feb 26, 2005
Posts: 24
I'm writing and application and i want to connect
to mysql server running on my linux box.where can i
get the driver for mysql so i can create the odbc
data source.
Thnx
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30586
    
154

Henry,
WHy don't you want to use the JDBC driver available from mySql? If you really want an ODBC driver, mySql provides those too for many OS's including Linux.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Henry Addo
Greenhorn

Joined: Feb 26, 2005
Posts: 24
Hi
Thanks i will use jdbc driver
Henry Addo
Greenhorn

Joined: Feb 26, 2005
Posts: 24
Hi
I java jdbc driver for mysql please
how do i use it to connect to mysql
server. I mean i how do i install it
so i can load the class. I'm newbie
in jdbc so please help me. Thanks
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30586
    
154

Henry,
The driver comes with excellent online documentation. Try following the steps and then post to this thread if you get stuck on one of them. (If you reference the step #, people will be able to give more detailed help.)
Henry Addo
Greenhorn

Joined: Feb 26, 2005
Posts: 24
Hi
I have seen the link to the online documentation thanks
i will read it then figure out how to use it.but i will let
you know when i i'm stuck. I normally don't reply to the post
quiet early because i don't have constant internet connections.
please bear with me.thanks once again i'm grateful
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30586
    
154

Henry,
No problem. Do post if you get stuck.
Henry Addo
Greenhorn

Joined: Feb 26, 2005
Posts: 24
Hi
when i load the drive i get error.This is what i have done.
I unzip the my-connect-java-3.1.8.zip into /usr/local/share.
then copied all the jar files in the lib directory of my-connect-java-3.1.8
directory to ext directory of the sun-j2sdk1.5.0. I'm on a linux box.
Then i loaded the driver in my code but when i try to add values to my table which i have created already, l get error and is because the driver is not loaded. This is what i have done.

when i run the code i get these errors
JDBC ERROR
com.mysql.jdbc.Driver
then
Connection error
No suitable driver
I got know to how to load the driver from the documentation.Please what have i done wrong.Once again thank, i preciate every bit of help you are giving me.

[ April 22, 2005: Message edited by: Henry Addo ]
[ April 22, 2005: Message edited by: Henry Addo ]
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30586
    
154

Henry,
Did you explicitly add the jar files to your classpath? Not being able to load the driver is usually a classpath problem.

I recommend putting the code in one big try/catch block, like this.

If you can't load the driver, you don't really want to continue trying to execute the SQL. You already know it will fail.
Henry Addo
Greenhorn

Joined: Feb 26, 2005
Posts: 24
I have set the jar files to class path but
i still get the same error.
Want i did was, copied the com and org directory
into the into a directory that i created named bins
then set the path to the bins directory in the
mysql-connect3.1.8 directory. The way i set the path
export PATH=${PATH}${MYSQLCONNECTJAVA_HOME}/bins
and i still get the same error.What i'm i doing
wrong.?
[ April 27, 2005: Message edited by: Henry Addo ]
 
GeeCON Prague 2014
 
subject: How do i setup ODBC data source for mysql