SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    May 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    connecting web server and remote db server via asp

    im a newbie in asp and totally new to forums like this.
    my prob is i have 2 different computers, one that runs my asp pages and the other my database server (mySQL). im working on my local and trying to connect my remote database with my remote webserver using DSNless connection string as more advisable. I installed a myodbc (driver) in my local, supplied the connection details in the data source configuration. (i followed this http://www.devarticles.com/c/a/ASP/...base-Via-ASP/3/ instructions about either connecting to the mySQL db using a System DSN or the Connection String.)

    although i was able to query the db already using the System DSN way but only via localhost as testing webserver. i want to connect the remote mysql db to the remote webserver the DSNless connection string approach.

    via System DSN:
    set adoConn = Server.CreateObject("ADODB.Connection")
    set adoRS = Server.CreateObject("ADODB.Recordset")
    adoConn.Open "DSN=mysql_dsn"
    etc..

    via DSNless connection string:
    set adoConn = Server.CreateObject("ADODB.Connection")
    set adoRS = Server.CreateObject("ADODB.Recordset")
    adoConn.Open "Driver={mySQL}; Server=192.168.1.35; Port=3306; Option=0; Socket=; Stmt=; Database=testdb; Uid=root; Pwd=;"



    PLS HELP ME!!! Heaps of thanks!!!!

  2. #2
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.connectionstrings.com

    For near enough every database going.

    Gav


  3. #3
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    See how your DSNless connstring contains the IP of your db server and your DSN connstring doesn't? THAT'S your problem.



    How does your script know where to look? Of course, in the absence of any guidance it checks localhost (hence working locally) but if you need it to look elsewhere you need to instruct it as such.

    gRobert's extremely useful link has the appropriate connection in it - I suspect since you've only just downloaded MyODBC you'll need this string for the later versions:
    "DRIVER={MySQL ODBC 3.51 Driver};SERVER=data.domain.com;PORT=3306;DATABASE=myDatabase; USER=myUsername;PASSWORD=myPassword;OPTION=3;"

    Put your server IP address, 192.168.1.35, in Server= as you did with your DSNless connstring.

    Cheers,

    G


Bookmarks

Posting Permissions

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