[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-users] MyODBC/UnixODBC On Cobalt RAQ4



Hello all,

I am having major issues with setting this up. I will start from the
beginning.

The project I am working on requires me to take an MS-Access Database, and
on a scheduled basis have MySQL pull the information from the Access
database (testing.mdb) into MySQL.

Both the MySQL database, and the MS-Access Database have identical tables.

The server I am running on is a Cobalt RAQ4, running PHP4 and MySQL 3.23.54

The MS-Access Database is uploaded on to this server, and MUST be converted
on this server. Accessing the location where the testing.mdb file comes from
is not an option.

So...

After doing some research, I had our server guy install UnixODBC and MyODBC
to the server, and rebuild PHP with UnixODBC enabled.

Since then I have been trying to configure the ODBC.ini and ODBCINST.ini
files so that there is a DSN for the MS-Access Database, and that the code
in PHP will actually ODBC_Connect to the testing.mdb database.

I am coming down to the wire on this project and still haven't been able to
get this to work. So I am hoping someone there might have some insight into
what is going wrong. File Configs and Source Code is listed below.

Thank you in advance,

Phil



----- THE ERROR MESSAGE DISPLAYED

Warning: SQL error: [unixODBC][Driver Manager]Data source name not found,
and no default driver specified, SQL state IM002 in SQLConnect in
/home/sites/home/web/test.php on line 3
no connection to testing

----odbc.ini


[Microsoft Access]
Description = Microsoft Access
Driver = MyODBC
Database =/home/sites/home/web/testing.mdb
Servername = localhost
UserName =
Password =
Port = 5432


----odbcinst.ini
# Example driver definitinions
#
#

# Included in the unixODBC package
[PostgreSQL]
Description     = ODBC for PostgreSQL
Driver          = /usr/lib/libodbcpsql.so
Setup           = /usr/lib/libodbcpsqlS.so
FileUsage       = 1


# From the MyODBC package
#[MySQL]
#Description    = ODBC for MySQL
#Driver         = /usr/lib/libmyodbc.so
#FileUsage      = 1


[UnixODBC]
Description     = Unix ODBC drivers
Driver          = /usr/lib/libmyodbc.so
Setup           =
FileUsage       = 1
CPTimeout       =
CPReuse         =


# Added By Support
[MyODBC]
Description     = My ODBC drivers
Driver          = /usr/lib/libmyodbc-2.50.39.so
Setup           =
FileUsage       = 1
CPTimeout       =
CPReuse         =

----test.php

<?php

$dsn = "testing";
$user="";
$pass="";
$db="testing.mdb";
   $odbc = odbc_connect('$dsn','$user','$pass') or die ("no connection to
$dsn");
   $mysql = mysql_connect('localhost','phil','phil');
   mysql_select_db ('testing', $mysql);
   mysql_query('delete from testing');
   $sql = "select * from testing";
   $res = odbc_exec($odbc, $sql);
   while (odbc_fetch_into($res,$row)) {
   $flds = "'" . join("','" , $row) . "'";
   $res1 = mysql_query("INSERT INTO testing VALUES ($flds)");
    }
?>


--
Phillip Blancher
Ontario Web
http://www.ontarioweb.ca
phil@xxxxxxxxxxxxx


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.516 / Virus Database: 313 - Release Date: 9/1/2003