• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HELP: db-connection settings for ODBC to MSSQL

#4
[eluser]falloutphil[/eluser]
Hi,

Firstly - just stick your ODBC DSN into the 'hostname' - google to find the right format.

Then crucially you're using 1.6 (and perhaps in other versions - I don't know), there is a problem with the odbc driver meaning no type of odbc connection will work. You need to make an edit to odbc_driver.php as follows at around line 44 (depending on version):

function CI_DB_odbc_driver($params)
{
parent::CI_DB($params); <---- PUT THIS LINE IN
$this->_random_keyword = ' RND('.time().')'; // database specific random keyword
}

When the constructor was added no explict call was made to the parent to pass back the connection parameters, meaning no data to set up the connection with.
Someone has reported this:
http://codeigniter.com/bug_tracker/bug/3374/

It's a simple fix so I reckon the developers will fix it for the next minor release.

Don't get your hopes up too much tho - having fixed this I cannot get scaffolding or active records to work via odbc. I'm using Sybase under the bonnet so couldn't comment if this will affect other db users:

This now works:
$this->db->query("SELECT * FROM Cycle");

But this doesn't:
$this->db->get('Cycle');

An Error Was Encountered

Error Number: 42000

[DataDirect][ODBC Sybase Wire Protocol driver][SQL Server]Incorrect syntax near '`'.

SELECT COUNT(*) AS `numrows` FROM `Cycle`


Hope this helps,

Phil.


Messages In This Thread
HELP: db-connection settings for ODBC to MSSQL - by El Forum - 02-01-2008, 02:05 AM
HELP: db-connection settings for ODBC to MSSQL - by El Forum - 02-01-2008, 04:02 AM
HELP: db-connection settings for ODBC to MSSQL - by El Forum - 02-01-2008, 04:19 AM
HELP: db-connection settings for ODBC to MSSQL - by El Forum - 02-10-2008, 05:39 PM
HELP: db-connection settings for ODBC to MSSQL - by El Forum - 02-10-2008, 10:47 PM
HELP: db-connection settings for ODBC to MSSQL - by El Forum - 02-10-2008, 11:58 PM
HELP: db-connection settings for ODBC to MSSQL - by El Forum - 02-11-2008, 12:15 AM
HELP: db-connection settings for ODBC to MSSQL - by El Forum - 05-12-2008, 07:11 AM
HELP: db-connection settings for ODBC to MSSQL - by El Forum - 05-29-2009, 01:17 AM
HELP: db-connection settings for ODBC to MSSQL - by El Forum - 03-24-2010, 12:30 PM
HELP: db-connection settings for ODBC to MSSQL - by El Forum - 03-25-2010, 06:45 PM
HELP: db-connection settings for ODBC to MSSQL - by El Forum - 09-26-2010, 11:30 PM
HELP: db-connection settings for ODBC to MSSQL - by El Forum - 03-08-2012, 03:52 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.