Results 1 to 14 of 14
  1. #1
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    551
    This is my first attempt at creating a database based site (using ASP).

    I have set up the domain and I have set up the database on the site with a DSN. I have also locally set up a DSN (the same) to connect to a local database.

    If I post my code, will it automatically connect to the remote database using the DSN, or do I need to do something else?

    Can I just upload my local database over the top of the remote database, and if I do will it automatically recognise the connection?

    I need to get over this concept hurdle and understand how the connection is made.

    Any help would be appreciated.

  2. #2
    Newbie
    Join Date
    January 18th, 2005
    Posts
    2,694
    I don't use ASP but Coldfusion is similar in the way it interacts with a database so I'll give this a go.

    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>

    If I post my code, will it automatically connect to the remote database using the DSN, or do I need to do something else? <HR></BLOCKQUOTE>

    You have to have a connection string in your script so that it will connect to your DSN.


    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>
    Can I just upload my local database over the top of the remote database, and if I do will it automatically recognise the connection? <HR></BLOCKQUOTE>

    Yes, and yes. You can upload a new/fresh copy of the DB, it will overwrite your existing copy, but the DSN will still be viable. You don't need to set it up again.

    HTH

    {

    "Laziness, Impatience, Hubris. Pick any three" ~ YAPC 19100

  3. #3
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    551
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR> You have to have a connection string in your script so that it will connect to your DSN. <HR></BLOCKQUOTE>

    Done that.

    So now the only thing is to ahead and break it [img]/infopop/emoticons/icon_biggrin.gif[/img]

    Thanks.

    If all my problems could be solved this easily, I would be a happy man.

  4. #4
    ABW Ambassador sjangro's Avatar
    Join Date
    January 18th, 2005
    Location
    Boston
    Posts
    1,529
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>I have set up the domain and I have set up the database on the site with a DSN. I have also locally set up a DSN (the same) to connect to a local database.

    If I post my code, will it automatically connect to the remote database using the DSN, or do I need to do something else?<HR></BLOCKQUOTE>

    Yes, as long as the DSN is named exactly the same on both systems (which you said you did), you should be able to simply upload your code.

    You're going to have something like this in your ASP scripts:

    <pre class="ip-ubbcode-code-pre">Set oDBConnection = Server.CreateObject("ADODB.Connection")
    oDBConnection.Open "my_DSN"</pre>

    As long as the DSN is named "my_DSN" in both places, you should be good.

    --scott

    --
    Scott Jangro
    sjangro@befree.com

  5. #5
    Newbie
    Join Date
    January 18th, 2005
    Posts
    33
    Wayder,

    If you have any problems, you might also look into "DSN-less" connections. These generally improve performance, and also reduce some of the configuration/host hassles.

    Here's a link for your reading enjoyment:

    http://www.aspfaq.com/show.asp?id=2126

    [img]/infopop/emoticons/icon_cool.gif[/img]

  6. #6
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    551
    At the moment I am [img]/infopop/emoticons/icon_eek.gif[/img], I need some time to get to [img]/infopop/emoticons/icon_cool.gif[/img].

    The link is a bit too much for me at the moment and I think it will [img]/infopop/emoticons/icon_confused.gif[/img] me, so rather than get [img]/infopop/emoticons/icon_mad.gif[/img] I need to take time being [img]/infopop/emoticons/icon_frown.gif[/img], so that in a while I can understand and be [img]/infopop/emoticons/icon_smile.gif[/img]. If I do well enough, maybe [img]/infopop/emoticons/icon_biggrin.gif[/img]

    [img]/infopop/emoticons/icon_wink.gif[/img] [img]/infopop/emoticons/icon_rolleyes.gif[/img]

  7. #7
    Newbie
    Join Date
    January 18th, 2005
    Posts
    33
    Wayder,

    Don't [img]/infopop/emoticons/icon_eek.gif[/img], it's really not that [img]/infopop/emoticons/icon_confused.gif[/img].

    Go with what works for you. And if you do decide to go "DSN-less" and follow the instructions at the link, it's really just a matter of inserting the name of your database into the connection string. Then it's no [img]/infopop/emoticons/icon_frown.gif[/img], just [img]/infopop/emoticons/icon_biggrin.gif[/img].

    [img]/infopop/emoticons/icon_cool.gif[/img]

  8. #8
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    551
    [img]/infopop/emoticons/icon_biggrin.gif[/img] [img]/infopop/emoticons/icon_biggrin.gif[/img] [img]/infopop/emoticons/icon_biggrin.gif[/img] [img]/infopop/emoticons/icon_biggrin.gif[/img]

    "Connection was made sucessfully" [img]/infopop/emoticons/icon_biggrin.gif[/img]

    Now, what was it I wanted to do? Ah yess...

    Thanks all

  9. #9
    Master of Design AlexBet's Avatar
    Join Date
    January 18th, 2005
    Location
    Toronto, Canada
    Posts
    1,364
    Wayder,

    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR> you might also look into "DSN-less" connections <HR></BLOCKQUOTE>

    You MUST look at it! "DSN-Less" connection is better (performace wise), plus, it doesn't need any setting up at the server.

    Here is some very easy code for a DSN-Less Connection

    <pre class="ip-ubbcode-code-pre"> Set Conn = Server.CreateObject("ADODB.Connection")
    MdbFilePath=Server.MapPath("DatabaseFile.mdb")
    Conn.Open = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & MdbFilePath & ";" </pre>

    If for example, you have the database file in another folder, let's say called "database", then you will substitute the ("DatabaseFile.mdb") part with this ("database/DatabaseFile.mdb")

    AlexBet

  10. #10
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    551
    [img]/infopop/emoticons/icon_mad.gif[/img] [img]/infopop/emoticons/icon_mad.gif[/img] [img]/infopop/emoticons/icon_mad.gif[/img] and [img]/infopop/emoticons/icon_mad.gif[/img] (frustration).

    DSN connection works fine. I use dreamweaver. I have read all the documents I can find, but still I can't get a DSN less connection [img]/infopop/emoticons/icon_mad.gif[/img]

    Does anyone know if there is anything that changes the connection string I should use?

    As far as I can see, I only need to use the "Driver" & "DBQ" parameters.

  11. #11
    Newbie
    Join Date
    January 18th, 2005
    Posts
    39
    Wayder,

    Copy & Paste this code into Notepad (make changes to your db path & table name) and save it as test.asp. Upload it to your web server and run it. If the DSN-Less connection is working you should see:

    Hello

    Goodbye

    Don't forget to put the proper path to your db & used the proper table name.

    &lt;%
    Response.Write "Hello &lt;BR&gt;"

    Set cn=Server.CreateObject("ADODB.connection")
    cn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=Path_to_your_database.mdb"
    SQLStatement="Select * from Your_Table"
    Set rs=cn.execute(SQLStatement)

    Response.Write "GoodBye"
    %&gt;

    I hope that helps.

    - RDD

  12. #12
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    551
    Thanks for your help. I have decided that as my main aim is to learn how to create a dynamic site, I will accept the slower connection speed rather that pull my hair out on this one.

    I met an American on the side of a mountain once. He was operating a communications link and his antenna was at a 65% angle and bent like you'd never guess. I mentioned to him that he would get a much better signal if he spent the time to straighten it out, stabilize it and make it vertical. His comment was “hell, I got comms, and i’ll be move on soon, so what the hell”.

    I guess he was right.

  13. #13
    Master of Design AlexBet's Avatar
    Join Date
    January 18th, 2005
    Location
    Toronto, Canada
    Posts
    1,364
    Wayder,

    Try this... Set the "write" properties for that folder to enabled and try it again. MS Access writes a system file in the same folder when you open the database. Normally, this shold NOT be a problem, but I've seen it once that it was a problem (don't ask me why).

    Otherwise, I can't see why it wouldn't work. Don't try it in Dreamweaver, try it in in a browser (http://localhost/name of virtual directory/name of file) if you have IIS enabled and working and if you have created a virtual directory.

    AlexBet

  14. #14
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    551
    Thanks AlexBet,

    I tried your suggestions without success [img]/infopop/emoticons/icon_frown.gif[/img]
    I used notepad to write the page. I did get a recognisable connection error but have decided not to worry about it.

    There are several factors for this, one of them being that I will get a dedicated server later this year and I have not yet decided on the operating system but I am leaning away from MS, so maybe I should be learning PHP not ASP.

    The other reason is that I can have a site writen for about $150 ~ $200 and maybe it does not make sense for me to do this myself at all.

    R...

  15. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Hello Everyone! Looking forward to connecting
    By SupremeWebinar in forum Introduce Yourself
    Replies: 2
    Last Post: October 31st, 2013, 09:32 PM
  2. Connecting to RL
    By Mack in forum AM Navigator
    Replies: 15
    Last Post: June 22nd, 2007, 12:54 PM
  3. Connecting to database
    By Gordon in forum Programming / Datafeeds / Tools
    Replies: 3
    Last Post: July 14th, 2004, 09:26 AM
  4. Trouble Connecting To Linkshare
    By phil.davis@deepdiscounts.com in forum Rakuten LinkShare - LS
    Replies: 3
    Last Post: May 9th, 2004, 07:16 AM

Posting Permissions

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