Go Premium for a chance to win a PS4. Enter to Win


combine serverside javascript with perl?

Posted on 1998-01-04
Medium Priority
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?
Question by:enotsin
LVL 10

Expert Comment

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.

Expert Comment

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

Author Comment

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?
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


Expert Comment

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.

Author Comment

ID: 1277329
I forgot which port of Perl I am using. But it has a directory
which contains David Roth's ODBC.pm (ver 0.03)
another directory
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?

Accepted Solution

nanullnet earned 120 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;

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

Author Comment

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?

Expert Comment

ID: 1277332
  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.

Author Comment

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.


Featured Post

Technology Partners: 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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

879 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