Link to home
Start Free TrialLog in
Avatar of ANIL BABU Mandla
ANIL BABU Mandla

asked on

LDAP Query : 80040e37|Table_does_not_exist.

LDAP Query : Table does not exist.
Hi all : thanks for taking the time to read my question.  I need some assistance with a strange LDAP issue.

ERROR: |80040e37|Table_does_not_exist.

We have ldap accessing code in the following format, Some times it's working,but is producing errors like above ERROR

Dim objRootDSE, objCon, objCmd, objRecordSet
Dim strDomainAdsPath
Dim arrMembers
Dim intCount
Dim strmember,strLoggedInUser, strUserStrId, strUserId,blnIsMemberOf, strDomPath,name
response.write strUser + "<BR/>"
Dim ServiceRequest
Dim MagicTicket
ServiceRequest=Request.QueryString("SR")
MagicTicket=Request.QueryString("MT")

	Dim  strPassword, strQuery, oConn, cmd, oRS, Dom, mail,strUsername,firstname,lastname,fullname,URL,PathSAP
	strUserId=""
EMEAUSERNAME = ""
EMEAPASSWORD = ""
Dom="emea"

				Set objRootDSE = GetObject("LDAP://RootDSE")
				strDomainAdsPath = "LDAP://" & objRootDSE.Get("defaultNamingContext")
				response.write strDomainAdsPath + "<BR/>"
				strDomPath=objRootDSE.Get("defaultNamingContext")
				Set objRootDSE = Nothing
				Set objCon = Server.CreateObject("ADODB.Connection")
				objCon.Provider = "ADsDSOObject"
				objCon.Open "ADProvider", EMEAUSERNAME, EMEAPASSWORD
				Set objCmd = Server.CreateObject("ADODB.Command")
				Set objCmd.ActiveConnection = objCon
				'objCmd.CommandText = "Select name,mail,UserPrincipalName from '" & strDomainAdsPath & "' where objectClass='user' and UserPrincipalName ='" & strUserfull & "'"
				objCmd.CommandText = "Select name,mail,UserPrincipalName from '" & strDomainAdsPath & "' where objectClass='user' and sAMAccountName ='" & strUser & "'"

Set objRecordSet = objCmd.Execute

Open in new window


This code working Some times and sometimes i am getting the error like below

ERROR: |80040e37|Table_does_not_exist.

Could you please help me any mistake in my code?
Avatar of ANIL BABU Mandla
ANIL BABU Mandla

ASKER

Hi any one please help me
Avatar of Scott Fell
What line number in the code above is getting the error and what parameters are passed when it works and when it does not?
I am geeting the error this line is  : Set objRecordSet = objCmd.Execute

I find the error in Log file is : 80040e37|Table_does_not_exist

Same code it's working some times and not working some times.

Please see the error i am getting below screen shot

User generated image
objCmd.CommandText = "Select name,mail,UserPrincipalName from '" & strDomainAdsPath & "' where objectClass='user' and sAMAccountName ='" & strUser & "'"

Anything wrong in the above cselect query?
What line number in the code above (the code you posted in your question) is getting the error?
What parameters are passed when it works and when it does not?

The error in your screen shows reads, "A more secure authentication method is required for this server".  This is different than table does not exist.   This article https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/domain-controller-ldap-server-signing-requirements talks about, "If you set the server to Require signature, you must also set the client device. Not setting the client device results in loss of connection with the server."
Thanks for replaying.

I am getting the error after select statement ie: Set objRecordSet = objCmd.Execute

