Sqlj TestInstallSQLJ.sqlj
Trying to translate this sample code brougt the following error:
unexpected error occurred...
java.lang.NoSuchMethodError: sqlj.runtime.profile.ref.EntryInfoImpl.<init>(Ljava
/lang/String;IIIILjava/lang/Object;[Lsqlj/runtime/profile/TypeInfo;[Lsqlj/runtim
e/profile/TypeInfo;ILjava/lang/String;)V
at sqlj.codegen.ProfileDecl$EntryInit.getEntryInfo(ProfileDecl.java:131)
at sqlj.codegen.ProfileDecl.getProfile(ProfileDecl.java:75)
at sqlj.codegen.ExecCodegen$ProfileParselet.generate(ExecCodegen.java:581)
at sqlj.javac.ASTCompilationUnit.generate(ASTCompilationUnit.java:218)
at sqlj.translator.Translator.translate(Translator.java:257)
at sqlj.translator.Translator.translate(Translator.java:228)
at sqlj.translator.Main.translate(Main.java:124)
at sqlj.translator.Main.runTranslation(Main.java:99)
at sqlj.translator.Main.runTranslation(Main.java:92)
at sqlj.tools.Sqlj.statusMain(Sqlj.java:294)
at sqlj.tools.Sqlj.main(Sqlj.java:136)
Error: Exception caught:
Total 1 error.
In the classpath I have the runtime12ee.jar and translator.zip. Am I possibly missig something?
I would appreciate every answer!
Please see:
http://technet.oracle.com/tech/java/sqlj_jdbc/htdocs/faq.html#exceptionininitializer
Note that you can also download the 8.1.6SDK patch for your command line version of SQLJ - just replace translator.zip with the one from the patch.
If this does not fit your problem then you need to provide more information. Please check out:
http://technet.oracle.com/tech/java/sqlj_jdbc/htdocs/faq.html#checklist
null
Similar Messages
-
I would like to retrieve data from Oracle8.0.5 using sqlj.
i tried:
<%@page language="sqlj
import= sqlj.runtime.ref.DefaultContext,oracle.sqlj.runtime.Oracle"%>
and i've got the error:
java.lang.NoSuchMethodError: sqlj.tools.Sqlj: "method resetStaticVariables()V not found"
someone helps?
thanxThis uses a feature which is only found in post 8.1.6.1 versions of Oracle SQLJ. You have two choices:
(1) Download ojsp 1.0.0.6.1 or later from OTN. This contains an updated SQLJ version.
(2) Or wait for the SQLJ 8.1.7 release (or later) in the next couple of weeks.
null -
Oracle 10.2 Loadjava for SQLJ says "..uses or overrides deprecated API"
I just upgraded to 10.2 from 8.1.7 (platform is AIX 5L) and sqlj program was INVALID after upgrade.Running loadjava on the program seems successfull, and java class is VALID, but also get:
Note: MQBridge uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
Well, after lots of reading to try and assess the significance of the error and identify the deprecated API, I think the sqlj script on UNIX will allow me to issue the 'deprecated' option to perhaps identify the old API. However, the I'm having trouble even getting the sqlj to work (I think it's in $OH/oc4j/bin with non-executable permissions) and the README in $OH/sqlj/demo seems incorrect.
The APIs in the program are:
import oracle.sqlj.runtime.Oracle
import java.sql.SQLException
import oracle.sql.CLOB
import com.ibm.mq.*
import java.math.BigDecimal
import java.util.*
import javax.swing.event.*
Perhaps someone versed in this arena can provide some guidance in what seems to be a straighforward problem (or maybe not a problem)? Sure would appreciate it!HI,
In my opinion, upgrading the RDBMS might not suffices.
I'd re-install SQLJ 10.2f rom the companion CD and check that its working fine in your environment using the following command:
$ sqlj -version
Oracle SQLJ Release 10.2.0.1.0 Production
Copyright (c) 1997, 2005, Oracle Corporation. All Rights Reserved.Oracle furnishes the following code samples under
$ORACLE_HOME/sqlj/demo/ to check your environment:
connect.properties // to be customized to your environment
TestInstallCreateTable.java
TestInstallJDBC.java
TestInstallSQLJ.sqlj
TestInstallSQLJChecker.sqlj
Then make sure that:
- the executables (script and binaries) are available under $ORACLE_HOME/bin.
- the PATH environment variable must include $ORACLE_HOME/bin.
- the CLASSPATH environment variable must include the following:
- the JDBC jars (ojdbc14.jar, or clases12.jar)
- ORACLE_HOME/sqlj/lib/translator.jar
- ORACLE_HOME/sqlj/lib/runtime12.jar
As described in chapter 10 of my book, here is how to use them to check
your environment:
// create a table for test purposes
$ javac TestInstallCreateTable.java
$ java -Doracle.net.tns_admin=$TNS_ADMIN TestInstallCreateTable
SALES table created
$
// Check JDBC install
$ javac TestInstallJDBC.java
$ java -Doracle.net.tns_admin=$TNS_ADMIN TestInstallJDBC
Hello JDBC!
$
// Check the SQLJ translator, runtime, and the application
$ sqlj TestInstallSQLJ.sqlj
$ java -Doracle.net.tns_admin=$TNS_ADMIN TestInstallSQLJ
Hello, SQLJ!
$Then check that SQLJ is installed in the database using
SQL> describe sys.sqljutlOtherwise, run the sqljutl.sql script to install it. In addition, the following query checks the availability of the SQLJ translator in the database (using system or a DBA account)
SQL> select object_type, status from all_objects where
2 dbms_java.longname(object_name) ='oracle/sqlj/checker/JdbcVersion';See chapter 10, 11 and 12 of my book for further coverage..
Kuassi, http://db360.blogspot.com -
NoSuchfieldName error while compiling a class that was produced by sqlj
hello all,
could you please tell me where the following error code came from when i
tried to execute java TestInstallSQLJ?
I could use sqlj TestInstallSQLJ.sqlj to translate it into java code, but
then....
thank you for your help.
Exception in thread "main" java.lang.NoSuchFieldError
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Error.<init>(Error.java:50)
at java.lang.LinkageError.<init>(LinkageError.java:43)
at
java.lang.IncompatibleClassChangeError.<init>(IncompatibleClassChangeError.java:43)
at java.lang.NoSuchFieldError.<init>(NoSuchFieldError.java:45)
at
oracle.sqlj.runtime.OraDynamicClosure.getSQLType(OraDynamicClosure.java:68)
at
oracle.sqlj.runtime.OraBasicClosure.<init>(OraBasicClosure.java:47)
at
oracle.sqlj.runtime.OraClosureFactory.addStandardTypes(OraClosureFactory.java:138)
at
oracle.sqlj.runtime.OraClosureFactory.get81Closures(OraClosureFactory.java:50)
at
oracle.sqlj.runtime.OraClosureFactory.getTypeClosures(OraClosureFactory.java:33)
at
oracle.sqlj.runtime.OraCustomization.getProfile(OraCustomization.java:95)
at
oracle.sqlj.runtime.OraCustomization.getProfile(OraCustomization.java:87)
at sqlj.runtime.profile.ref.ProfileImpl.getConnectedProfile(Compiled
Code)
at
sqlj.runtime.ref.ProfileGroup$ConnectedGroup.getProfile(ProfileGroup.java:154)
at
sqlj.runtime.ref.ConnectionContextImpl.getConnectedProfile(ConnectionContextImpl.java:183)
at
sqlj.runtime.ExecutionContext.registerStatement(ExecutionContext.java:279)
at TestInstallSQLJ.runExample(Compiled Code)
at TestInstallSQLJ.main(TestInstallSQLJ.java:56)following is my environment:
sqlj -version-long
Oracle SQLJ Release 8.1.6.0.0 - SDK
Build version: 1.0.4.4 - Built on Apr 14, 1999
IDE interface version: 8.1.6.0.0/1.0.4.4
JDBC version: non Oracle driver version 0.0 (0.0.0.0)
java -version
java version "1.2.1"
Solaris VM (build Solaris_JDK_1.2.1_03, native threads, sunwjit)
echo $PATH
a long path +
/examples/sqlj/bin
echo $CLASSPATH
a long CLASSPATH +
/examples/sqlj/lib/translator.zip:
oracle JDBC driver8.1.7
it translated my sqlj files but then it can't interprete my java classes.
thank you a lot for your help -
Unable to start SQLJ Translator
I tried to test the SQLJ and JDBC setup. I modified the connect.properties file and made the appropriate changes so that it refers to my database. When trying to compile TestInstallCreateTable.java, I get errors saying that some classes are not imported. But I am able to create SALES table thru the SQL+. But when I enter sqlj TestInstallSQLJ.sqlj from the command prompt, I get an Unable to initialize threads:cannot find class java/lang/Thread error. I have the path(Oracle_Home\bin) and classpath(Oracle_Home\jdbc\lib\classes111.zip and Oracle_Home\sqlj\lib\translator.zip) set up. The JDK version is 1.1.8. Am I missing something? Please advice.
Thanks in advance.Thank you for your timely help. After setting up %JAVA_HOME%\lib\classes.zip in classpath, I am able to compile the .sqlj file. But I am not able to run. I get a java.lang.NoClassDefFoundError:oracle.sqlj.runtime.Oracle. I am able to see this class in the database, under Java classes. Kindly advice. Thanks in advance.
-
Java.lang.NoClassDefFoundError when compile SQLJ source file
Always got error message java.lang.NoClassDefFoundError: sun/io/CharToByteConverter
when using sqlj to compile SQLJ source file.
The CLASSPATH (partial) .:$ORACLE_HOME/sqlj/lib/translator.zip:$ORACLE_HOME/sqlj/lib/runtime.zip
I am able to compile the demo TestInstallCreateTable.java and TestInstallJDBC.java but not TestInstallSQLJ.sqlj in the same directory.
I am using Oracle 8.1.6 R2 client in Linux Intel on Red Hat 6.0. Can anyone explain why this happened ?From the forthcoming new version of the SQLJ FAQ:
"NoClassDefFoundError: sun/io/CharToByteConverter"
(This is likely a general configuration issue, not something specific to your code.)
Running sqlj results in the following error message.
java.lang.NoClassDefFoundError: sun/io/CharToByteConverter
at sqlj.tools.Sqlj.initializeErrors(Sqlj.java:519)
This happens if you are running under a JRE environment, and not a full JDK environment. You need to download and install a full JDK environment. Note that the Oracle
database installation will only set up a Java Runtime Environment. Oracle does not distribute the Java Development Kit - you have to get it from http://java.sun.com
If that did not help, you'd need to give us a fuller picture of your environmnet (JDK versions, PATH, CLASSPATH settings, etc.).
Thanks! -
SQLJ translator connection failing
hi, i am trying to verify the sqlj translator connection to the db using the TestInstallSQLJ.sqlj code. i am using jdk1.3/8.1.5+sqlj8.1.6SDK on win98 -> jdk1.2.1/8.1.5 on nt4, and modified the sqlj.properties file appropriately. when i execute sqlj on the Test file, it says it can't load the OracleDriver:
TestInstallSQLJ.sqlj:40.4-40.29: Warning: Cannot load JDBC driver class oracle.jdbc.driver.OracleDriver.
TestInstallSQLJ.sqlj:40.4-40.29: Warning: Unable to perform semantic analysis on connection jdbc:oracle:thin:@<snip> by user <snip>. Error returned by database is: No suitable driver
Total 2 warnings.
Any help is appreciated.
nullYou need to have the JDBC classes111.zip (for 1.1.x) or classes12.zip in your CLASSPATH environment variable. Say the following on the command line:
javap oracle.jdbc.driver.OracleDriver
- this should print out the methods on the OracleDriver class. Now say:
sqlj -version-long
This should print out all sorts of version information on SQLJ, JDBC and the JDK you are using. If yes, then you are in business. If it prints out the JDBC driver version as 0.0, then the Oracle JDBC driver is not yet in the CLASSPATH. -
When i try to use the SQLJ demo samples, i have this error
[oracle@linux-02 demo]$ java TestInstallSQLJ
SIGSEGV received at bffff398 in /apps/oracle/product/8.0.5/lib/liboci805jdbc.so.
Processing terminated
Writing stack trace to javacore9319.txt ... OK
Aborted
Here is my CLASSPATH
[oracle@linux-02 demo]$ echo $CLASSPATH
.:/apps/oracle/product/8.0.5/jdbc/lib/classes111.zip:/usr/local/sqlj/lib/transla
tor.zip
and when i use the -J-D option
[oracle@linux-02 demo]$ sqlj -J-Djava.compiler=none TestInstallSQLJ.sqlj
libnone.so: cannot open shared object file: Aucun fichier ou ripertoire de ce ty
pe (libnone.so)
libnone.so: cannot open shared object file: Aucun fichier ou ripertoire de ce ty
pe (libnone.so)
Warning: JIT compiler "none" not found. Will use interpreter.
Can you help me
nullIt appears that your JDBC installation may not be correct - the problem occurs in the JDBC shared library when establishing a connection. I assume you got JDBC from the full Oracle 8.0.5 Linux distribution - we only have the Solaris versions of JDBC in the separate download area. Were you able to run TestInstallJDBC.java?
At any rate, you should be able to use the thin version of JDBC on every Java platform.
Just use a JDBC URL of the form:
jdbc racle:thin:@<hostname>:<port>:<sid>
Typically <hostname>=localhost, <port>=1521, <sid>=orcl - but this depends on your installation and configuration.
-- Ekkehard -
SQLJ connection exception in oracle 8i and jdk 1.5
This is the code through which i am trying to extract current date from oracle database and print Helloworld
// import required packages
import java.sql.Date;
import java.sql.SQLException;
import oracle.sqlj.runtime.Oracle;
public class HelloWorld {
public static void main(String [] args) {
java.sql.Date current_date;
try {
// connect to the database
Oracle.connect(
"jdbc:oracle:thin:@localhost:1521:orcl",
"student",
"student"
// get the current date from the database
#sql { SELECT sysdate INTO :current_date FROM dual };
// display message
System.out.println("Hello World! The current date is " +
current_date);
} catch ( SQLException e ) {
System.err.println("SQLException " + e);
} finally {
try {
// disconnect from the database
Oracle.close();
} catch ( SQLException e ) {
System.err.println("SQLException " + e);
} // end of main()
this is the error
unexpected error occurred...
java.lang.ExceptionInInitializerError
at sqlj.translator.Translator.addUnit(Translator.java:117)
at sqlj.translator.Main.translate(Main.java:112)
at sqlj.translator.Main.runTranslation(Main.java:92)
at sqlj.translator.Main.runTranslation(Main.java:85)
at sqlj.tools.Sqlj.statusMain(Sqlj.java:280)
at sqlj.tools.Sqlj.main(Sqlj.java:125)
Caused by: java.lang.NullPointerException
at sqlj.framework.ClassFileReader.attribute_info(ClassFileReader.java:326)
at sqlj.framework.ClassFileReader.readClass(ClassFileReader.java:224)
at sqlj.framework.ClassFileReader.describeClass(ClassFileReader.java:62)
at sqlj.framework.ClassFileReader.getDeclaringClass(ClassFileReader.java:146)
at sqlj.framework.JSClass$ClassWrapper.getDeclaringClass(JSClass.java:1649)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1496)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1545)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1552)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1507)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1533)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1545)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1552)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1507)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1545)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1552)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1507)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1533)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
at sqlj.framework.JSClass.resolveIfNonNull(JSClass.java:1513)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1493)
at sqlj.framework.JSClass.resolveIfNonNull(JSClass.java:1513)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1493)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1534)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1545)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1552)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1507)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1533)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
at sqlj.framework.JSClass.resolveIfNonNull(JSClass.java:1513)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1493)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1545)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1552)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1507)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1494)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1533)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1533)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1534)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
at sqlj.framework.JSClass.resolveIfNonNull(JSClass.java:1513)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1495)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1534)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1494)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1534)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
at sqlj.framework.JSClass.resolveIfNonNull(JSClass.java:1513)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1493)
at sqlj.framework.JSClass.resolveIfNonNull(JSClass.java:1513)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1493)
at sqlj.framework.JSClass.reflectSystemClass(JSClass.java:1340)
at sqlj.framework.JSClass.<clinit>(JSClass.java:49)
... 6 more
HelloWorld.sqlj: Error: Exception caught:
Total 1 error.SQLJ 8i with jdk1.5?
Please try SQLJ 10.2 with jdk1.4. -
SQLJ compile failure in derived class
I have successfully comiled and run the "SimpleExample" defined
in the Help Topics "Developing Applications Using SQLJ" page.
However, if I make a simple modification to make the class
derived from another class (DoNothing class shown below is the
simplest case I've tried) I get compilation errors:
Error (52) Illegal INTO ... bind variables list: illegal
expression..
Error (0) SQLJ translation aborted.
Error (0) sqlj.framework.TranslationException. Error occured in
SQLJ translation.
Modified SimpleExample looks like:
public class SimpleExample extends DoNothing {
......as before
where DoNothing is defined as:
package RDBInterface; // My SimpleExample is in same package
public class DoNothing {
public DoNothing() {
Any ideas about this?
nullAndy,
I got the answer to that in another thread,
cheers Jon
Re: SQLJ-Problem with JDeveloper 2.0
From: Chris Stead (guest)
Email: [email protected]
Date: Tue Feb 02 13:07 CST 1999
Markus Rosenkranz (guest) wrote:
: Hi,
: I tried to rebuild an SQLJ-file with the new JDev. 2.0.
Whenever
: there is an iterator definition in a derived class compilation
: failed. By removing the extends clause in the class definition
: the compilation error could be avoided. It seems that the
: iterator definition is ignored. With JDev. 1.1 everthing
worked
: fine. How can this problem be solved.
: TIA Markus
Hi Markus,
Your question seems similar to the one that was just resolved.
Here are the specifics:
I'm using the production SQLJ and getting a frustrating error
of:
-- "Left hand side of assignment does not have a Java type."
I've reduced my testcase down to the absolute
minimum, but maybe I'm missing something obvious...
package oracle.xml.website;
import java.sql.SQLException;
import javax.servlet.http.*;
#sql iterator empiter ( String empname );
public class WebXSL extends HttpServlet {
public void foo() throws SQLException {
empiter myEmps = null;
#sql myEmps = {SELECT ename empname from EMP order by sal
desc };
Hi,
Could you please check whether the class HttpServlet is
available
in your CLASSPATH? The type resolver could be failing to find
this class in the process of looking for the definition of
'empiter', which is the type of your iterator variable myEmps.
The error message is somewhat obscure, we will be working on
improving it..
The SQLJ translator does a full type resolution of Java
variables
and expressions used in #sql statements, following JLS rules of
scoping and precedence for class and interface hierarchies. It
looks for classes in the CLASSPATH, as well as in the .sqlj and
.java source files specified on the sqlj command-line. So, if
you have .sqlj and .java files that are mutually dependent, you
could do:
sqlj Foo.sqlj Bar.java
Please let us know if your problem persists.. and see also bug
801780 for a related discussion.
- Julie
Julie,
Your suggestion helped! Thanks.
With 20/20 hindsight now, it would have been much more
helpful if the SQLJ translator reported an error message like:
-> Left hand side of assignment is not a Java type.
-> Unable to resolve class "HttpServlet". Check CLASSPATH
That would have keyed me into the problem many hours ago :-)
You suggestion lead me to test sqlj-ing my testcase
both outside and inside the JDeveloper environment.
Outside the environment, if I make sure J:\lib\jsdk.jar is
in my classpath, then all is well.
Inside the environment, I had included the named
library for "JavaWebServer" in my project libraries
and its classpath info was properly set to J:\lib\jsdk.jar,
but it appears that somehow JDev is not properly passing
this project-level classpath info to the SQLJ translator.
I was able to solve my problem (a hack!) by adding
J:\lib\jsdk.jar
to the:
IDEClasspath=
setting in the J:\bin\jdeveloper.ini file which I shouldn't
have to do. I filed Bug 813116 for the JDev team.
null -
Hi,
I am new to SQLJ. Now, in my PC (with Win98), I have JDK 1.2 and Oracle 8i (personal edition). I have used Java and Oracle in my PC without any problem. Now, I am going to learn SQLJ in order to create a java program to access Oracle database. What I have done is to set up several classpaths in DOS:
SET classpath=C:\ora_program\sqlj\lib\translator.zip;
SET classpath=C:\ora_program\sqlj\lib\runtime.zip;
SET classpath=C:\ora_program\sqlj\lib\runtime12.zip;
SET classpath=C:\ora_program\jdbc\lib\classes12.zip;
The code of my program is:
import java.sql.Date;
import java.sql.SQLException;
import oracle.sqlj.runtime.Oracle;
import java.util.Date;
public class Hello{
public static void main(String[] args){
java.sql.Date current_date;
try{
// connect to the db
Oracle.connect(
"C:\ora_program\bin",
"system",
"manager");
// get the current date from the database
#sql{SELECT sysdate INTO :current_date FROM dual};
// display message
System.out.println("Hello, the current date is: "+ current_date);
catch(SQLException e){
System.err.println("sqlException: "+e);
finally{
try{
Oracle.close();
catch(SQLException e){
System.err.println("sqlException: "+e);
And then I compile my program in DOS with the typing: sqlj Hello.sqlj
The program cannot be compiled and the error message is:
"Exception in thread main java.lang.NoClassDefFoundError: sqlj/tools/Sqlj"
It indicates that the SQLJ translator class files cannot be found.
I have set up the classpath in DOS (see above). How does the error come? Please help. Thanks.
PC>
SET classpath=C:\ora_program\sqlj\lib\translator.zip;
SET classpath=C:\ora_program\sqlj\lib\runtime.zip;
SET classpath=C:\ora_program\sqlj\lib\runtime12.zip;
SET classpath=C:\ora_program\jdbc\lib\classes12.zip;
The above only sets the classpath to the last value. You need to use the following.
SET classpath=%classpath%;C:\ora_program\sqlj\lib\runtime.zip; -
SQLj - static bind to the database
I'm porting a customer application to Oracle SQLj.
I've read in the documentation that programming in SQLj I can use the features of
building the statically the access path.
So I'm testing the environment:
First - I wrote an SQLj test application: myApp.sqlj
Second - I precompiled/compiled the myApp.sqlj with the sqlj translator
C:\...\> sqlj myApp.sqlj
and I obtained a .ser file (serialized profile)
Third - The question is: How can I bind the ".ser" file in to my Oracle database.
P.S. A colleague that works with others db vendor producs told me that should exists
a program/tool to do this, but I haven't found anything in the docs!
Thank you LucaI changed the Conn String
Connection con = DriverManager.getConnection("jdbc:oracle:thin:ibd/ibd@xyz:1521:NEW");
ibd/ibd - database login/pwd
xyz is the network name
1521 - Port No
NEW - Instance Name
Now i am getting this Exception
Message : IO Exception :The network adopter could not establish
the Connection
SqlState : null
ErrorCode : 17002
waht cud be the error? -
Hi all,
I'm getting the following error while
trying to translate using sqlj from
the prompt.
Error:Error in Sqlj Stub: path or file
name "java" not found.
what could be the problem ?Is it bcoz of installation problem ??Plz help me .From what you can get from
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html
, you have serveral options:
1. Use SQLJ 9i releases.
2. Use JPub 10g releases, where sqlj command line can be accessed through jpub command, such as
% jpub -sqlj a.sqlj a.java
Note you need to setup classpath to include translator.jar and runtime12.jar.
3. Use jpub 10g and sqlj/bin/sqlj.exe from SQLJ 9i -
How to run sqlj.exe to translator Sqlj file which depends other file
I want to use sqlj.exe to compile sqlj file. I don't know what option can be set for Sqlj.exe can automatically compile sqlj file and it's dependent file(sqlj or java).
Here is one case:
There are three six files.
p1\A.sqlj
p1\A1.sqlj
p2\B.sqlj
p3\C.java
p3\DI.java
p4\E.java
1.the Class A has been declared as follow:
public class A extends C implements DI{
And in A.sqlj file, Class B and A1 will be used.
2.the class E has been declared as follow:
public class E extends C{
I want run sqlj.exe as follow:
sqlj -d=. A.sqlj
Does it can auto compile C.java, DI.java and A1.sqlj, B.sqlj?
We known, when java file is compiled, the dependent java file will be auto compiled,
for example, the command,
javac E.java
will compile E.java and C.java.
But how sqlj.exe automatically compile dependent file.
Thanks,I want to run an exe file Runtime.exec()
installed in a server from a client machine Server program that executes Runtime.exec() if told to do so by a client via a socket connection
everyday at a particular (fixed) time.Look at System.currentTimeMillis(), Calendar, Date, Timer... -
SQLJ JSP and SERVLETS which Environment?
Hello,
I am attempting to run the samples on Chapter 5 of the
following documents with partial success.
http://technet.oracle.com/docs/products/oracle8i/doc_library/817_
doc/java.817/a83726/oraext2.htm
http://download-west.oracle.com/otndoc/oracle9i/901_doc/java.901/
a90208/oraext.htm#1015820
1. Do I need the Apache+Jserv environment to run SQLJ and JSP?
2. What do I need to do run SQLJ on oc4j if possible?
3. I dont know how to load(?) and/or run this .sqljsp file.
<%@ page language="sqlj"
import="sqlj.runtime.ref.DefaultContext,oracle.sqlj.runtime.Oracl
e" %>
<HTML>
<HEAD> <TITLE> The SQLJQuery JSP </TITLE> </HEAD>
<BODY BGCOLOR="white">
<% String empno = request.getParameter("empno");
if (empno != null) { %>
<H3> Employee # <%=empno %> Details: </H3>
<%= runQuery(empno) %>
<HR><BR>
<% } %>
<B>Enter an employee number:</B>
<FORM METHOD="get">
<INPUT TYPE="text" NAME="empno" SIZE=10>
<INPUT TYPE="submit" VALUE="Ask Oracle");
</FORM>
</BODY>
</HTML>
<%!
private String runQuery(String empno) throws
java.sql.SQLException {
DefaultContext dctx = null;
String ename = null; double sal = 0.0; String hireDate = null;
StringBuffer sb = new StringBuffer();
try {
dctx = Oracle.getConnection("jdbc:oracle:oci8:@", "scott",
"tiger");
#sql [dctx] {
select ename, sal, TO_CHAR(hiredate,'DD-MON-YYYY')
INTO :ename, :sal, :hireDate
FROM scott.emp WHERE UPPER(empno) = UPPER(:empno)
sb.append("<BLOCKQUOTE><BIG><B><PRE>\n");
sb.append("Name : " + ename + "\n");
sb.append("Salary : " + sal + "\n");
sb.append("Date hired : " + hireDate);
sb.append("</PRE></B></BIG></BLOCKQUOTE>");
} catch (java.sql.SQLException e) {
sb.append("<P> SQL error: <PRE> " + e + " </PRE> </P>\n");
} finally {
if (dctx!= null) dctx.close();
return sb.toString();
%>
I named above file as test2.sqljsp then I tried these procedures:
a) $ ojspc test2.sqljsp --these created all the files
b) $ loadjava -u -v scott/tiger _test2.class -resolve
this generated:
initialization complete
loading : _test2
creating : _test2
resolver :
resolving: _test2
errors : _test2
ORA-29521: referenced name test2$_jsp_StaticText could not
be found
ORA-29521: referenced name test2SJProfileKeys could not be
found loadjava: 2 errors
c) listed the directory and both these files are there but it
cannot resolve or find it?
d) I recall reading something about publishjsp command but I have
to establish a session shell with OSE? this part is very
confusing and am not sure what to do here.
e) not sure if i need to publish the loaded class (create a
procedure? so it can be known to the rest of plsql?)
A step by step procedure is very much appreciated. fyi.. I
have Oracle 8.1.7, + oc4j, I can run sqlj from command line
and class files generated I can run. I can also run JSP and
servlets on the oc4j accessing the database. It is this SQLJ
that throws me off balance. If you include Jdeveloper steps
ro run SQLJ thats also welcome.
Thanks in advance for kind responses posted.In many Model-View-Controller web applications implemented using J2EE, servlets are as controllers to direct the flow between the model and view. While servlets can output HTML code directly, it is much better to use JSPs for the most part. JSPs contain HTML and possibly Java scriptlets. The J2EE container will typically compile JSPs into servlets. While you could use a JSP as a controller, there are drawbacks to that approach. To minimize the amount of Java code in your JSPs, you can either use the tags provided by the JSP spec or use tag libraries written by someone else or yourself. See the JSTL for one such example.
Also see:
http://wiki.java.net/bin/preview/Javapedia/MVC
http://wiki.java.net/bin/view/Javapedia/JavaServerPages
Maybe you are looking for
-
Apple mobile device service won't work?
I tried googling it and doing what it said. I ended up having to reinstall itunes which worked the first time. Now I am back to square one. As in an error message comes up saying apple mobile device service isn't started. It is running always and
-
How do I get an installation cd for photoshop?
I have a very slow connection so downloading will take forever
-
How to enable the variant button in my report
Hi experts, How can I enable the variant button at the top menu bar of my report?
-
I can't seem to find the option in adobe CS4. Do you have to first export it as a photoshop raw? Thanks!
-
Question about Error Statistics
Hello, Just want to ask question, what cause of Recieve Ignored packets and Throttles in Cisco Aironet 1310G with System Software Version:12.4(21a)JA, it increments the number very fast. Thanks you