Symptom
You start the Data Transfer Workbench (DTW), select a company and connect. The connection fails with:
Connection to HDB@[host]:[port] has failed. Error Code: 306. The specified resource name cannot be found in the image file.The DI API logs show messages such as:
SLDClient::GetCompanyKeyAndKeyState OData Exception code:1302 message NOT find dynamic key by given ID <ID>followed by -8037 (failed to connect or log on to SLD), -4009 (failed to connect to SLD) or Extension Property not found in SLD.
Service Layer may fail for the same company with HTTP Status: 500, error code -306 and an empty message.
Typical signs:
- Only one or a few company databases are affected. Others on the same server connect normally.
- The error stays even after you restore the database into another environment.
Cause
The company database refers to a dynamic key (CINF.DKeyId) that does not exist in the System Landscape Directory (SLD). At the same time, the dynamic key is disabled in the SLD (CURRENT_DKEY_ID is empty). This orphaned reference usually appears after a company database is restored or moved between environments.
Who is affected
All of the following must apply:
- You use SAP Business One or SAP Business One, version for SAP HANA.
- DTW or Service Layer cannot connect to a specific company with error 306.
- The checks below show an orphaned dynamic key.
Solution
Work on the affected company only, and take a backup first.
- Check the dynamic key.
- In the company database:
select "DKeyId" from CINF; - In the SLD database:
select Current_Dkey_Id from CompanyDBs;andselect * from DKeys; - Continue only if
Current_Dkey_Idis empty andCINF.DKeyIdis filled but not listed inDKeys.
- Back up the CINF table.
- SQL Server:
SELECT * INTO CINF_BACKUP_ FROM CINF; - SAP HANA:
CREATE TABLE CINF_BACKUP_ AS (SELECT * FROM CINF);
- Clear the orphaned reference in
CINF.DKeyId. This is a direct change to a system table. Make it only after the checks and the backup above, and only in the affected company. - Restart the SLD service.
- Windows: restart SAP Business One System Landscape Directory in
services.msc, or runnet stop "SAP Business One System Landscape Directory"followed bynet start "SAP Business One System Landscape Directory". - Linux:
systemctl restart sapb1servertools-group.target
- Test DTW. Start the Data Transfer Workbench, refresh the company list, select the company, enter your credentials and connect.
The same steps also fix error -306 in Service Layer.
For other SLD connection errors, see SAP Business One error -4009: cannot reach the SLD.
Confirm the result
- DTW connects to the company without error 306.
- A Service Layer login to the same company succeeds.
- The SAP Business One client still logs on to the company normally.