Difference between revisions of "Nsodbc"

From AOLserver Wiki
Jump to navigation Jump to search
(imported from WiKit id 136)
 
m (category link fixup, formatting tweaks)
 
Line 1: Line 1:
nsodbc is an internal DB driver for AOLserver that enables you to connect to databases that have an ODBC driver using an ODBC manager and the nsodbc module.
+
'''nsodbc''' is an internal DB driver for AOLserver that enables you to connect to databases that have an ODBC driver using an ODBC manager and the nsodbc module.
  
 
[[Dossy]]:  I have gotten AOLserver 4.x on Debian Linux (sid) to work with nsodbc connecting to MySQL using unixODBC as the ODBC manager and MyODBC as the ODBC driver.  Specific versions of interest for folks looking to do similar:
 
[[Dossy]]:  I have gotten AOLserver 4.x on Debian Linux (sid) to work with nsodbc connecting to MySQL using unixODBC as the ODBC manager and MyODBC as the ODBC driver.  Specific versions of interest for folks looking to do similar:
 +
 
* Linux ecwav 2.4.20 #1 Sat May 24 08:47:33 EDT 2003 i686 GNU/Linux [http://www.debian.org/]
 
* Linux ecwav 2.4.20 #1 Sat May 24 08:47:33 EDT 2003 i686 GNU/Linux [http://www.debian.org/]
 
