Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Database connection

Options
  • 30-11-2005 11:32am
    #1
    Registered Users Posts: 597 ✭✭✭


    Hi folks - just a quick question.

    Is it possible to connect to a database that sits on a webserver using a script that sits on a local machine ?

    If so, would the connection string look something like this :
    sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & Server.MapPath("http://www.blah.cm/casinonewsxml.mdb")

    The reason I ask, is because I have a vbscript that uses windows scheduling service to run at different stages during the day to update a database on a live server. I was wondering if it was possible to put this script on a local machine and make changes to the connection string.

    I'm sure there are security issues etc, so any comments or input would be greatly appreciated. Or if you could think of any other ways I could do this, that would really help.

    Thanks folks


Comments

  • Registered Users Posts: 162 ✭✭damalo


    Yes you can do this.

    Firstly most servers are configured not to accept remote connections so you will probably need to talk to your host about it or use some sort of control panel to add the fixed IP of the address of your local machine. You can also use the wildcard % (with some providers) that will eliminate the hassle caused with having a dynamic IP

    Is the information going offsite going to be generated on a localmachine? for example a record of all the times a user logged in to windows on a pc?

    Although I think the remote script is workable you could always get complicated and...

    generate a formatted email (perhaps of XML) - email it to an email address with your local vbscript - set that email address to pipe to a script on the same server as your DB - parse the XML data and then use a conventional connection string to update.

    But thats going overboard :p I would suggesting sticking it out with the remote connection but if you've got time on your hands try the other way


  • Registered Users Posts: 597 ✭✭✭yeraulone


    Thanks Damalo.

    I've decided to use MySQL database instead of the access database - access seems to be too flakey for this type of remote connection.

    I have connected to a mysql database and have experienced a bit of a problem. I can insert and display info ok from the database, however when I try and enter in a date it doesn't seem to work. I believe its because mysql stores the dates as 0000/00/00 and asp does it the other way, 00/00/0000.

    Any body know of any scripts or resources that might help me fix this?

    Thanks folks.


  • Registered Users Posts: 2,157 ✭✭✭Serbian


    You need to insert dates into MySQL like so:
    YYYY-MM-DD HH:MM:SS
    
    Are you using ASP or ASP.NET? I always found ASPs date handling limited at best. You could use something like:
    Dim dDate
    dDate = Year(Now()) & "-" & Month(Now()) & "-" & Day(Now()) & " " & Hour(Now()) & ":" & Minute(Now()) & ":" & Second(Now())
    


  • Registered Users Posts: 597 ✭✭✭yeraulone


    Thanks again serbian.


Advertisement