Solved

combine serverside javascript with perl?

Posted on 1998-01-04
9
320 Views
Last Modified: 2012-08-14
here is my problem:
I use to have a perl cgi script that open a socket connection and pass some text to another end of the connection.
Now I have written some server side javascript code to read an Oracle database to perform access control (for authentication).
Life would have been easy if I could use this javascript to pass data through a socket connection but from my very limited knowledge on javascript this doesn't seem possible.
So can I somehow wire my perl code and this javascript code together?
If this is not possible, how about if I change the perl portion to java, and is it possible then to use liveconnect to wire them up? Can someone inform me of the simplest solution?
0
Comment
Question by:enotsin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 10

Expert Comment

by:kollegov
ID: 1277325
Netscape's servers support
some databases ODBC, Informix, ORACLE and some others
connectivity directly from LiveWire server-side script.

It also support liveConnect methods, but I think
easier to do all in one as (Java servlet)
Java have JDBC allowing to connect to databases
and java servlets can connect via socket to anywhere.
Sun released JSDK (servlets developers kit and it's free!)
and can be easy plug-ined under most existing of major servers.
I'd recommend to use servlets instead of Netscape's "server applets", at least this ones easy can be moved to any other
(non-netscape) server.
0
 
LVL 1

Expert Comment

by:nanullnet
ID: 1277326
Why not just write the Javascript portion in perl?  Perl can connect to the Oracle DB.
0
 

Author Comment

by:enotsin
ID: 1277327
do you mean using the Win ODBC package in Perl? I have that one with my Perl 5 but haven't use it before. What do I need to get that running? Is it a ODBC/oracle driver? does it come with oracle?
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 1

Expert Comment

by:nanullnet
ID: 1277328
Which port of Perl are you using?  The ActiveState port has great Win32 support.  Dave Roth has an ODBC module for perl, and I think it works on the standard port too, but don't quote me on that.  As long as the Oracle DB has ODBC support, you can use the ODBC module to connect to it.  If you are on UNIX, there is a Native ORACLE driver you can use with Perl, but I'm not aware of one for Win32.  But if you have ODBC support, Perl will work great.  I can give you code samples if you like.
0
 

Author Comment

by:enotsin
ID: 1277329
I forgot which port of Perl I am using. But it has a directory
perl\lib\site\Win32
which contains David Roth's ODBC.pm (ver 0.03)
another directory
perl\lib\site\DBD
contains another ODBC.pm by Tim Bunce et al
can you give me an example how to write perl code to connect to my oracle workgroup server?
(ps, I don't know this odbc stuff, but say I have the oracle server on my NT4.0 machine and that machine's ODBC applet in its control panel doesn't show anything. Do I need to setup something there first?
0
 
LVL 1

Accepted Solution

by:
nanullnet earned 40 total points
ID: 1277330
Yes, first you need to set up a system DSN.  Do that and follow the directions.  Select the Oracle ODBC driveer when it asks you.

Once that is done, the Perl code will look something like this:

use Win32::ODBC;
$DBCONN = new Win32::ODBC("DSN=xxxx;UID=xxxx;PWD=xxxx;");
$SQLString = "INSERT INTO UserRec (U_item, U_time) VALUES ($item, $t)";
$ERROR = $DBCONN->Sql($SQLString);
die qq(SQL failed "$SQLString": ), $DBCONN->Error(), qq(\n) if $ERROR;
$DBCONN->Close;

That works fine with Dave Roth's module and the Active state port.  Try it on your machine.
0
 

Author Comment

by:enotsin
ID: 1277331
thanks! but what's this DSN thing? How do I setup it and where to get it? does it come with my oracle server?
0
 

Expert Comment

by:zingbust
ID: 1277332
Hi,
  Sorry I can't help you with the DSN thing.  I just had a question about what you said in your original question.  You said you had server-side javascript code to read the database.  I didn't know there was such a thing.  I thought javascript only ran embedded in HTML which would mean it was client-side.  If there's such a thing as server-side javascript, I'd really like to learn about it because that may be the key I'm looking for to solve my problem.
0
 

Author Comment

by:enotsin
ID: 1277333
Server side javascript and server side java are both available. The former was introduced by Netscape to run livewire application that connect to database. The later was introduced by javasoft in the form of servlet.

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

617 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