Welcome Guest, Not a member yet? Register   Sign In
Dynamic DSN issue
#1

[eluser]=G-Man=[/eluser]
Hello again, Im having a strange issue with my dynamic DSN that im using here. Basicly i call from the main Database thats setup in the config.php to retrieve the DSN to another SQL Server to use for the actual output of the page. everything seems to be working but i don't know if something is escaping wrong, or if I'm just blind. The result of the following code results in this error in the logs
Quote:Severity: Warning --> mssql_select_db() : message: Could not locate entry in sysdatabases for database 'QL1'. No entry found with that name. Make sure that the name is entered correctly. (severity 16) C:\...\mssql_driver.php 75
Severity: Warning --> mssql_select_db() : Unable to select database: QL1\SQLEXPRESS C:\...\mssql_driver.php 75
Unable to select database: QL1\SQLEXPRESS
Severity: Warning --> mssql_query() : message: Invalid object name 'user_data'. (severity 16) C:\...\mssql_driver.php 106
Severity: Warning --> mssql_query() : Query failed C:\...\mssql_driver.php 106

the problem i see is 2.
1) its looking for the DB QL1, that should be the server name (well SQL1)
2) It cut off the S from SQL1 (the server name).

now the DSN stored in the DB is mssql://user:password@SQL1\SQLEXPRESS/lin2worldCT1

user:pass are just masks, they are right in the DB.

Any ideas on why its doing this?

here is the code that does all the magic

Code:
function index()
    {
        $this->db->select("db_dsn");
        $dsn = $this->db->get_where("admin_servers", array("id" => $this->session->userdata("server")));
        
        if ($dsn->num_rows() > 0)
        {
            $row = $dsn->row();
            $server = $this->load->database($row->db_dsn, TRUE);
        }
                
        $server->select("char_name, char_id, account_id, class, lev, gender, race, use_time");
        $server->where("login >", "logout");
        $server->order_by("use_time", "desc");
        
        $data['query']      = $server->get("user_data");
        $data['player_count'] = $server->count_all_results()-1;
        
        $this->load->view('character/CharOnline_view', $data);
    }

Thanks in advance.
#2

[eluser]=G-Man=[/eluser]
This is starting to look like a bug, just for kicks. i hard coded the DSN and i get the same errors

Code:
$server = $this->load->database("mssql://user:pass@SQL1\SQLEXPRESS/lin2worldCT1", TRUE);

still trying to connect to the DB QL1
#3

[eluser]=G-Man=[/eluser]
All is good, seems to have been the bug posted here

http://ellislab.com/forums/viewthread/79949/




Theme © iAndrew 2016 - Forum software by © MyBB