Solved

Databases

Posted on 1998-06-11
16
222 Views
Last Modified: 2013-12-25
Hi all.
I have an Access database sitting on a NT server. I do not have direct access to this server (ability to install or configure software). However, I had my hosting service provider create a Data Source Name (DNS) for this database so that it can be accessed using ODBC. I need to write a CGI script to access this database. Is there a standard way of doing this?

My first test failed because I created a script in Delphi but the BDE was not installed on the server. I'm thinking of using Visual Basic to access the database. Primarily, I don't have 1 single question, but would like to get some comments from everyone on this. What do think is the workable solution to accessing a database using a script? This doesn't necessarily mean I have to stick with an Access database...

Many thanks for those who can provide any ideas. I will award the points to the individual that sparks the correct, workable answer.
Jorge
0
Comment
Question by:vorlon
16 Comments
 
LVL 2

Author Comment

by:vorlon
ID: 1829623
Edited text of question
0
 
LVL 28

Expert Comment

by:sybe
ID: 1829624
It depends on your experience what is easiest, i would try things in this order:

- When ASP is installed on the server, you can use ASP
- when perl plus perl::ODBC is installed you can use perl
- use Visual Basic




0
 

Expert Comment

by:wrussell051197
ID: 1829625
I've been working on a similar project, and here is basically what I have done. I transferred the database to a SQL server, because it is VERY easy to access SQL from C or C++. My CGI program is simply an executable written in C, that accesses the database and puts the requested data in a table. The nice thing about doing it this way, is that it is pretty easy to use the same program to set up a form, and allow you to create simple on-the-fly queries. Also, C and SQL are both relatively quick, meaning that there is no noticable delay for the data to be retrieved from the database.
0
 
LVL 2

Author Comment

by:vorlon
ID: 1829626
wrussell,
Thanks for your reply. Your comments seems very interesting. Only two things:
1) I do know SQL, but don't have the slighest idea on how to convert, or setup a SQL server. Even if I did, if this needs some sort of setup on at the server level, I might be at a loss because I have very limited access to the server.

2) I am very familiar with C but never used it to access database tables (only used it for straight through processing). What kind of libraries are needed?

To summarize, I know sql and C almost very well, but never used the two together especially on an SQL sever. I would be very interested, and thankfull for any insight you might be able to provide. If you can help me, please send me an email at santos@traxxinc.com.

Many thanks,
Jorge
0
 
LVL 1

Expert Comment

by:Technocrat062397
ID: 1829627
There are a couple ways of doing this.  If the access database is already setup as an odbc source and you can access it you can use any type of programming you want.

1.  I would use cold fusion (available at www.allaire.com)  It is simple easy to use and a very dynamic programming language.  although it is not free and that is the main problem.

2.  Asps are great if you are using iis.  it is relativly easy to use asp to do this job.

Once a database is setup as an ODBC source ANY script in Any language will be able to access it so choose your sword.

Technocrat

3.  VB or Java script.  If you do not know vb or java script real well I wouldn't bother but if you have knowledge in vb already it is not hard to do.
0
 

Expert Comment

by:petergo
ID: 1829628
I'd replace Access with Sybase SQL Anywhere for NT.
To access it, I'd use Perl with ODBC or SybPerl.
0
 
LVL 2

Author Comment

by:vorlon
ID: 1829629
petergo,
Unfortunatly, I don't have any saying in this. I can only use what my hosting service provider provides.

thanks for the comment anyway...
0
 
LVL 7

Expert Comment

by:jconde
ID: 1829630
Tocallo:

If you´re using Access, and don´t access to the server, I would definiteley recommend using Visual Basic CGI, although you could also use Delphi or C++ but it will be a lot harder.  If by any chance you can talk to your Service providers, talk them into buying and/or installing Cold Fusion available at www.allaire.com This will make data base and web scripting a breeze  to use.

Regards
jorge
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 2

Author Comment

by:vorlon
ID: 1829631
jconde,
The service provider will not install any other software other than what they already have. Unfortunatly, i'm beginning to think they don't know what they're doing. I tried a couple of vb scripts but keep hitting walls with everything I try. The most frustracting fact is that the scripts all work on my local machine.

I think the service provider does not have the software correctly installed, but who am I to judge: I'm a simple customer, who might drop them one of these days.

Vorlon
0
 
LVL 2

Author Comment

by:vorlon
ID: 1829632
jconde,
The service provider will not install any other software other than what they already have. Unfortunatly, i'm beginning to think they don't know what they're doing. I tried a couple of vb scripts but keep hitting walls with everything I try. The most frustracting fact is that the scripts all work on my local machine.

I think the service provider does not have the software correctly installed, but who am I to judge: I'm a simple customer, who might drop them one of these days.

Vorlon
0
 

Expert Comment

