Tech Rocks

Coldfusion
Java
JQuery

An online resource for latest web technologies like Coldfusion, JRun, Pro*C, JQuery, HTML5, PHP, W3C, Java, J2EE, C, C++, ORACLE, PL/SQL, MySql, Ajax, Coldbox, Fusebox, UNIX, JavaScript, NodeJS and much more... contact@tech-rocks.org

Wednesday, January 28, 2009

Loading Java Classes

http://download.oracle.com/docs/cd/B10501_01/
java.920/a96659/02_load.htm#11399

Java in the Database
To make Java files available to the Oracle JVM, you must load them into the Oracle database as schema objects. loadjava can invoke the JVM's Java compiler, which compiles source files into standard class files.

Oracle9i Java Stored Procedures Developer's Guide

http://download.oracle.com/docs/cd/B10501_01/java.920/a96659/toc.htm

Java and the RDBMS: A Robust Combination

Running Java in ORACLE Database

Kool Check this out!
Java for Stored Procedures
http://www.oracle.com/technology/obe/11gr1_db/appdev/java/java.htm
The Java language is by design an object-oriented programming language that has a built-in security mechanism and an efficient garbage collection system. Java also has a rich and very large set of standard libraries which results in quicker and lower-cost applications development. With Java stored procedures, developers have the ability to harness all above stated powers of Java when building database applications...

Saturday, January 24, 2009

Programming ColdFusion MX: Web Services

http://www.webreference.com/programming/coldfusion/1/2.html
When a client makes a request to a web service, it is said to be a consumer of that service. ColdFusion MX makes consuming web services simple. There are three ways to consume a web service in ColdFusion MX. You can use the cfinvoke tag, the cfobject tag, or the createObject( ) function. It's also possible to use the cfhttp tag to manually consume a web service. Because of the complexity involved with that method, I'm going to limit my coverage to the first three methods...

Extending ColdFusion with Servlets

Check This out!
http://www.adobe.com/devnet/server_archive/
articles/extending_cf_w_servlets.html

Allaire Corporation's Cold Fusion Markup Language (CFML) is perhaps the easiest way to generate dynamic web content from a database. Its tag-based scripting commands are simple for HTML authors to learn, yet powerful enough for building full-featured web applications. Since 1995, thousands of websites have been developed with Allaire's popular ColdFusion Application Server. Custom CF tags can be developed either in CFML or with the CFX plugin API in C++. The market for third-party custom tags is growing extremely quickly....

Java Servlets

Check This out!
http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/index.html
Here's the outline of a basic servlet that handles GET requests. GET requests, for those unfamiliar with HTTP, are requests made by browsers when the user types in a URL on the address line, follows a link from a Web page, or makes an HTML form that does not specify a METHOD. Servlets can also very easily handle POST requests, which are generated when someone creates an HTML form that specifies METHOD="POST". We'll discuss that in later sections....

Friday, January 23, 2009

Setting Up ORACLE Server on Windows

Relevant Links
http://download-uk.oracle.com/docs/cd/B12037_01/server.101/b10742/em_manage.htm#BABBAIHD
http://download.oracle.com/docs/cd/B10501_01/network.920/a96581/lsnrctl.htm
http://www.dbforums.com/oracle/1094170-ora-12500-tns-listener-failed-start-dedicated-server-process.html
http://forums.oracle.com/forums/thread.jspa?threadID=252750&tstart=105
http://www.dbasupport.com/forums/showthread.php?t=4714
http://forums.oracle.com/forums/thread.jspa?messageID=2641153


ORACLE ADMINISTRATION HELP
Select PROGRAMS>ORACLE_HOME>DATABASE_CONFIGURATION_ASSISTANT
Wizard shows up click on custom setup and proceeds with the wizard.

Once done created database say g2lx & sid g2lx password abcd , SYS password abcdje
Open cmd prompt and sqlplus
Username:system
Password:abcd

See SQL Prompt

http://hostname:port/em/
shows OEM console.
and the following:-
DB Instance
TNS Listener
ORA Agent

Above three listeners are down

Add the following in tnsnames.ora
g2lx =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
)
(CONNECT_DATA =
(SID = g2lx)
)
)

Add it to LISTENER.ora

DIRECT_HANDOFF_TTC_LISTENER=OFF

LISTENER =
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=hostname)(PORT=1521))
(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))


SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=

(GLOBAL_DBNAME=g2lx)
(SID_NAME=g2lx)
(ORACLE_HOME=E:/oracle/product/10.2.0/db_1/)

(PRESPAWN_MAX=20)
(PRESPAWN_LIST=
(PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=2)(TIMEOUT=1))
)
)
)

Now goto administrative tools> services make oracleServiceG2LX to manual mode by double clicking on it.

