SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Addict djh's Avatar
    Join Date
    Apr 2000
    Location
    Long Beach, CA
    Posts
    333
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How the heck do I connect to a db in a SQL server?

    I know this is a very simple question, and just a string would suffice. Thanks!



    ------------------
    Dave Han - webmaster@goboatingamerica.com
    "If a question can be put at all, then it can also be answered." - Wittgenstein
    Visit goboatingamerica.com

  2. #2
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    What kind of SQL server? MS SQL Server? MySQL? Oracle? Sybase?

    What scripting technology are you using? PHP? ASP? PERL?

    A little more information is needed because the number of answers are just to varied without it.

    ------------------
    Wayne Luke - Sitepoint Forums Administrator
    Digital Magician Magazine - MetaQuark Creations (Coming Soon)
    sitepoint@digitalmagician.com

  3. #3
    SitePoint Addict djh's Avatar
    Join Date
    Apr 2000
    Location
    Long Beach, CA
    Posts
    333
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oops, sorry.

    A MS SQL server with ASP. I think I know how to add records and such, but how do you 1) create/maintain a database (since the SQL server is at my host's, is it something that only they can do?), and 2) connect to it, i.e., what does the connection string look like?

    I wish we can move to a unix-based server, so I can try out Kevin's tutorials - which by the way are really really well written - but since a part of our site requires coldfusion, and not too many unix boxes can serve up both coldfusion and asp, our choices are limited.

    Does anyone know if there are translation programs that can translate between scripting technologies in a fairly accurate manner? From asp to php, or coldfusion to ASP, etc.? If not, are there good reasons why such programs couldn't be written? Isn't there an inherent logic (or logical structure ) that might allow a translation?

    Thanks!

    ------------------
    Dave Han - webmaster@goboatingamerica.com
    "If a question can be put at all, then it can also be answered." - Wittgenstein
    Visit goboatingamerica.com

  4. #4
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The connection string is similar as the one you would use for a MS Access database except instead of the MS Access string put "sqloledb" and you don't put the path because the database will be on another server.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>
    &lt;%
    set cnn = server.createobject("ADODB.Connection")
    cnn.open "PROVIDER=SQLOLEDB;DATASOURCE=sqlservername;" & _
    "UID=username;PWD=password;DATABASE=databasename "
    %&gt;
    [/code]

    You can find detailed information about using ADO at www.microsoft.com/data and a simpler guide at www.devguru.com/.


    You would connect to your MS-SQL database using either ISQL on your machine or on the server machine. This is basically a command line interface and your IPP can help you set it up. You can probably also connect using Visual Interdev. The last way you can connect is using Remote Data Services. Then you can access the database through ODBC and Access or ISQL on your machine just like it was installed locally.

    There are many migration tools available but most are from DBMS (Database Management System) to DBMS. A good one is called DBArtisan which handles Oracle, MS SQL Server, Sybase and DB2. I don't know of any that converts PHP to ASP and vice versa but your right something like that would be handy.

    ------------------
    Wayne Luke - Sitepoint Forums Administrator
    Digital Magician Magazine - MetaQuark Creations (Coming Soon)
    wayne@sitepoint.com

    [This message has been edited by wluke (edited August 14, 2000).]

  5. #5
    SitePoint Addict djh's Avatar
    Join Date
    Apr 2000
    Location
    Long Beach, CA
    Posts
    333
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Wayne,

    I checked out the sites, but I'm a bit overwhelmed.

    Can I ask you to explain a bit more?

    Starting from the very basic, can I create a db on the SQL server at my hosts? I'm sure I can... How would I do that? I tried fiddling with the ODBC in my Control Panel and managed to connect with my login info...but I'm lost as to how to setup a new database or copy over an Access database...

    I'm trying to move an Access db to a SQL server, because that page keeps giving me "file already in use" errors... I'd like to just copy the data over, is that possible?

    So, if I can create a database, i assume I can manage it as well. How would I do that? Is ISQL a free download? Is it hard to setup? Is it possible to setup an Access database on my end, do all that I need to do with it, and just migrate it to a SQL server once I'm done?

    These questions are too basic, I think, for the sites that you gave me... I had no luck trying to figure these things out...

    Thanks!

    ------------------
    Dave Han - webmaster@goboatingamerica.com
    "If a question can be put at all, then it can also be answered." - Wittgenstein
    Visit goboatingamerica.com

  6. #6
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Chances are your not going to be able to create a database. You need to have System Administrator privileges to do that. On the other hand your hosting company has probably already set up an empty database waiting for you. You just have to create tables and get the data in there.

    Now since you already have an Access database you can upsize it to SQL Server. Microsoft has a tool just for this purpose. You can find it at: http://www.microsoft.com/accessdev/p...o/aut97dat.htm

    Who is your hosting company? They should be able to help you establish a connection over TCP/IP to the database. I'll look in Innerhost's Knowledge base for HTML specific information when I get home, I don't have the password with me right now.

    Wrox also has a book that might help you out some. Check out: http://www.wrox.com/Consumer/Store/D...SBN=1861003986

    For more information on SQL Server itself go to: http://www.microsoft.com/sql/

    Other great sources of information are the many ASP sites out there. At ASPIN.com there are approximately a hundred general purpose ASP resources listed

    I would also look into purchasing a book or two on SQL Server and Transact SQL so you can take advantage of stored procedures, indexing and temporary tables if needed.
    Moving from Access to a large scale SQL database system is a big step and no trivial matter. It is almost as big a step as changing operating systems. I'll help as much as I can but your also going to need the help of your host's DBA and System Admins to get it done right.

    ------------------
    Wayne Luke - Sitepoint Forums Administrator
    Digital Magician Magazine - MetaQuark Creations (Coming Soon)
    wayne@sitepoint.com

  7. #7
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    OK here are step by step directions to connect to an SQL Server database.

    You can use ISQL/w, Visual Interdev or MS Enterprise Manager to
    communicate with SQL Server from your computer.

    You need to configure the "ODBC Data Sources" tool in your computer's Control Panel using the default wizard:

    1) create your System DSN = From your host
    2) define Server = From your Host
    3) establish authentication method = "With SQL Server authentication..."
    4) complete the "Client Configuration" accordingly (w/out exception):

    Server alias: Same as Server above
    Network libraries: TCP/IP
    Computer name: From Host
    Port number: From Host

    5) supply LOGIN data
    6) speed through the proceeding pages w/out changing any default settings
    7) run TEST DATA SOURCE on the last page;
    result should be "TESTS COMPLETED SUCCESSFULLY!"

    Once "ODBC Data Sources" is properly configured, you may enter the MS Enterprise Manager and go to "ACTION" then to "New SQL Server Registration" in order to establish a remote connection to the server: Same as Above.

    Enterprise Manager is the best to use. If you want to try it before purchase, Microsoft has a 120 day trial download at their site.

    AS for some of the differences between Access and SQL Server code check out: http://www.aspcode.net/showart.asp?art_id=324

    If you need any more help feel free to ask here or by email.


    ------------------
    Wayne Luke - Sitepoint Forums Administrator
    Digital Magician Magazine - MetaQuark Creations (Coming Soon)
    wayne@sitepoint.com

  8. #8
    SitePoint Addict djh's Avatar
    Join Date
    Apr 2000
    Location
    Long Beach, CA
    Posts
    333
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the valuable info...once again Wayne.

    I'm going to download enterprise manager and see what we can do with it there...

    Thanks again!

    ------------------
    Dave Han - webmaster@goboatingamerica.com
    "If a question can be put at all, then it can also be answered." - Wittgenstein
    Visit goboatingamerica.com


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
  •