How to configure ODBC for MySQL

Asked by vor_paul@yahoo.it

Hi,
after more years that in UBUNTU I use ODBC to connnect my java stuff whit some DB ( MYSQL, IBM DB2 ) , in the last time I'm not more able to do this.
When in UBUNTU I try to run one of this java pgm, by console or by NETBEANS, I receive this messages:

danilo@danilo-HP-Pavilion-dv7-Notebook-PC:~/GENEALOGIA/LANCIO$ ./lancioG.sh 2
Exception in thread "main" java.lang.NullPointerException
   at sun.jdbc.odbc.JdbcOdbcDriver.initialize(JdbcOdbcDriver.java:436)
   at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:153)
   at java.sql.DriverManager.getConnection(DriverManager.java:582)
   at java.sql.DriverManager.getConnection(DriverManager.java:185)
   at Hl.HlGestfiles.Seturl(HlGestfiles.java:568)
   at Hl.HlGestfiles.<init>(HlGestfiles.java:60)
   at genealogia.preparaAlbero.preparaAlbero(preparaAlbero.java:84)
   at genealogia.preparaAlbero.main(preparaAlbero.java:508)

This same java pgm in W7 is executed properly.

into the file ~/.odbc.ini ther is ( for MySQL):

[miosql]
Description      = mysql
Driver      = MySQL
Server      = localhost
Database      = miosql
Port      =
Socket      =
Option      =
Stmt      =

into the file /etc/odbcinst.ini ther is ( for MySQL):

MySQL]
Description      = drv mysql
Driver      = /usr/lib/odbc/libmyodbc.so
Driver64      = /usr/lib
Setup      = /usr/lib/odbc/libodbcmyS.so
Setup64      = /usr/lib
UsageCount      = 1
CPTimeout      =
CPReuse      =

into the file /etc/odbc.ini ther is ( for MySQL):

[miosql]
Description      = MySQL
Driver      = MySQL
Server      = localhost
Database      = miosql
Port      = 3306
Socket      =
Option      = 4
Stmt      =

Can anyone tell me where I'm wrong?
Thanks in advance
danilo

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#1
Revision history for this message
vor_paul@yahoo.it (vor-paul) said :
#2

thanks,
 but this does not solve my problem.

I use (and I've always used) ODBC standard (unixodbc) from Ubuntu:

danilo@danilo-HP-Pavilion-dv7-Notebook-PC:~$ odbcinst --version
unixODBC 2.2.14

danilo@danilo-HP-Pavilion-dv7-Notebook-PC:~$ odbcinst -j
unixODBC 2.2.14
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /home/danilo/.odbc.ini
SQLULEN Size.......: 4
SQLLEN Size........: 4
SQLSETPOSIROW Size.: 2

danilo@danilo-HP-Pavilion-dv7-Notebook-PC:~$ odbcinst -q -s
[miosql]
[mioAS]
[AStestPL]
[ASprodPL]
danilo@danilo-HP-Pavilion-dv7-Notebook-PC:~$ [sqlserver]
[sqlserver]: comando non trovato

I tryed to test the connection, like suggested in the answer, and all is OK:

danilo@danilo-HP-Pavilion-dv7-Notebook-PC:~$ isql -v miosql root yyyy
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> quit
danilo@danilo-HP-Pavilion-dv7-Notebook-PC:~$ isql -v AStestPL xxxx yyyy
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> quit

Can you help with this problem?

Provide an answer of your own, or ask vor_paul@yahoo.it for more information if necessary.

To post a message you must log in.