Goto cmd prompt and type lsnrctl
LSNRCTL> Prompt appears
SERVICE Listener
Shows active listener
START LISTENER starts the TNS LISTENER in OEM

Refresh OEM TNS LISTENER will start.
Try to click on ORA AGENT type in username :SYSTEM/SYS
Password:abcd/abcdje

If error occurs client hand off add the line in listener.ora
DIRECT_HANDOFF_TTC_LISTENER=OFF
And Restart listener

Once this is done ORA Agent starts after this step you will be able to connect to local db from TOAD using
Host:hostname
Port:1521
SID:g2lx

After this click on DB Instance in OEM Host Credentials Vanishes and Db Credentials Give Username:SYS
Password:abcdje
This will login to OEM
Enjoy!

Compiling Pro*C with Borland C (Bcc32) Compiler and Oracle

References
http://www.codepedia.com/1/CppBuilderLinkingErrors&SrcRev=8&DstRev=0&action=diff
http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html
http://srikanthtechnologies.com/articles/oracle/proc/dmlcom.html
http://www.orafaq.com/wiki/Pro*C
http://www.orafaq.com/forum/t/93439/0/
http://www.cprogramming.com/borland.html
http://www.acs.ilstu.edu/docs/Oracle/win.101/a96111/use.htm
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a97269/toc.htm
http://www.uaex.edu/srea/osee/52505.htm
http://bioinfo.uh.edu/cosc3480/ProC/ProC.htm
http://infolab.stanford.edu/~ullman/fcdb/oracle/or-proc.html
https://db.bme.hu/Manuals/Oracle/Oracle9/win.920/a96111/intro.htm


Installing Pro*C
Install freecommandlinetools.exe FREE Borland C compiler.

bcc32.cfg
-I"c:\Borland\bcc55\Include"
-L"c:\Borland\bcc55\Lib"
-L$(ORACLE_HOME)/lib -L$(ORACLE_HOME)/rdbms/lib

ilink32.cfg
-L"c:\Borland\bcc55\Lib";
-L"e:\oracle\product\10.2.0\db_1\precomp\lib";

Add the above files in the bin folder
C:\Borland\bcc55\Bin

Copy E:\oracle\product\10.2.0\db_1\precomp\LIB\orasql10.lib to C:\Borland\bcc55\Bin
Folder
Run coff2omf orasql10.lib orasql10~.lib
In bin folder
Copy orasql10~.lib to E:\oracle\product\10.2.0\db_1\precomp\LIB

Copy all lib files of oracle to C:\Borland\bcc55\Lib folder
Copy all .h files in E:\oracle\product\10.2.0\db_1\precomp\public to C:\Borland\bcc55\Include

Restart cmd prompt
Create db.h
#ifndef __BIT_TYPES_DEFINED__
#define __BIT_TYPES_DEFINED__
typedef unsigned char u_int8_t;
typedef unsigned short u_int16_t;
typedef unsigned int u_int32_t;
typedef unsigned __int64 u_int64_t;

#if defined __GNUC__
#include
#else
typedef short int16_t;
typedef int int32_t;
typedef __int64 int64_t;
#endif
#endif


#if !defined __GNUC__
typedef u_int64_t uintmax_t;
#ifdef _WIN64
typedef u_int64_t uintptr_t;
#else
typedef u_int32_t uintptr_t;
#endif
#endif

In C:\Borland\bcc55\Include

Now we are all set
Copy fun1.pc to bin folder C:\Borland\bcc55\Bin
#include
#include
#include
#include


EXEC SQL BEGIN DECLARE SECTION;
VARCHAR uid[30];
VARCHAR pwd[30];
VARCHAR db[30];
EXEC SQL END DECLARE SECTION;

EXEC SQL INCLUDE SQLCA.H;

void main()
{

strcpy(uid.arr,"system");
uid.len =strlen(uid.arr);
strcpy(pwd.arr,"abcd");
pwd.len = strlen(pwd.arr);
strcpy(db.arr,"hostname_for localhost");
db.len = strlen(db.arr);

EXEC SQL WHENEVER SQLERROR GOTO errexit;
EXEC SQL CONNECT :uid IDENTIFIED BY :pwd using :db;

if (sqlca.sqlcode == 0)
printf("Connected to Oracle\n");

EXEC SQL COMMIT WORK RELEASE;
return;

errexit:
printf("Connection failed");
return;


} /* end of main */
Run Proc fun1.pc
Run bcc32 /IC:E:\oracle\product\10.2.0\db_1\precomp\public fun1.c /LINK E:\oracle\product\10.2.0\db_1\precomp\LIB\orasql10~.lib
Run fun1
Enjoy!