by:zdyu
ID: 1829633
Hi,
You can try IIS with ODBC support (use some scripts).

0
 
LVL 10

Expert Comment

by:MasseyM
ID: 1829634
I would reccomend trying ASP.. They might have it installed...

Use something like this:

<%
Param = Request.QueryString("Param")
Data = Request.QueryString("Data")
%>
<% intCurRecord = Request.QueryString("CurRecord") %>
<%
If IsObject(Session("YourDSNHere_conn")) Then
    Set conn = Session("yourDNSHere_conn")
Else
    Set conn = Server.CreateObject("ADODB.Connection")
    conn.open "YourDNSHere","",""
    Set Session("YourDNSHere_conn") = conn
End If
%>
<%
    sql = "SELECT * FROM TableNameinDB "
    If cstr(Param) <> "" And cstr(Data) <> "" Then
        sql = sql & " WHERE [" & cstr(Param) & "] = " & cstr(Data)
    End If
    ' Order by here ---> sql = sql & "ORDER BY table.whatever;"    
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open sql, conn, 3, 3
%>
put your script stuff in here... to get a field value use:
<% variable = rs.Fields("field_in_db_name") %>

<%
rs.MoveNext  ' this move to the next record
loop%>

0
 
LVL 2

Author Comment

by:vorlon
ID: 1829635
MasseyM,
My hosting service provider does not allow ASP, nor did I ever used it.

I used another alternative: Text files.

Thanks for the info anyway..

Vorlon
0
 
LVL 10

Expert Comment

by:MasseyM
ID: 1829636
then delete your question...

0
 
LVL 2

Author Comment

by:vorlon
ID: 1829637
MasseyM,
Normally I would but there's no option to do that. The only otpion I had was to grade it or reopen it.

Sorry for the inconvenience,
Vorlon
0
 
LVL 1

Accepted Solution

by:
soeding earned 200 total points
ID: 1829638
vorlon,

Access as a database is fine.
SQL server and Oracle are faster, but the costs... And the most important is, how much records are the output - and do NOT put them in only one HTML table.

(You wrote, that you cannot use ASP. ASP and ColdFusion are the easiest ways. http://www.sitehosting.net offers 50 MB, ASP, Coldfusion, CGI, VB, 1 Database... for $US 35 per Month - Tip.)

Besides, there are two main programming languages to access an ODBC database: Perl and Visual Basic (Delphi is rare).

Perl:
Is a quality scripting language. Your provider will need to install ODBC extension, so that you can access a database (not everyone will do that). If you want, I'll send the extension files. Perl is not dying, it is extending.
The main advantage is that it is (nearly not) dependent on the platform, so it is widely used. In reality, there are differences in Perl for WinNT and Perl for UNIX. Besides, I think that UNIX does not suppot ODBC, but I don't know.

Visual Basic:
Your provider must have a Visual Basic Program installed, and DAO (the librairies for the database access methods).
VB is very comfortable, because syntax errors are recognized instantly, methods are automatically proposed for objects and so on. (I mean the IDE, the development environment - all others are poor.)
But VB itself cannot receive data from or send data to the web, you need another little module. I can send it to you.
Because VB is no scripting language, you have a lot of overhead (1.5 MB memory) when you call a vb.exe.
Therefore VB on the web (WinCGI) may be a little slower than e.g. Perl.

As you, in the moment, I (BAAH!) searched for the right way ONE year.

I started with ColdFusion (http://www.allaire.com).
The first -instant- effords, after a long time of searching!
It is great for beginners, and can still be used for more sophisticated applications.
I recommend to start with it, if you have $US 600.
Download an evaluation copy (I think, 30 days) and the documentation.

ASP is quite the same: You make HTML templates and in between, you fill the database results. You may download the ASP server extension and documentation from Microsoft, or I'll send it (9 MBs).
You will need a Internet Information Server (shipped with NT Client/Server), Peer Web Server (shipped with NT Workstation) or a Personal Web Server (shipped with Win95).

Which programming languages do you use? (C, Delphi, [VB])
Which operation system do you run?
Which web server do you have at home/at the bureau?

If you programmed with C and Delphi, your main problem seems to be that you do not understand you web server's features (not that you cannot program).
Use a server, which uses the same software as you do (that's the point for me).

What's your problem? - Your server? ;-)

IF YOU ONLY CAN USE WHAT YOUR PROVIDER PROVIDES, THEN USE WHAT YOUR PROVIDER PROVIDES.
As Technocrat wrote: "Once a database is setup as an ODBC source ANY script in Any language will be able to access it so choose your sword."
DECIDE.

Feel free to contact info@gartenkorb.com, if you have questions or want to have sourcecode for ASP, or want some of the extensions of which I wrote.

Thank you.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will show, step by step, how to integrate R code into a R Sweave document
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now