Loading ...

Working with UDL (Universal Data Link) files | CodeAsp.Net

 

Comments (8)

Amina
Amina said:

Great info!

8/24/2010
 · 
 
by
Daniel
Daniel said:

Hajan

Having a problem with a UDL file.  I us it to connect to an AS400 Iseries database using the Provider=IBMDA400.DataSource.  It connects fine but it will not save the password.  Already tried "Allow Saving Password" and going into a text editor and changing it there. 

It just does not save the password and the crazy thing is that it only does it on 2 XP machines, on all of the other computers it works fine.  I can copy the file and move it to another machine and it works fine. Every computer is setup with the same AS400 Iseries connection file and running XP using sp3.  I'm stump as to why the UDL file will not save the password and it is a pain to have to type a password in everytime the UDL file is used.

Daniel Borras

Programmer Analysis

 

10/4/2010
 · 
 
by
hajan
Hajan Selmani said:

Hello Daniel,

Honestly, I would not recommend to use the UDL file for saving your connection string. What is good of UDL usage is to create your connection string and verify its working. You can even easily debugging if the connection fails, where it fails and why. However, it saves the connection string in a plain text format so that if you save username/password in it and us it as it is for connecting to your database, its definitely security problem. But, as I've explained in  my blog post, UDLs can be very very useful to construct your connection string so use it only for such purpose.

Anyway, I've previously experienced your issue too. Not for saving the password, but in my case was for saving the Connect Timeout (in Advanced tab).

What I did was:

- I opened the UDL file with notepad
- I wrote the Connect timeout manually
- And saved the file

So, you can wrote the password manually.

If this is your UDL file (example):

[oledb]
; Everything after this line is an OLE DB initstring
Provider=SQLNCLI10.1;Integrated Security=SSPI;Persist Security Info=False;User ID="";Initial Catalog=MySampleDB;Data Source=.;Initial File Name="";Server SPN=""

You can add Password=<yourpassword>; in it.

[oledb]
; Everything after this line is an OLE DB initstring
Provider=SQLNCLI10.1;Integrated Security=SSPI;Persist Security Info=False;Password=<yourpassword>;User ID="";Initial Catalog=MySampleDB;Data Source=.;Initial File Name="";Server SPN=""

Again, its not recommended to save your password as a plain text!

Regards,
Hajan

10/5/2010
 · 
 
by
Daniel Borras
Daniel Borras said:

Hajan

Thanks for the response and advice, but changing the password in a text file was one of the first things I tried.  That is what is so confusing about this situation, even when I change and save it in text format it still does not allow the change, in fact the change does not even show up when you open the UDL file and the “Blank Password” check box is checked again.  It’s doubly strange because if you copy the same file to another compute it works fine; which leads me to believe that it is an XP, ISeries or IBMDA400.DataSource drive setting that I'm running up against.  Also it is only when you use the UDL to connect to an AS400 ISeries database that it happens, any other connection works fine.

Again thanks for the help and you are right normally I would not use a UDL file for DB connections in a released application, but sometimes you are stuck with what others have coded.

More than likely I will be rewriting the connection part of this application.

Daniel Borras

 

 

10/5/2010
 · 
 
by
hajan
Hajan Selmani said:

Daniel,

I think your issue is related to something else - not the UDL file itself because if it works as it is in another machine and not in the one where the issue occurs, it says everything.

However, better spend some time rewritting the connection part of the application instead of using the UDL file directly. I would advise you to create Connection class and implement the DB connection logic in there.

If you have any question regarding this, feel free to register in our community (codeasp.net) and post your questions in the forums, we are always here to support all Microsoft .NET / ASP.NET Developers while coding their apps ;).

Regards,
Hajan

10/5/2010
 · 
 
by
Daniel
Daniel said:

Wink

Hajan

Figured a work around for this problem, it’s weird but it works.  If I open the UDL file in Notepad and add the password and save the file in Notepad, but never open the UDL file itself to “Test Connection”, everything works fine.  Every application can use the UDL file connection without entering a password, but the moment you open the UDL file, you’re screwed, everything now requires that a password be entered, it’s weird but it works.  Still I think that it’s a setting or property that is set incorrectly, but I will not waste any more of our time on it, because I will be reprogramming the connections without using a UDL file.  Thank you for all of your help and time

Daniel Borras

 

10/7/2010
 · 
 
by
hajan
Hajan Selmani said:

Daniel,

First of all, I'm glad it has worked Wink

Emm... Maybe I haven't expressed my thoughts well, but I was thinking on the same scenario when I told you to write the password by opening the UDL with notepad, and save that file.

I've experienced previously the same with the Connect Timeout (which is in Advanced tab in the UDL file). When I wrote the string manually in the text file, it was saved correctly. Once the UDL file is opened, its overriding the settings and the changes are lost. Its probably bug in the UDL file that happens in weired circumstances since I didn't find anything that might influence this. The operating system might be possible reason too.

However, once again I'm glad you've solved your issue ;).

Thank you for visiting CodeASP.NET Community and welcome back here anytime you want :).

All the best,
Hajan

10/7/2010
 · 
 
by
Dhruv Chhabra
Dhruv Chhabra said:

Hi  Hajan:

I am working with ASP.NET 3.5 and I am trying to connect to my database in SQL Server 2008. I used the UDL technique and obtained a connection string similar to the one you have generated in the example and my test connection woks as well. The point is I am using Windows Authentication to access the database and whenever I try to debug the program an exception is thrown that it is unable to retrieve user by login. Do you think it could be because my connection string is wrong which is why it is unable to connect to my login table in my databse and access the right credentials. Could you also explain me if there is any other way to access SQL Server 2008 keeping in my mind i would have use windows authentication for it.

I am actually trying to fix an application ove summer and I have a very minimal experience with ASP.NET

I would appreciate it if you could help!

 

Thanks

Dhruv

6/15/2011
 · 
 
by
  • Name:*
  • Email:*
  • Website:
Type the characters you see in the image *

Top posts

Hajan Selmani's latest blog posts

Quick Vote

What kind of email newsletter would you prefer to receive from CodeAsp.Net?