Welcome Guest, Not a member yet? Register   Sign In
Codeigniter and mssql
#1

[eluser]boblacaster[/eluser]
Hi
Am working on a project that requires me to connect to a mssql database using codeigniter 2.0. Any ideas on how i could do that would be gladly appreciated.

Regards
boblacaster
#2

[eluser]Krystian[/eluser]
can you provide some code?
what ver. of MSSql SRV do you have?
#3

[eluser]boblacaster[/eluser]
mssql server version 10.50.1600.1 2008 64-bit

here is the /config/database.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');


$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'adax';
$db['default']['dbdriver'] = 'mssql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
#4

[eluser]Krystian[/eluser]
what message occurs?
please check ports on sql srv. Default id 1433, maybe yours is different?

Do the CI logs provide any clues?

read this, maybe it helps
http://randomzeros.com/?p=21
#5

[eluser]boblacaster[/eluser]
Hi

I get the error message

unable to connect to your database server using the provided settings

Here are the new settings i used;

$db[‘default’][‘hostname’] = ‘brian-PC\sqlexpress’;
$db[‘default’][‘username’] = ‘brian-PC\brian’;
$db[‘default’][‘password’] = ‘’;
$db[‘default’][‘database’] = ‘adax’;
$db[‘default’][‘dbdriver’] = ‘mssql’
#6

[eluser]Unknown[/eluser]
Here are the settings I used for my dev environment, I believe you need to specify an actual user on the database for it to work:

Code:
$db['default']['hostname'] = '.\SQLEXPRESS';
$db['default']['username'] = 'user';
$db['default']['password'] = 'pw';
$db['default']['database'] = 'db';
$db['default']['dbdriver'] = 'mssql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
#7

[eluser]boblacaster[/eluser]
hi got it to connect but when i try to login into a webpage it times out
#8

[eluser]Old Fashion[/eluser]
@boblacaster

are you connected remotely ?
#9

[eluser]boblacaster[/eluser]
yes am connecting remotely and using windows server 2003.Accessing the url generates the home page[loging in]
then after entering the required credentials it times out.




Theme © iAndrew 2016 - Forum software by © MyBB