Oracle SQLJ or JDBC ?
Hi,
I would like some advice. Have anyone used Oracle SQLJ instead of the JDBC ?
What should I use ?
I started with JDBC then someone told me about SQLJ and said it was more high level and therefore easier to use. What do you think ?
Thanks
It depends whether you need portability or not. JDBC will be portable across DBs whereas SQLJ feature is not. Also I would advise not to make portability a default requirement for any application as that shuts down a whole bunch of nice, performant solutions. Would recommend reading Rod johnson's J2EE expert one-on-one. Wrox crashed, so not sure book is available or not.
-Sanjay
Similar Messages
-
I have asked this question in the SQLJ JDBC forum but since nobody answers me I try here instead:
Could you point me to some good resources (white papers) where I can read about performance issues when choosing between SQLJ and JDBC?
I assume this is a rather general question, but I have to come up with a precise answer. This system is limited by a large number of inserts into Oracle, but the SQL statements are not complicated.
Regards
FlemmingNot knowing exactly, but I guess, that there is no real difference between SQLJ and JSBC concerning performance. SQLJ is just a precompiler which translates SQLJ-Statements into JDBC API-calls. So both are basically the same. Most probably the limiting part will be the database, which has to execute all of the INSERT-statemens you mentioned.
-
Hi All,
I am currently set up the (tomcat) jsp engine on top of apache web server.
And now i would like to install both sqlj and a jdbc driver such
that I can query our oracle database. In all of the options for downloads
there is a windoze option and a solaris option. Do I have to wait for specific
"linux" version to get them to work. Or is the solaris option alright
for linux ??
slightly confused,
ChrisUnfortunately, this description is still rather unspecific.
It sounds, as if there might be an issue with the way database connections are established for the SQLJ and JDBC parts of your program. Could you provide more information on that, specifically on how you obtain JDBC connections and SQLJ connection contexts. -
ClassNotFoundException:oracle.sqlj.runtime.Oracle
Sub: Error
message "ClassNotFoundException:oracle.sqlj.runtime.Oracle"
Hi,
I am trying to run an applet whose source is compiled by sqlj
with no errors. Applications hit the database and run fine from
the Sun Unix command prompt, but when I write as an applet and
try to run through the web I get the above error message. I am
running webserver 3.0 and Oracle 8 version on Sun E10K with ver
5.6, JDK 1.2.
Thanks in advance for your reply.
Ravi Nitta
nullRavi Nitta (guest) wrote:
: Sub: Error
: message "ClassNotFoundException:oracle.sqlj.runtime.Oracle"
: Hi,
: I am trying to run an applet whose source is compiled by sqlj
: with no errors. Applications hit the database and run fine from
: the Sun Unix command prompt, but when I write as an applet and
: try to run through the web I get the above error message. I am
: running webserver 3.0 and Oracle 8 version on Sun E10K with ver
: 5.6, JDK 1.2.
: Thanks in advance for your reply.
: Ravi Nitta
Ravi --
I think there was a problem with the 8.0.5 distribution, in
that the oracle.sqlj.runtime classes did not make it into
the runtime.zip file.
Just add the oracle.sqlj.runtime.* packages to the zip
(compression must be set to none).
Additionally, you can remove the packages sqlj.runtime.util
and oracle.sqlj.runtime.util - these only get used at
translate time, not at runtime.
(Alternatively, if you can say: sqlj -profile=false ...
and your program still runs, you can do that, and your
applet will not use the Oracle-specific SQLJ runtime.)
Of course, the runtime.zip and your JDBC driver's zip must be
distributed with the applet.
If you get a SecurityException, then the SQLJ runtime you are
using utilizes reflection, and you have the options outlined
in my other reply to your query.
Hope this helps.
-- Ekkehard
null -
SQLJ vs JDBC vs stored procedur?People
SQLJ vs JDBC vs stored procedur?
What is used in the enterprise?
What to study?SQLJ and JDBC are ways to access the database - from the client, from the middle tier, or from inside the database server itself.
JDBC is an API specified by Sun as part of Java, while SQLJ is an ANSI (soon ISO) standard for embedding SQL in Java.
JDBC is more widespread, while SQLJ is a more productive environment.
Stored procedures are pieces of code executed in the database as part of your database session. In Oracle Databases, stored procedures are usually written either in PL/SQL (a propertietary Oracle language) or in Java. If you write your stored procedure in Java you use JDBC or SQLJ to access the database - essentially the same code you would write on the client or in a middle-tier. -
I installed JDK1.2.2, it works very well. I also installed
JDBC7.3.4 and SQLJ7.3.4. After I compiled the
TestInstallCreateTable.java, I run the class to get the following
error messages. Can SQLJ7.3.4 work with the JDK1.2.2?
Exception in thread "main" java.lang.UnsatisfiedLinkError:
C:\ORAWIN95\BIN\oci73jdbc.dll: One of the library files needed to
run this application cannot be found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at
java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1319)
at
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1243)
at java.lang.Runtime.loadLibrary0(Runtime.java:470)
at java.lang.System.loadLibrary(System.java:768)
at
oracle.jdbc.oci7.OCIDBAccess.logon(OCIDBAccess.java:138)
at
oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:
93)
at
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:146)
at
java.sql.DriverManager.getConnection(DriverManager.java:457)
at
java.sql.DriverManager.getConnection(DriverManager.java:137)
at
sqlj.runtime.ref.ConnectionContextImpl.<init>(ConnectionContextIm
pl.
ava:102)
at
sqlj.runtime.ref.DefaultContext.<init>(DefaultContext.java:142)
at
oracle.sqlj.runtime.Oracle.getConnection(Oracle.java:501)
nullThank 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.
-
What is the difference between the -codegen=oracle and -codegen=jdbc options of Oracle SQLJ? Will there be any performance benifit for -codegen=jdbc over -codegen=iso?
Based on the above mentioned stack it looks like the sqlj program is being compiled in codegen=oracle mode. As can be seen in the below three lines.
sqlj.runtime.ref.ConnectionContextImpl.getOracleConnection(ConnectionContextImpl.java:149)
sqlj.runtime.ExecutionContext$OracleContext.prepareOracleCall(ExecutionContext.java:1507)
adaptech.model.karibu.pusua.Pusua.existe(Pusua.sqlj:74)
The generated client program is calling ExecutionContext.OracleContext.prepareOracleCall directly. This would be seen only with codegen=oracle and not with codegen=iso.
Also, please do check if you have ojdbc14.jar or classes12.jar as part of the classpath at the time of execution of the program. -
Insert data 32K into a column of type LONG using the oracle server side jdbc driver
Hi,
I need to insert data of more than 32k into a
column of type LONG.
I use the following code:
String s = "larger then 32K";
PreparedStatement pstmt = dbcon.prepareStatement(
"INSERT INTO TEST (LO) VALUES (?)");
pstmt.setCharacterStream(1, new StringReader(s), s.length());
pstmt.executeUpdate();
dbcon.commit();
If I use the "standard" oracle thin client driver from classes_12.zip ("jdbc:oracle:thin:@kn7:1521:kn7a") every thing is working fine. But if I use the oracle server side jdbc driver ("jdbc:default:connection:") I get the exception java.sql.SQLException:
Datasize larger then max. datasize for this type: oracle.jdbc.kprb.KprbDBStatement@50f4f46c
even if the string s exceeds a length of 32767 bytes.
I'm afraid it has something to do with the 32K limitation in PL/SQL but in fact we do not use any PL/SQL code in this case.
What can we do? Using LOB's is not an option because we have client software written in 3rd party 4gl language that is unable to handle LOB's.
Any idea would be appreciated.
Thomas Stiegler
nullIn rdbms 8.1.7 "relnotes" folder, there is a "Readme_JDBC.txt" file (on win nt) stating
Known Problems/Limitations In This Release
<entries 1 through 3 omiited for brevity >
4. The Server-side Internal Driver has the following limitation:
- Data access for LONG and LONG RAW types is limited to 32K of
data. -
Local oracle access with jdbc thin
hello there
it need help despratly,
im developing an applet to talk to remote oracle dbs using jdbc
thin
but i also want an applet to be able to talk to a local oracle db
on the same hardisk.
for a remote connection the follwing stringis used at my
university
static final String connect_string =
"jdbc:oracle:thin:scott/[email protected]:1521:DSC1";
but what do i subsitute for thr host as i want to access the db
on my hard disk?
i need as much help ASP, as im well behind my schedule for this
project.?
also i take it that to allow this and access to remote servers
other than the web server, the applet needs to be signed, is this
possible with jdk1.1.x compatble browsers?
yours
richard sergio marchesi
email - [email protected]
or
email - [email protected]
nullThe thin driver reqiures a TCP listener to be running. If you are
using Personal Oracle for the 'local' RDBMS then it doesn't have
a listener (with the default installation). Start the listener
and you should be able to connect. You will also want a local
webserver of some sort to serve the applet to you as well, but
anything (even TinyWeb) will do for that.
null -
Can't connect to external Oracle DB with JDBC connector
Hello guys,
I had failed to connect to connect external Oracle via JDBC connector .
Could you please help me to resolve the problem ?
Backgroud:
We need to connect the external Oracle DB with JDBC connector, because BI need to connect to the target Oracle. If the JDBC connector suceed, BI will create a UD which use the datasource
we create in Visual admin to connect to the external Oracle DB.
Environment:
Our EP version is NW04S SP17 , OS is AIX .
The target Oracle DB version is 10g(10.1.0.2.0, 64bi).
Configuration procedure :
1. Import Oracle driver "ojdbc14.jar" and create new driver which named "Oracle " under
JDBC Connector ->Run time ->Driver in Visual Admin.
2. Create datasource "Mydatasource" under JDBC Connector ->Run time ->Data Source,
Name : Mydatasource
Driver Name : Oracle
JDBC version: 2.0(with XA support)
JDBC compliant:
Object Factory :oracle.jdbc.pool.OracleDataSourceFactory
DataSource Type: ConnectionPoolDataSource
*CPDS class name :oracle.jdbc.pool.OracleConnectionPoolDataSource
Additional:
Additional Properties:
DatabaseName:LPAR8TEST
DriverName:oracle.jdbc.OracleDriver
Password: *****
PortNumber:1521
ServerName: 10.1.16.208
URL :jdbc:oracel:[email protected]:1521:LPAR8TEST
User:IMPL
Connectoin Pool:
Initial Connectons: 1 Expiration: (check)
Maximum Connections: 25 Connection Lifetime :600
Maximum time wait of connection : 60 Cleanup Thread : 200
Default Connectoin Isolaton :Default
SQL Engine:
Open SQL
3.Create Connector :
Copy the standard connector :SDK_JDBC to SDK_JDBC_Oracle,
Resource Adopter:
Loader References:
Add "libray:Oracle" .
Managed Connection Factory:
Configuration Property:
DriverName:oracle.jdbc.OracleDriver
Password: ****
User:IMPL
URL: jdbc:oracle:[email protected]:1521:LPAR8TEST
All fo my configuration had been listed.
And I had created JCO RFC : JT-BIDEV_PORTAL_BD1 , and created RFC connection with SM59 in BI.
Please give me some suggesiton.
Thanks.
LouisWhen I try to start datasoure "Mydatasource" , it display error, error detail:
java.rmi.RemoteException: com.sap.engine.services.dbpool.exceptions.BaseRemoteException: Error during start of application "sap.com/Mydatasource". [id = StartupError]
at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.startApplication(DataSourceManagerImpl.java:608)
Caused by: java.rmi.RemoteException: Error occurred while starting application in whole cluster and wait.; nested exception is:
com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Clusterwide exception: server ID 3128050:com.sap.engine.services.dbpool.exceptions.BaseDeploymentException: Cannot start DataSource "CGNPC".
at com.sap.engine.services.dbpool.deploy.ContainerImpl.startDataSource(ContainerImpl.java:1549)
Caused by: com.sap.engine.services.dbpool.exceptions.BaseResourceException: SQLException thrown by the physical connection: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
at com.sap.engine.services.dbpool.spi.CPManagedConnectionFactoryImpl.createManagedConnection(CPManagedConnectionFactoryImpl.java:198)
Caused by: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
Caused by: com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Clusterwide exception: server ID 3128050:com.sap.engine.services.dbpool.exceptions.BaseDeploymentException: Cannot start DataSource "Mydatasource".
at com.sap.engine.services.dbpool.deploy.ContainerImpl.startDataSource(ContainerImpl.java:1549)
Caused by: com.sap.engine.services.dbpool.exceptions.BaseResourceException: SQLException thrown by the physical connection: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
at com.sap.engine.services.dbpool.spi.CPManagedConnectionFactoryImpl.createManagedConnection(CPManagedConnectionFactoryImpl.java:198)
Caused by: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
u2026.
When I try to test JDBC with URL : http://jt-pldev:50000/TestJDBC_Web/TestJDBCPage.jsp,
First I choose connection name "SDK_JDBC_Oracle" .
If I click "Check Connectons", it display :
500 Internal Server Error
SAP J2EE Engine/7.00
Application error occurred during request processing.
Details:
java.lang.NoClassDefFoundError: com.sap.ip.bi.sdk.dac.connector.odbo.impl.Connection (initialization failure)
Exception id: [001A64A86F2C006B000004C40010302A000469C74E86A096]
If I click "Slecton Connection", it display:
500 Internal Server Error
SAP J2EE Engine/7.00
Application error occurred during request processing.
Details:
com.sap.engine.frame.core.load.SAPNoClassDefFoundError: javax.resource.Referenceable
Exception id: [001A64A86F2C0063000004C00010302A000469C74FA2BB59] -
Oracle Database 10g JDBC Samples on OTN
Review the OTN's new Oracle Database 10g JDBC Samples that illustrate new features introduced with Oracle10g JDBC Driver. The features illustrated are Connection Cache, Named Parameter Support, IEEE Datatypes, Thin Driver support for PLSQL Index by Tables and Web Rowset. Also watch out for samples on Datalinks, New Encryption Algorithms, Globalization Support, Shortcuts for CLOB manipulation and more to be hosted shortly.
The samples are available at,
http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/oracle10g/index.htmlI suppose that is nice.
It would be even nicer if the drivers actually conformed to JDBC so that one could for example reliably use blobs in a J2EE server with CMP. -
NCHAR issue with oracle database using JDBC adapter
Hi,
We have a requirement to develop an XI interface from FTP server(File adapter) to oracle database using JDBC adapter. In the oracle database table few fields are of type NCHAR/NVARCHAR. when we try to insert the character(A,B,c..) values into oracle table fields of type NCHAR/NVARCHAR, we are getting the following error message in the JDBC adapter audit log. IF we pass the numeric value to the same field, then we are able to insert the records successfully.
Unable to execute statement for table or stored procedure. 'IPCSDD_DOWNLOAD_PROCESS' (Structure 'StatementName1') due to java.sql.SQLException: ORA-00904: "P": invalid identifier
2010-10-19 22:29:59 Error JDBC message processing failed; reason Error processing request in sax parser: Error when executing statement for table/stored proc. 'IPCSDD_DOWNLOAD_PROCESS' (structure 'StatementName1'): java.sql.SQLException: ORA-00904: "P": invalid identifier
2010-10-19 22:29:59 Error MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'IPCSDD_DOWNLOAD_PROCESS' (structure 'StatementName1'): java.sql.SQLException: ORA-00904: "P": invalid identifier
Please find the system information below.
Oracle version- 10.2.4
XI version - 3.0/ service pack 19
JDBC driver- oracle.jdbc.driver.OracleDriver
Please suggest.
Thanks,
Venkata
Edited by: Venkata Narayana Eepuri on Oct 21, 2010 12:10 AMDear Venkata Narayana,
Concerning the error, kindly go through the following note :
731 - Collective note: ORA-00904
follow the recommendations mentioned in that and please check if that helps.
Best Regards
Nishwanth -
I can't get oracle MajorVersion using jdbc in 9.2.0.1.0,how can i do and how many oracl version can't get MajorVersion?
thanks,erveryone! online waitingWhat errors are you getting? Can you post the codew you are using to get MajorVersion.
-
SetString/executeBatch fails in Oracle 10g OCI JDBC driver
Hi,
I am using Oracle 10g OCI jdbc driver for batch updates.
Following is the the code that I am using
import java.sql.*;
import oracle.jdbc.*;
import oracle.jdbc.pool.OracleDataSource;
public class BatchUpdates
public static void main(String[] args)
Connection conn = null;
Statement stmt = null;
PreparedStatement pstmt = null;
ResultSet rset = null;
int i = 0;
try
String url = "jdbc:oracle:oci:@kctutf8";
try {
String url1 = System.getProperty("JDBC_URL");
if (url1 != null)
url = url1;
} catch (Exception e) {
OracleDataSource ods = new OracleDataSource();
ods.setUser("kctuser");
ods.setPassword("kana");
ods.setURL(url);
conn = ods.getConnection ();
stmt = conn.createStatement();
try { stmt.execute(
"create table mytest_table (col1 number, col2 varchar2(20))");
} catch (Exception e1) {}
pstmt = conn.prepareStatement("insert into mytest_table values (?, ?)");
pstmt.setInt(1, 1);
pstmt.setString(2, "row 1");
pstmt.addBatch();
pstmt.setInt(1, 2);
pstmt.setString(2, "row 2");
pstmt.addBatch();
pstmt.setInt(1, 3);
pstmt.setString(2, "row 3");
pstmt.addBatch();
pstmt.setInt(1, 4);
pstmt.setString(2, "row 4");
pstmt.addBatch();
pstmt.setInt(1, 5);
pstmt.setString(2, "row 5");
pstmt.addBatch();
pstmt.executeBatch();
rset = stmt.executeQuery("select * from mytest_table");
while (rset.next())
System.out.println(rset.getInt(1) + ", " + rset.getString(2));
catch (Exception e)
e.printStackTrace();
finally
if (stmt != null)
try { stmt.execute("drop table mytest_table"); } catch (Exception e) {}
try { stmt.close(); } catch (Exception e) {}
if (pstmt != null)
try { pstmt.close(); } catch (Exception e) {}
if (conn != null)
try { conn.close(); } catch (Exception e) {}
When I run this class I get the following output
1, row 1
2, row 3
3, row 5
4, null
5,
But It should have been
1, row 1
2, row 2
3, row 3
4, row 4
5, row 5
The same class runs fine if I use Thin driver.
Can anyone please help me solve this issue.
Note: This happens only in case we use setString with Varchar2 in the DB. This works fine if I have two number columns
Thanks,
Raja.SPlease post this question to the Java forum. It is located under "Technologies".
-
Error while connecting to Oracle db using jdbc
When I try to execute a java class which has to access data in
the Oracle db using Jdbc connection, get an error --
Appln- pathname/filename is attempting to call the OCI function
(opinit) this function does not exist in ORA72.DLL.
Exit this appln ? Yes or No
Both oracle db & java are on the same PC.Would like to know what
can be done to rectify this.
Thanks.
nullThe OCI driver 7.3 requires the 7.3 OCI to be installed (this is
part of the client required support files or RSF). The particular
call in question wasn't added to the OCI untill 7.3 so it
wouldn't exist in the 7.2 OCI library.
null
Maybe you are looking for
-
Font smoothing issue between built-in display and external
Ok, this one is a bit tricky to explain, but here we go. I have a Macbook 2.2 C2D and a 24" FHD2400 Gateway LCD which I connect using the mini-DVI port. My problem is that any applications I start with the external display plugged in have slightly "t
-
Hello I am using Tomlink JPA as persistence provider for EJB3. The problem has raised when I tried to remove some entities from a collection. As I have some exprience in Hibernate, I thought all the details entities will be removed when I remove them
-
My Wi-Fi randomly stopped working and will not turn on.
So one night, I closed all my applications and did the regular routine, "procedures" if you will. The next morning, I turned on my MacBook and the Wi-Fi said it was off, and so I turned it on, but it wouldn't turn on. The little icon would stay at th
-
8.0.2 - problem 1 - unable to scroll screen down or up when the keyboard is present. When typing text, I am unable to see the text I am writing due to this problem. Huge problem for emails and other cloud based providers that allow for data text entr
-
Java issue in 10.5?
I can't figure out for the life of me why Java is not rendering an applet correctly for me. I'm trying to run FOREX.com's java trading platform. It renders ok on an older imac 17" running 10.4.1, but when i try to run it on my MBP 15" (same screen re