Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2004
    Posts
    1

    Unanswered: hiding the database connection string

    Hi,
    I want to hide connection string to the database. Presently i have that hard coded in the asp page. But i want hide the connection string in registry or somewhere more secure.

    Can anyone help me with the procedure how to do it and also the asp code as to how to access that connecitonstring.

    thanks,
    atul kumar.

  2. #2
    Join Date
    Sep 2004
    Posts
    1

    Hide connection string to database

    You could use an include and put the connection string is a separate page.

    <!--#include file="../connection/connect.asp"-->


    connect.asp might look something like this if you are using a MS Access database:
    <%
    ' this will create the connection to the database
    dim MyConnection
    set MYConnection = server.CreateObject("ADODB.Connection")
    MyConnection.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};" & "DBQ=C:\pathtodatabase\Mydb.mdb"

    MyConnection.Open
    %>

  3. #3
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    There is no way to completely hide the connection string. But if you want to hide the database server, username, and password, you should create a DSN on the server. Then all you have to do is put the DSN name in the connection string. On Windows 2000, it's under Start > Settings > Control Panel > Administrative Tools > Data Sources ODBC.
    That which does not kill me postpones the inevitable.

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    you can hide it int he registry but you would want/need to write a com object to get the value from the registry (atleast I'm not aware of any way to look at the registry using ASP). you could put it in a file and encrypt it but then you would need to have a decryption function as well which would (basically) be easily hacked so it probably wouldn't help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •