You are viewing limited content. For full access, please sign in.

Question

Question

Can't get connection

asked on March 5, 2018

Trying to connect to Laserfiche with my app, but I am receiving the following error. What could be causing it?

Could it be configuration?

 

+        base    {System.Runtime.InteropServices.COMException (0x80040304): The object is not identified, and cannot be locked or read from.
   at LFSO100Lib.ILFDatabase.get_CurrentConnection()}    System.Runtime.InteropServices.ExternalException {System.Runtime.InteropServices.COMException}
 

0 0

Answer

SELECTED ANSWER
replied on March 6, 2018

My thought would be to try a new simple console application to make sure that the COM objects are properly installed and available to your development environment.  Just to see if you can connect to a repository and perhaps create a new document.  That should only take about a dozen or so lines of code...

The credentials you should be using for the connection object are actual Laserfiche user credentials.  i.e one of the user accounts that is created within the Admin Console.

1 0

Replies

replied on March 5, 2018 Show version history

Keith,

Can you share your code?  (At least the portion where you are opening up a connection)

0 0
replied on March 5, 2018

I've attached an image of the code where the issue occurs and the errors below opened up. It is the highlighted line that fails.

Capture.PNG
Capture.PNG (221.55 KB)
0 0
replied on March 5, 2018

So in the line that is failing you are trying to create a reference to the LfVolume but have the LfConnection and LfDatabase been properly instantiated?  Here is a code snippet from the LFSO documentation;

' Creates a new application object.
Dim app As LFApplication = New LFApplication
' Finds the appropriate server.
Dim serv As LFServer = app.GetServerByName("MyLFServer")
' Gets the repository from the server.
Dim db As LFDatabase = _
  serv.GetDatabaseByName("MyRepository")
' Creates a new LFConnection object.
Dim conn As New LFConnection
' Sets the user name and password.
conn.UserName = "myusername"
conn.Password = "mypassword"
' Connects to repository.
conn.Create(db)

  (If you leave the UserName and Password properties empty the connection will try to login using WindowsAuth)

0 0
replied on March 5, 2018

Once the LfDatabase is properly instantiated and connected then you can get a reference to the LfVolume with this code;

LfVolume vol =  db.GetVolumeByName("myVolumeName");
0 0
replied on March 5, 2018

Yes. I have attempted both with and without the username and password. I checked the SQL users and both seem to have the rights to the database. I think it can see the server because when I didn't set it up properly before, I didn't see this error, but I am not sure at all.

0 0
replied on March 5, 2018

A couple of thoughts;

  • How about checking the InnerException property of the Exception error that is being thrown to try and get additional information? 
  • Can you code up a very simple test app using the code snippet from the LFSO documentation to test your connection?

 

BTW - The credentials that you need to supply to the LfConnection object are  Laserfiche user credentials not SQL credentials.  For testing purposes you could use the same credentials that you use to open the Administration Console

0 0
replied on March 6, 2018

I'll try out setting up a test app. The inner exception appears to be the exact same thing. So the credentials should be the same credentials that I use to get my license key?
 

0 0
replied on March 6, 2018

After doing some digging I first discover the COM Exception as the LFDB is being created:

+        CurrentConnection    '((LFSO100Lib.ILFDatabase)(LFDB)).CurrentConnection' threw an exception of type 'System.Runtime.InteropServices.COMException'    LFSO100Lib.LFConnection {System.Runtime.InteropServices.COMException}
 

 

0 0
SELECTED ANSWER
replied on March 6, 2018

My thought would be to try a new simple console application to make sure that the COM objects are properly installed and available to your development environment.  Just to see if you can connect to a repository and perhaps create a new document.  That should only take about a dozen or so lines of code...

The credentials you should be using for the connection object are actual Laserfiche user credentials.  i.e one of the user accounts that is created within the Admin Console.

1 0
replied on March 6, 2018

This helped me. I was using the wrong credentials this entire time. Thank you so much!

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.