Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

MS SQL Server 2005 kein zugriff auf die Datenbank

Empfohlene Antworten

Veröffentlicht

Hallo,

ich connecte per ODBC über php auf einen MS SQL Server 2005.

Nun bekomme ich folgende Fehlermeldung:

Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC SQL Server Driver]

[SQL Server]Die von der Anmeldung angeforderte "xyz_testdb"-Datenbank kann nicht geöffnet werden. Fehler bei der Anmeldung., SQL state 37000 in SQLConnect in C:\Programme\xampp\htdocs\xyz_testdb_new\index.php on line 40


Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in C:\Programme\xampp\htdocs\xyz_testdb_new\index.php on line 46

Warning: mssql_fetch_row(): supplied argument is not a valid MS SQL-result resource in C:\Programme\xampp\htdocs\xyz_testdb_new\index.php on line 51

Warning: odbc_close(): supplied argument is not a valid ODBC-Link resource in C:\Programme\xampp\htdocs\xyz_testdb_new\index.php on line 59





der angewandte code lautet:


<?php

$connect = odbc_connect("test_db", "", "");


$query = "SELECT office_id, office_version, service_pack FROM office";


$result = odbc_exec($connect, $query);




while(mssql_fetch_row($result)){

  $office_id = mssql_result($result, 1);

  $office_version = mssql_result($result, 2);

  $service_pack = mssql_result($result, 3);

  echo "$office_id \n";

}


odbc_close($connect);

?>

also die datenbank heißt im SQL 2005 "inventar_db", die tabelle "office" und die ODBC System-DSN lautet: "test_db". Ich nutze die NT-Authentifizierung und habe auch in der php.ini: mssql.secure_connection = On gesetzt. phpinfo() spuckt mir folgendes aus:

ODBC Support enabled 

Active Persistent Links  0  

Active Links  0  

ODBC library  Win32  


Directive Local Value Master Value 

odbc.allow_persistent On On 

odbc.check_persistent On On 

odbc.default_db no value no value 

odbc.default_pw no value no value 

odbc.default_user no value no value 

odbc.defaultbinmode return as is return as is 

odbc.defaultlrl return up to 4096 bytes return up to 4096 bytes 

odbc.max_links Unlimited Unlimited 

odbc.max_persistent Unlimited Unlimited 


odbc.default_db no value no value <-- ich glaube das ist der entscheidene wert für meine gepostete Fehlermeldung. Aber wo und wie richte ich es ein?

In den ODBC einstellungen habe ich ja eigentlich schon die Datenbank mit angegeben die er für die verbindung nutzen soll.

wenn noch irgendwelche fragen sind, dann fragt!!! ich plage mich schon seit tagen mit dem problem rum :/

thx schonmal

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.