Web Analytics Made Easy -
StatCounter just a question - CodingForum

Announcement

Collapse
No announcement yet.

just a question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • just a question

    Hello!
    I just want to ask you which is the best way to connect to my DB?
    i usually use a DSN connection like this:
    ---------------
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open "DSN=RHDSN;"
    Set rs = Server.CreateObject("ADODB.Recordset")
    SQLStmt = "SELECT * FROM REGISTOS"
    rs.Open SQLstmt,Conn,1,2
    ---------------
    i've heard that the OLEDB connections are better. is this true? in what way are they better? which kind of OLEDB connection should i use? Is this the best type of connection or is there another one?

  • #2
    This article should help:

    Top 10 online casinos in Australia 2022 ✅ The latest eSports news (2023) on Enews.gg ⚽ Although the only things that draw players to an online casino may be
    Check out the Forum Search. It's the short path to getting great results from this forum.

    Comment


    • #3
      thanks for replying.
      i just tested the OLEDB and it works fine. had a little trouble because my db was on a server and i had to access it. OLEDB doesn't allow the use of URLs so used used UNCs instead.
      for anyone interested here is the code i used:
      -------------------------------------
      Set Conn = Server.CreateObject("ADODB.Connection")
      conn.open "Provider=Microsoft.Jet.OLEDB.4.0;" &_
      "Data Source=\\servername\servershare\myDB.mdb;" &_
      "User Id=admin;" &_
      "Password="
      Set rs = Server.CreateObject("ADODB.Recordset")
      SQLStmt = "SELECT * FROM Temas"
      SET RS = Conn.Execute(SQLStmt)
      -------------------------------------------

      Comment


      • #4
        Just a minor point but one nice thing about DSN's is that there is little chance that an error message will reveal the path to the DB (which would probably be outside the www anyway of course).
        J. Paul Schmidt
        www.Bullschmidt.com - Freelance Web and Database Developer
        www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

        Comment


        • #5
          Originally posted by Bullschmidt
          Just a minor point but one nice thing about DSN's is that there is little chance that an error message will reveal the path to the DB (which would probably be outside the www anyway of course).
          Hmm. But that doesn't realy compensate for the downsides:
          - slower to connect;
          - fixed adress --> less portable, even on the same machine
          - requires intervention of your host;

          and i even think you can prevent leaking through errormessages by turning them to 'userfriendly errormessages' or so (don't have IIS here) or including your own erropages.

          DSN-less connections are definitely the way to go.
          Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

          Comment

          Working...
          X