Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems connecting between JDBC and ODBC

Status
Not open for further replies.

Ziggurat

Programmer
Jun 6, 2001
81
GB
Dear All

I don't think that this message has been asked before but if it has my apologies.

I have a linux machine set up with MySQL, and I would like to connec to the database using Java

I have already connected to the database using the [mysql-connector-java-3.0.9-stable-bin.jar] but I would like to connect using ODBC.

I tested that mysql was running

I have modified the ini files
odbcinst.ini
[MySQL]
Description = ODBC for MySQL
Driver =/usr/libg/libmyodbc.so
FileUsage =1

odbc.ini
[Mic]
Description =MySQL database test
Driver =MySQL
Server =localhost
Database =test
Port =3306

I then tested using :-
isql Mic

and it was OK.

but when I tried to run a java program to test the connection, It failed on the line
Connection con = DriverManager.getConnection("jdbc:eek:dbc:Mic");

throwing a NullPointerException.

I found a similar question to the one that I am asking in the MySQL mailing list
(Nov 28 2002)

but the answer was using a different connection.

Any suggestions ?




#
###
#####
#######
Ziggurat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top