i have extraordinary project. project use codeigniter, use vendor laravel. now, want change database connection. i've tried change in application\config\database.php :
<?php defined('basepath') or exit('no direct script access allowed'); /* | ------------------------------------------------------------------- | database connectivity settings | ------------------------------------------------------------------- | file contain settings needed access database. | | complete instructions please consult 'database connection' | page of user guide. | | ------------------------------------------------------------------- | explanation of variables | ------------------------------------------------------------------- | | ['dsn'] full dsn string describe connection database. | ['hostname'] hostname of database server. | ['username'] username used connect database | ['password'] password used connect database | ['database'] name of database want connect | ['dbdriver'] database driver. e.g.: mysqli. | supported: | cubrid, ibase, mssql, mysql, mysqli, oci8, | odbc, pdo, postgre, sqlite, sqlite3, sqlsrv | ['dbprefix'] can add optional prefix, added | table name when using query builder class | ['pconnect'] true/false - whether use persistent connection | ['db_debug'] true/false - whether database errors should displayed. | ['cache_on'] true/false - enables/disables query caching | ['cachedir'] path folder cache files should stored | ['char_set'] character set used in communicating database | ['dbcollat'] character collation used in communicating database | note: mysql , mysqli databases, setting used | backup if server running php < 5.2.3 or mysql < 5.0.7 | (and in table creation queries made db forge). | there incompatibility in php mysql_real_escape_string() | can make site vulnerable sql injection if using | multi-byte character set , running versions lower these. | sites using latin-1 or utf-8 database character set , collation unaffected. | ['swap_pre'] default table prefix should swapped dbprefix | ['encrypt'] whether or not use encrypted connection. | | 'mysql' (deprecated), 'sqlsrv' , 'pdo/sqlsrv' drivers accept true/false | 'mysqli' , 'pdo/mysql' drivers accept array following options: | | 'ssl_key' - path private key file | 'ssl_cert' - path public key certificate file | 'ssl_ca' - path certificate authority file | 'ssl_capath' - path directory containing trusted ca certificats in pem format | 'ssl_cipher' - list of *allowed* ciphers used encryption, separated colons (':') | 'ssl_verify' - true/false; whether verify server certificate or not ('mysqli' only) | | ['compress'] whether or not use client compression (mysql only) | ['stricton'] true/false - forces 'strict mode' connections | - ensuring strict sql while developing | ['ssl_options'] used set various ssl options can used when making ssl connections. | ['failover'] array - array 0 or more data connections if main should fail. | ['save_queries'] true/false - whether "save" executed queries. | note: disabling disable both | $this->db->last_query() , profiling of db queries. | when run query, setting set true (default), | codeigniter store sql statement debugging purposes. | however, may cause high memory usage, if run | lot of sql queries ... disable avoid problem. | | $active_group variable lets choose connection group | make active. default there 1 group (the 'default' group). | | $query_builder variables lets determine whether or not load | query builder class. */ $active_group = 'default'; $query_builder = true; $db['default'] = array( 'dsn' => '', 'hostname' => 'localhost', 'username' => 'root', 'password' => 'root', 'database' => 'dbhell', 'dbdriver' => 'mysqli', 'dbprefix' => '', 'pconnect' => false, 'db_debug' => (environment !== 'production'), 'cache_on' => false, 'cachedir' => '', 'char_set' => 'utf8', 'dbcollat' => 'utf8_general_ci', 'swap_pre' => '', 'encrypt' => false, 'compress' => false, 'stricton' => false, 'failover' => array(), 'save_queries' => true, ); $db['sqlsrv'] = array( 'dsn' => '', 'hostname' => '127.0.0.1', 'username' => 'sa', 'password' => 'wh4tth3h3ll', 'database' => 'dbhell', 'dbdriver' => 'sqlsrv', 'dbprefix' => '', 'pconnect' => false, 'db_debug' => (environment !== 'production'), 'cache_on' => false, 'cachedir' => '', 'char_set' => 'utf8', 'dbcollat' => 'utf8_general_ci', 'swap_pre' => '', 'encrypt' => false, 'compress' => false, 'stricton' => false, 'failover' => array(), 'save_queries' => true, ); $db['integra']['hostname'] = '10.200.41.41'; $db['integra']['username'] = 'hell'; $db['integra']['password'] = 'test'; $db['integra']['database'] = 'gate'; $db['integra']['dbdriver'] = 'mssql'; $db['integra']['dbprefix'] = ''; $db['integra']['pconnect'] = false; $db['integra']['db_debug'] = true; $db['integra']['cache_on'] = false; $db['integra']['cachedir'] = ''; $db['integra']['char_set'] = 'utf8'; $db['integra']['dbcollat'] = 'utf8_general_ci'; $db['integra']['swap_pre'] = ''; $db['integra']['autoinit'] = true; $db['integra']['stricton'] = false;
but says error :
an uncaught exception encountered type: pdoexception message: sqlstate[08001]: [microsoft][odbc driver 11 sql server]named pipes provider: not open connection sql server [53]. filename: c:\wamp\www\sedia\vendor\illuminate\database\connectors\connector.php line number: 55 backtrace: file: c:\wamp\www\sedia\vendor\illuminate\database\connectors\connector.php line: 55 function: __construct file: c:\wamp\www\sedia\vendor\illuminate\database\connectors\sqlserverconnector.php line: 32 function: createconnection file: c:\wamp\www\sedia\vendor\illuminate\database\connectors\connectionfactory.php line: 60 function: connect file: c:\wamp\www\sedia\vendor\illuminate\database\connectors\connectionfactory.php line: 49 function: createsingleconnection file: c:\wamp\www\sedia\vendor\illuminate\database\databasemanager.php line: 175 function: make file: c:\wamp\www\sedia\vendor\illuminate\database\databasemanager.php line: 67 function: makeconnection file: c:\wamp\www\sedia\vendor\illuminate\database\eloquent\model.php line: 3286 function: connection file: c:\wamp\www\sedia\vendor\illuminate\database\eloquent\model.php line: 3252 function: resolveconnection file: c:\wamp\www\sedia\vendor\illuminate\database\eloquent\model.php line: 1932 function: getconnection file: c:\wamp\www\sedia\vendor\illuminate\database\eloquent\model.php line: 1875 function: newbasequerybuilder file: c:\wamp\www\sedia\vendor\illuminate\database\eloquent\model.php line: 1849 function: newquerywithoutscopes file: c:\wamp\www\sedia\vendor\illuminate\database\eloquent\model.php line: 3497 function: newquery file: c:\wamp\www\sedia\vendor\illuminate\database\eloquent\model.php line: 3513 function: call_user_func_array file: c:\wamp\www\sedia\application\controllers\homecontroller.php line: 40 function: __callstatic file: c:\wamp\www\sedia\application\controllers\homecontroller.php line: 40 function: file: c:\wamp\www\sedia\index.php line: 280 function: require_once
please me :(
your problem might server or db credentials. if not, check out article https://support.microsoft.com/en-us/kb/195566
Comments
Post a Comment