Actually below is the my total code


 
<%@ Language=VBScript %>
<html>
<head>
</head>
<body>
<%
Dim strLogonUser, strUser, Username, actualdomainn
strLogonUser = split(Request.ServerVariables("LOGON_USER"),"\")
strUser = lcase(strLogonUser(1))
'strUser = "XXXXX"
actualdomainn = lcase(strLogonUser(0))
strUserfull = strUser +"@"+actualdomainn +".adsint.biz"
response.write strUser + "<BR/>"
Dim objRootDSE, objCon, objCmd, objRecordSet
Dim strDomainAdsPath
Dim arrMembers
Dim intCount
Dim strmember,strLoggedInUser, strUserStrId, strUserId,blnIsMemberOf, strDomPath,name
response.write strUser + "<BR/>"
Dim ServiceRequest
Dim MagicTicket
ServiceRequest=Request.QueryString("SR")
MagicTicket=Request.QueryString("MT")

	Dim  strPassword, strQuery, oConn, cmd, oRS, Dom, mail,strUsername,firstname,lastname,fullname,URL,PathSAP
	strUserId="XXXXX"
EMEAUSERNAME = "XXXXX"
EMEAPASSWORD = "XXXXX"
Dom="emea"

				Set objRootDSE = GetObject("LDAP://RootDSE")
				strDomainAdsPath = "LDAP://" & objRootDSE.Get("defaultNamingContext")
				response.write strDomainAdsPath + "<BR/>"
				strDomPath=objRootDSE.Get("defaultNamingContext")
				Set objRootDSE = Nothing
				Set objCon = Server.CreateObject("ADODB.Connection")
				objCon.Provider = "ADsDSOObject"
				objCon.Open "ADProvider", EMEAUSERNAME, EMEAPASSWORD
				Set objCmd = Server.CreateObject("ADODB.Command")
				Set objCmd.ActiveConnection = objCon
				objCmd.CommandText = "Select name,mail,UserPrincipalName from '" & strDomainAdsPath & "' where objectClass='user' and sAMAccountName ='" & strUser & "'"

Set objRecordSet = objCmd.Execute
Response.write objRecordSet.recordcount
objRecordSet.MoveFirst
'Response.write objRecordSet.recordcount
'Name=objRecordSet.Fields("DN").value
	Username=objRecordSet.Fields("UserPrincipalName").value
	mail=objRecordSet.Fields("mail").value
	name=objRecordSet.Fields("name").value
	'response.write  mail
	'response.write name
fullname=Split(name,",")
firstname=fullname(0)
lastname=fullname(1)
'response.write firstname
'response.write lastname
dim domainname
domainname=Split(strDomainAdsPath,"=")
dim d
d=domainname(1)
'response.write d
dim domainn
domainn=Split(d,",")
dim actualdomain
actualdomain=domainn(0)
'response.write actualdomain

PathSAP="http://localhost/default.asp?counter=1"
URL=PathSAP + "&emailid=" +  mail +"&SR=" + ServiceRequest +"&Domain=" + actualdomainn +"&MT=" + MagicTicket
'response.write PathSAP
'response.write URL
Response.Redirect(URL)
'response.write strDomainAdsPath
objCon.Close
Set objRecordSet = Nothing
Set objCon = Nothing

%>
</body>
</html>

Open in new window


Without changing the code it's working good some times.

i don't no whats happening :)
Does it depend on whether you are logged on as developer or administrator/ powerusers? Or someone with elevated access rights on this AD?.
AD environments require a Kerberos authentication.
The connection appears to be made over LDAP, is it possible that some Domain Controllers are requiring LDAPS ?

@noci, LDAP connections to AD do not always require kerberos, but it can be configured to require signed connections http://go.microsoft.com/fwlink/?LinkID=87923
Some times working means here is EMEA\user domain working.
Some times not working means here is AP\user domain not working.

Previously it's working ,Last one week on-words not working.

I am using the Windows Server 2008.

Any reason for this ?
I  am believing that there is no mistake in Code(because it's working last week also)?

I find the logs in log file it's showing the error is :|44|80040e37|Table_does_not_exist. 80 AM\userid
I am unable to find out the where the issue exactly?

Please any one help me.

Thanks
Any other way to get after login user we need to the username ,Domain name etc like above code instead of LDAP?

Please help me?
You create an SQL query on ADODB    select Column1,Column2 from TABLE where condition.
TABLE - is the table where the error is about... So can it be the result of the previous failure to obtain the table name .

This fragment would then deliver the wrong name....
Set objRootDSE = GetObject("LDAP://RootDSE")
strDomainAdsPath = "LDAP://" & objRootDSE.Get("defaultNamingContext")

@ArneLovius; if the error is about insufficient privileges then unauthenticated questions won't cut it IMHO.
Hi All,

Any one help me on this issue.
Sometimes it's working without changing any code.

I am unable to find out the reason.

Can any one help me about this issue.
For table does not exist, test which parameter you are passing for strDomainAdsPath.  If it works sometimes and not others, my first guess is you are passing different items to strDomainAdsPath and one of those items is the issue.
Thanks for replaying,
Every time i am passing same values for this strDomainAdsPath.

Below are the actual values

strDomainAdsPath ="LDAP://DC=emea,DC=adsint,DC=biz"
objCmd.CommandText = "SELECT Mail FROM '" &strDomainAdsPath&"' WHERE SAMAccountName = '" & strUser & "'"
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.