Solved

Databases

Posted on 1998-06-11
16
220 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
Comment Utility
Edited text of question
0
 
LVL 28

Expert Comment

by:sybe
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 2

Author Comment

by:vorlon
Comment Utility
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
Comment Utility
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
Comment Utility
Hi,
You can try IIS with ODBC support (use some scripts).

0
 
LVL 10

Expert Comment

by:MasseyM
Comment Utility
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
Comment Utility
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
Comment Utility
then delete your question...

0
 
LVL 2

Author Comment

by:vorlon
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

772 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

8 Experts available now in Live!

Get 1:1 Help Now