establishing database

Results 1 to 2 of 2

Thread: establishing database

  1. #1
    Join Date
    Dec 1969

    Default establishing database

    I&#039;m confused on something that might be a simple concept but I need someone to explain it to me....<BR>My work to date with ASP and databases was with an intranet solution so I know how to set up everything locally. I&#039;m now creating an internet solution for another client and I&#039;ve got things working well on my local system. I want to create the sql database and move the asp pages up to the web server (an isp) and I&#039;m clueless on how to/where to define the database. I tried using the client utility and defining the web server but it will not connect. My questions to the isp have gone unanswered. Can anyone help me out?

  2. #2
    Join Date
    Dec 1969

    Default RE: establishing database

    Assuming this is the setup you have:<BR><BR>One web server(physical machine) where you&#039;re .asp pages resides.<BR>Another machine(physical one) where your SQL Server is installed.<BR><BR>First question:<BR>Are the two machines or will the two machines be connected on the *same* network at your ISP?<BR>OR<BR>Is the web server will be somewhere in HongKong and the SQL Server somewhere in Australia?<BR><BR>Assuming its the first scenario(the one where the two machines are on the same network at your ISP)<BR><BR>What comes next is creating a connection in order for you to connect to the database. You can achieve this using many different ways. For now, I&#039;ll show 3<BR><BR>The First one is to make your ISP guy create a System DSN, from there, he will create it and tell you what name he/she gave to the newly created System DSN<BR><BR>The second one is using a DSN-Less connection. Using this type of connection allows you to connect to your database just like the DSN one but without having to call/bother the guy over at your ISP.<BR><BR>The third one, which is the best in many aspects, is to use an OLEDB connection. I&#039;d use the OLEDB connection if I was you.<BR><BR>Now for the code...<BR>You can create an [b]include file[b] that will hold a Const. That Const will hold your connection string here is an example:<BR><BR>Const CONNECTION_STRING = "PROVIDER=SQLOLEDB; Data Source=AAA; Initial Catalog=BBB; User Id=CCC; pwd=DDD"<BR><BR>Where:<BR>AAA = The name of the machine where SQL Server is installed<BR>BBB = The name of the database you will be using<BR>CCC = A userId if any<BR>DDD = A password if any<BR><BR>NOTE: If the AAA part doesn&#039;t work, then instead of giving the *name* of the machine try giving it the IP Address<BR><BR>Then inside your default.asp for example<BR>make sure you include the file where you Const is declared and write:<BR><BR><BR><BR><BR>&#060;%@ Language=VBScript %&#062;<BR>&#060;!--#include file="include/database.asp"<BR><BR>&#060;%<BR>Dim objConn<BR>Set objConn = Server.CreateObject("ADODB.Connection")<BR><BR>obj Conn.Open CONNECTION_STRING<BR>%&#062;<BR><BR>Note:Assuming your include file is called database.asp and that it is inside a folder called include<BR><BR>Hope this helps!<BR>Sincerely<BR><BR>Vlince

Posting Permissions

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