* AOLserver 4.1.0 (CVS HEAD as of 14mar2004) [http://www.aolserver.com/]
 
* AOLserver 4.1.0 (CVS HEAD as of 14mar2004) [http://www.aolserver.com/]
Line 10: Line 11:
  
 
The nsodbc module requires minor changes (which should be committed to CVS soon) but until then, the patch is available here:
 
The nsodbc module requires minor changes (which should be committed to CVS soon) but until then, the patch is available here:
 +
 
* http://panoptic.com/nsodbc-patch.txt
 
* http://panoptic.com/nsodbc-patch.txt
  
Line 36: Line 38:
 
'''/usr/etc/odbcinst.ini'''
 
'''/usr/etc/odbcinst.ini'''
  
   [[ODBC]]
+
<pre>
 +
   [ODBC]
 
   Trace          = off
 
   Trace          = off
 
   TraceFile      = /tmp/sql.log
 
   TraceFile      = /tmp/sql.log
 
    
 
    
   [[myodbc]]
+
   [myodbc]
 
   Description    = MySQL ODBC 2.50 Driver DSN
 
   Description    = MySQL ODBC 2.50 Driver DSN
 
   Driver          = /usr/lib/libmyodbc.so
 
   Driver          = /usr/lib/libmyodbc.so
Line 46: Line 49:
 
   FileUsage      = 1
 
   FileUsage      = 1
 
    
 
    
   [[myodbc3]]
+
   [myodbc3]
 
   Description    = MySQL ODBC 3.51 Driver
 
   Description    = MySQL ODBC 3.51 Driver
 
   Driver          = /usr/lib/libmyodbc3.so
 
   Driver          = /usr/lib/libmyodbc3.so
 
   Setup          = /usr/lib/libodbcmyS.so
 
   Setup          = /usr/lib/libodbcmyS.so
 
   FileUsage      = 1
 
   FileUsage      = 1
 +
</pre>
  
 
'''/usr/etc/odbc.ini'''
 
'''/usr/etc/odbc.ini'''
  
   [[ODBC Data Sources]]
+
<pre>
 +
   [ODBC Data Sources]
 
   MySQL-test=MySQL test database
 
   MySQL-test=MySQL test database
 
    
 
    
   [[MySQL-test]]
+
   [MySQL-test]
 
   Description = MySQL test database
 
   Description = MySQL test database
 
   Trace      = off
 
   Trace      = off
Line 69: Line 74:
 
   Option      = 3
 
   Option      = 3
 
   Socket      =  
 
   Socket      =  
 +
</pre>
 
    
 
    
 
[ '''N.B.''': I really DID leave the ''Password'' field blank in the odbc.ini.  Also, if you specify ''Server'' as "localhost" and ''Socket'' as empty, it still tries to connect using the Unix socket based off the default in libmysqlclient instead of via TCP.  The only way I could get it to do TCP was to specify ''Server'' as an IP address and not a hostname.  I probably spent two hours trying to figure out why it refused to connect via TCP until I discovered this. ]
 
[ '''N.B.''': I really DID leave the ''Password'' field blank in the odbc.ini.  Also, if you specify ''Server'' as "localhost" and ''Socket'' as empty, it still tries to connect using the Unix socket based off the default in libmysqlclient instead of via TCP.  The only way I could get it to do TCP was to specify ''Server'' as an IP address and not a hostname.  I probably spent two hours trying to figure out why it refused to connect via TCP until I discovered this. ]
Line 74: Line 80:
 
'''init.tcl''' (only the relevant excerpt here)
 
'''init.tcl''' (only the relevant excerpt here)
  
 +
<pre>
 
   ns_section "ns/db/drivers"
 
   ns_section "ns/db/drivers"
 
   ns_param odbc        nsodbc.so
 
   ns_param odbc        nsodbc.so
Line 88: Line 95:
 
   ns_param logsqlerrors on
 
   ns_param logsqlerrors on
 
   ns_param verbose      on
 
   ns_param verbose      on
 +
</pre>
 +
 +
[[Category:Documentation]]
 +
[[Category:Modules]]

Latest revision as of 17:29, 7 October 2005

nsodbc is an internal DB driver for AOLserver that enables you to connect to databases that have an ODBC driver using an ODBC manager and the nsodbc module.

Dossy: I have gotten AOLserver 4.x on Debian Linux (sid) to work with nsodbc connecting to MySQL using unixODBC as the ODBC manager and MyODBC as the ODBC driver. Specific versions of interest for folks looking to do similar:

  • Linux ecwav 2.4.20 #1 Sat May 24 08:47:33 EDT 2003 i686 GNU/Linux [1]
  • AOLserver 4.1.0 (CVS HEAD as of 14mar2004) [2]
  • nsodbc (CVS HEAD as of 14mar2004) [3]
  • unixODBC 2.2.8 [4]
  • MyODBC 3.51.06 [5]
  • MySQL 3.23.49 [6]

The nsodbc module requires minor changes (which should be committed to CVS soon) but until then, the patch is available here:


Specifically, here's how I built unixODBC and MyODBC and nsodbc:

unixODBC

 $ ./configure --prefix=/usr

MyODBC

 $ ./configure --prefix=/usr --enable-thread-safe --with-unixODBC=/usr --with-debug \
     --with-mysql-libs=/usr/lib --with-mysql-includes=/usr/include/mysql \
     --with-odbc-ini=/usr/etc/odbc.ini

nsodbc

 $ make ODBC=/usr/lib

Here are what my configuration files look like:

/usr/etc/odbcinst.ini

  [ODBC]
  Trace           = off
  TraceFile       = /tmp/sql.log
  
  [myodbc]
  Description     = MySQL ODBC 2.50 Driver DSN
  Driver          = /usr/lib/libmyodbc.so
  Setup           = /usr/lib/libodbcmyS.so
  FileUsage       = 1
  
  [myodbc3]
  Description     = MySQL ODBC 3.51 Driver
  Driver          = /usr/lib/libmyodbc3.so
  Setup           = /usr/lib/libodbcmyS.so
  FileUsage       = 1

/usr/etc/odbc.ini

  [ODBC Data Sources]
  MySQL-test=MySQL test database
  
  [MySQL-test]
  Description = MySQL test database
  Trace       = off
  TraceFile   = /tmp/sql.log
  Driver      = myodbc3
  Server      = 127.0.0.1
  Port        = 3306
  User        = dossy
  Password    = 
  Database    = dossy
  Option      = 3
  Socket      = 

[ N.B.: I really DID leave the Password field blank in the odbc.ini. Also, if you specify Server as "localhost" and Socket as empty, it still tries to connect using the Unix socket based off the default in libmysqlclient instead of via TCP. The only way I could get it to do TCP was to specify Server as an IP address and not a hostname. I probably spent two hours trying to figure out why it refused to connect via TCP until I discovered this. ]

init.tcl (only the relevant excerpt here)

  ns_section "ns/db/drivers"
  ns_param odbc         nsodbc.so

  ns_section "ns/db/pools"
  ns_param dossyodbcdb    "Dossy's MySQL-test ODBC pool"

  ns_section "ns/db/pool/dossyodbcdb"
  ns_param driver       odbc
  ns_param connections  1
  ns_param user         dossy
  ns_param password     $password
  ns_param datasource   MySQL-test
  ns_param logsqlerrors on
  ns_param verbose      on