From: Luca C. <jo...@ti...> - 2003-12-16 12:36:33
|
Hello All, I've got a web server based on linux redhat9 and a windows2000 machine with and mdb access2000 file which i would like to query from the linux machine. So I installed unixODBC 2.2.5 and mdbtools from these rpm packets: mdbtools-0.5-1.i386.rpm mdbtools-odbc-0.5-1.i386.rpm Now I've mounted the windows directory with the mdb file via samba so I've the mdb file in /home/lc/be.mdb. here is my odbc.ini and odbcinst.ini. ===CUT================================= [lc@einstein lc]$ cat /etc/odbc.ini [prova] Description = Microsoft cazzi Driver = MDBToolsODBC Database = /home/lc/be.mdb Servername = localhost UserName = Password = port = 5432 [lc@einstein lc]$ cat /etc/odbcinst.ini [PostgreSQL] Description = ODBC for PostgreSQL Driver = /usr/lib/libodbcpsql.so Setup = /usr/lib/libodbcpsqlS.so FileUsage = 1 [MDBToolsODBC] Description = MDB Tools ODBC drivers Driver = /usr/lib/libmdbodbc.so.0 Setup = FileUsage = 1 CPTimeout = CPReuse = =================================================== If I try mdb-sql it works fine and I can query tables on the mdb file; but if I try to connect to the source via odbc using OpenOffice Data source it doesn't work. OpenOffice finds the odbc source but can't read it. Here is a java code written to test the odbc connection. This code works fine on a windows machine with the same odbc source configured but it doesn't on my linux box ?? Anyone can help please? I'm going crazy!!! Regards Luca Cervasio ======CUT test.java ===================== import java.sql.*; class test { public static void main (String args[]) { try { Connection conn = null; Statement st = null; ResultSet rs = null; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); conn = DriverManager.getConnection("jdbc:odbc:prova"); st = conn.createStatement(); rs = st.executeQuery("select * from tblarticolo"); rs.close(); st.close(); conn.close(); System.out.println("GREAT it works!"); } catch (Exception e) { System.out.println("it doesn't works..."); } } } |