Data persistence using SQL/J
Hi !
I am trying to achieve data persistence using SQL/J.
The env / tools that I am using are WLS 4.5.1
Oracle 8i, SQL/J.
SQL/J works fine with the two - tier applications but with WLS the connectivity is not been arrived at.
Any help would be wewlcome.
Thanks,
Archana
Are you using an Oracle JDBC driver in WLS or not?
(1) If the answer is no, then you should replace:
oracle.sqlj.runtime.Oracle.connect(<url>,<user>,<pwd>);
(and similarly Oracle.getConnection())
with:
import sqlj.runtime.ref.DefaultContext;
<load JDBC driver, if necessary>
DefaultContext.setDefaultContext(new DefaultContext(<url>,<user>,<pwd>,false));
(2) Actually, forget (1): in the middle tier you should never use a default context at all (every thread must have its own connection context):
DefaultContext ctx = new DefaultContext(...);
#sql [ctx] { ..SQL statement.. };
(3) If you do not use an Oracle JDBC driver, then say in your sqlj command line:
-profile=false
(this omits Oracle customization and makes the .ser file smaller)
Also, you only need runtime.zip at runtime, anyway. And for non-Oracle JDBC drivers you can remove the whole oracle.* hierarchy from runtime.zip.
(4) You do need to deploy those .ser files with the bean. Or use -ser2class and deploy class files with the bean.
(5) Finally, it appears the WLS deployment tool has not heard about SQLJ - it may only understand .java files. In this case you have to translate all .sqlj files (and the .ser files) into .java files before putting these into WLS:
(a) run SQLJ over the .sqlj source with the -compile=false option. This produces .java files.
(b) you can also turn the .ser files into .java files by running:
java sqlj.runtime.profile.util.SerProfileToClass -nc *.ser
(issue the line without arguments to get an option synopsis)
You'd want to do (a) and (b) via a Makefile and not do it by hand more than once.
(c) During deployment time and runtime you must have runtime.zip (modulo comments in (3)) in the respective CLASSPATHS of the deployment tool and of the server.
Sorry these answers were rather generic - I still could not tell exactly how you are failing in WLS.
Similar Messages
-
Checking correct data format using sql query
1) I got column date of joining which accepts date in below format
DD-MON-YYYY
DD-MON-YY
MON-DD-YYYY
MON-DD-YY
Month DD,YYYY
Question:- how do i check whether all dates in Date of joining column are in above format or not using sql query?
2) I got one more date column which accepts date in below format
MMDDYYYY
YYYYMMDD
MM/DD/YYYY
MM/DD/YY
YYYY/DD/MM
Question:- how do i check whether all dates in date column are in above format or not using sql query?
sorry if it is a very simple question since I am new to sql and trying to learn ......Thanks for the answers from the group............In short, NO, it's not possible. If you store dates correctly in the database as DATE datatype then you don't have this problem. If you store them as VARCHAR2 you have a problem.
So, you get a date of 20092012
Is that 20th September 2012? or is it 20th December 2009?
What about...
11-Jan-12
Is that 11th January 2012 or 12th January 2011?
Dates should never be stored on the database as strings. That is why Oracle gives you a DATE datatype so you can store them properly.
Also, when dates are passed from an application to the database, the application should be passing them as DATE datatype, and the application interface should be designed to accept dates from the user in a format specific to their country/locality and it would then know what that format is and automatically convert it to a DATE datatype before it gets anywhere near the database or any SQL. -
Can one build a data warehouse using SQL rather than Warehouse Builder?
I would like to build a data warehouse purely using SQL statements. Where can I find the data warehouse extension of SQL statements?
I am exploring the internal workings of Warehouse Builder.
I have written a SQL script to generate sample data to be inserted into tables, then write SQL script to do Extraction, Transformation and Loading using MERGE,, GROUP BY CUBE, DECODE, etc.
If anyone has any experience of just using SQL to perform ETL, would you share your expeience here? Thanks. -
How to load date column using sql loader
Hi,
I am trying to load a file using sql loader. my date value in the file is '2/24/2009 8:23:05 pm',
In control file for this column i specified like this
rec_date date ''mm/dd/yyyy hh:mi:ss pm"
But i am getting following error
not avalid month.
Thanks
sudheerHi,
Use this example as reference:
CTL file:
LOAD DATA
INFILE 'test.txt'
BADFILE 'test.bad'
truncate INTO TABLE T3
FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '|' TRAILING NULLCOLS
dt_date DATE "mm/dd/yyyy hh:mi:ss pm")DAT file:
2/24/2009 8:23:05 pm
C:\ext_files>sqlldr hr/hr control=test.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Wed Jul 1 20:35:35 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 1
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL> desc t3;
Name Type Nullable Default Comments
DT_DATE DATE Y
SQL> select to_char(dt_date, 'mm/dd/yyyy hh24:mi:ss') from t3;
TO_CHAR(DT_DATE,'MM/DD/YYYYHH2
02/24/2009 20:23:05
SQL> Regards,
Edited by: Walter Fernández on Jul 1, 2009 8:35 PM - Adding example...
Edited by: Walter Fernández on Jul 1, 2009 8:38 PM
Edited by: Walter Fernández on Jul 1, 2009 8:41 PM - Fixing some information... -
Data Loading using SQL* Loader giving errors..
While loading the data using SQL* Loader, I came across the following errors:
- SQL*Loader-00604 Error occurred on an attempt to commit
- ORA-01041 internal error. hostdef extension doesn't exist
My Control and Data files have proper Carriage Returns i.e. the last line of both the files is blank.
So, if somebody know about this, plz help me.
ThanxORA-00604 error occurred at recursive SQL level string
Cause: An error occurred while processing a recursive SQL statement (a statement applying to internal dictionary tables).
Action: If the situation described in the next error on the stack can be corrected, do so; otherwise contact Oracle Support Services
This kind of error occurs when data dictionary is
query a lot.
Joel P�rez -
Multiple date formats using sql developer
Hello!
i have 2 date fields in a table.. one is populated using trunc(<date1>) and the other is to_date(<date2>,'YYYYMMDD HH24MISS'). We want <date1> to display as MM/DD/YYYY and <date2> to display as MM/DD/YYYY HH:MI:SS AMPM. When we set the date format under Preference -> Database -> NLS parameter in SQL Developer with a time format it adds 12:00:00 to <date1>, if we take it out, it drops the time in <date2>. What can we do?
thanks!I think what the original poster wanted was to display the two date columns using different formats in the table "Data" tab and AFAIK that is not possible. Setting a date format in the Preferences accomplishes the same thing as the statement
ALTER SESSION SET NLS_DATE_FORMAT='<some format>';
in command-line SQL*Plus. To do what the OP wants they'll need to create a view that has a SELECT something like this:
SELECT TO_CHAR( date1, 'YYYY-MM-DD' ) date1
, TO_CHAR( date2, 'YYYY-MM-DD HH24:MI:SS') date2
FROM some_table;
One thing the OP needs to keep in mind is that the DATE datatype stores both date and time together. If they insert a date alone, the time defaults to midnight. (This is stated in the Oracle SQL Reference.)
Ed. H. -
Need faster data loading (using sql-loader)
i am trying to load approx. 230 million records (around 60-bytes per record) from a flat file into a single table. i have tried sql-loader (conventional load) and i'm seeing performance degrade as the file is being processed. i am avoiding direct path sql-loading because i need to maintain uniqueness using my primary key index during the load. so the degradation of the load performance doesn't shock me. the source data file contains duplicate records and may contain records that are duplicates of those that are already in the table (i am appending during sql-loader).
my other option is to unload the entire table to a flat file, concatenate the new file onto it, run it through a unique sort, and then direct-path load it.
has anyone had a similar experience? any cool solutions available that are quick?
thanks,
jeffIt would be faster to suck into a Oracle table, call it a temporary table and then make a final move into the final table.
This way you could direct load into an oracle table then you could
INSERT /*+ APPEND */ INTO Final_Table
SELECT DISTINCT *
FROM Temp_Table
ORDER BY ID;This would do a 'direct load' type move from your temp teable to the final table, which automatically merging the duplicate records;
So
1) Direct Load from SQL*Loader into temp table.
2) Place index (non-unique) on temp table column ID.
3) Direct load INSERT into the final table.
Step 2 may make this process faster or slower, only testing will tell.
Good Luck,
Eric Kamradt -
How to read varbinary data type using sql server
Hello,
I'm converted a text file data into varbinary format, and stored in DB table. Now I need to read
Varbinary column and store in Temp table
in sql server.
can some one help on this.
Regards,
Praven
Regards, PraveenI understand this question is related to your previous thread and I believe what Erland suggested is the best way to implement this.
https://social.msdn.microsoft.com/Forums/en-US/a96a8952-0378-4238-9d9d-85b053182174/send-direct-text-file-as-a-input-parameter-to-sp?forum=transactsql
I believe when the user uploads the data its getting uploaded onto the Application Server, You could then open the file and import the files into SQL server(all using application code) and do the manipulations. I believe this is the better way of handling
this.
Also what is the expected file size and what is the kind of data you are expecting?
Satheesh
My Blog | How to ask questions in technical forum -
Hi
I have the following column in my data file
C1,C2,C3,C4,C5,C6
the columns in my table are
A1,A2,A5,A6
the datatype for the columns are varchar.
the value to be inserted is as follow
C1=A1
C2=A2
C5=A5
C6=A6
MY ctl file is as follows
OPTIONS(SKIP=1, ERRORS=99, ROWS=100)
LOAD DATA
APPEND
INTO TABLE xxx
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
A1 "C1",
A2 "C2",
A3 FILLER,
A4 FILLER,
A5 "C5",
A6 "C6"
I got the below error
SQL*Loader-350: Syntax error at line
Expecting "," or ")", found "FILLER".
Requirement is there is not need of the column C3,C4...
(Note i cannot delete the column )
Pls do help me out.
Regards
YramSomething like the below probably could help you if you don’t want to use the keyword FILLER in the CTL file, take a look –
The idea is to use the FULL text to load and then extract the columns from the position required within the string –
Table –
SQL> desc test
Name Null? Type
COL1 VARCHAR2(10)
COL2 VARCHAR2(10)
COL3 VARCHAR2(10)
COL4 VARCHAR2(10)
COL5 VARCHAR2(10)
COL6 VARCHAR2(10)
COL7 VARCHAR2(10)
COL8 VARCHAR2(10)
COL9 VARCHAR2(10)
COL10 VARCHAR2(10)
Data File
Col1x,Col2x,Col3x,col4x,col5x,col6x,col7x,col8x,col9x,col10x
Mapping
Col1 : Collx
Col3 : Col3x
Col5 : Col8x
Col8 : Col10x
*** Rest all the columns not mapped to the Data file
The Control File
Load Data
INFILE '/temp/Shailender/test.dat'
Into TABLE Test
APPEND
TRAILING NULLCOLS
Col1 position(1:61) "Substr(:Col1, 1, INSTR(:col1,',',1)-1)"
,Col3 position(1:61) "Substr(:Col3, INSTR(:col3,',',1,2)+1, ( INSTR(:col3,',',1,3)-INSTR(:col3,',',1,2)-1 ))"
,Col5 position(1:61) "Substr(:Col5, INSTR(:col5,',',1,7)+1, ( INSTR(:col3,',',1,8)-INSTR(:col3,',',1,7)-1 ))"
,Col8 position(1:61) "Substr(:Col8, INSTR(:col8,',',-1)+1)"
SQL> select * from test
2 /
COL1 COL2 COL3 COL4 COL5 COL6 COL7
COL8 COL9 COL10
Col1x Col3x col8x
col10x
Shailender Mehta -
Hi All,
I'm trying generate xml data using data template approach. For this do i need to use XSQL to generate xml data?
Can some one please tell me what is this XSQL and how it works?
Thanks in advance,Hi Srini,
Thank you very much for the link, its elucidates the xml data generation process using data template.
One more question: is this method called (uses) XSQL anywhere??
Thanks, -
Dual Language Data upload using SQL*Loader
I have to load data consisting of English and Traditional Chinese characters into 8.1.5 from external files. These external files are in MS Excel.
Is there any way that I can user SQL*Loader for this ? If yes, how ? If not, is there any other way out.
The NLS in the database is currently AMERICAN.
nullORA-00604 error occurred at recursive SQL level string
Cause: An error occurred while processing a recursive SQL statement (a statement applying to internal dictionary tables).
Action: If the situation described in the next error on the stack can be corrected, do so; otherwise contact Oracle Support Services
This kind of error occurs when data dictionary is
query a lot.
Joel P�rez -
How to display last 10 minutes data only using sql query
Hi,
Presently, I'm using version is,
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production
So, please consider SCOTT Schema to resolve my issue,
I want to display only last 10 minutes what records are inserted or updated or deleted.
Please provide in many ways!!
ThankQ!!Hi,
See below:
select
from
emp
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
14 rows selected
select
from
emp
minus
select
from
emp
as of timestamp (systimestamp - interval '10' minute)
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
0 rows selected
update
emp
set
ename = ename || ' x'
where
empno = 7934
--1 rows updated.
select
from
emp
minus
select
from
emp
as of timestamp (systimestamp - interval '10' minute)
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7934 MILLER x CLERK 7782 23-JAN-82 1300 10
*/For changes, deletes and inserts compair the two result (emp and emp as of timestamp (systimestamp - interval '10' minute) ) with each other.
Regards,
Peter -
pls send ans for this
1b5595eb-fcfc-48cc-90d2-43ba913ea79f wrote:
pls send ans for this
use any text editor to eliminate the dot before loading -
ADF mobile Data sync and sql lite usage
Hi,
We are working on ADF mobile POC.(Jdev version 11.1.2.3.0)
Following Oracle mobile developer guide we generated "Webservice data control" which creates process(object) method to work with Webservice. We created the data-controls and used them in our Java code and are able to get the Webservice response also.
However we want to implement the offline mode feature and for this we are not able to get any document reference for implementation.
With offline mode support is it the application's responsibility to store the data locally using SQL Lite and do the data sync (using Web Service) OR will the framework would do the data sync automatically. Can someone please provide the implementation hint on how to do the Offline mode support in the mobile application using ADF.
Thanks
PavanHi,
With offline mode support is it the application's responsibility to store the data locally using SQL Lite and do the data sync (using Web Service) OR will the framework would do the data sync automatically.
This is all you. In this version of ADF Mobile there is no automatic data synchronization between local data and the server side. The sample that come with the ADF Mobile extension have a SQLLIte example as well, which is in the HR application. Look for the "DBConnectionFactory" file
package application;
import java.sql.Connection;
import java.sql.SQLException;
import oracle.adfmf.framework.api.AdfmfJavaUtilities;
public class DBConnectionFactory {
public DBConnectionFactory() {
super();
protected static Connection conn = null;
public static Connection getConnection() throws Exception {
if (conn == null) {
try {
// create a database connection
String Dir = AdfmfJavaUtilities.getDirectoryPathRoot(AdfmfJavaUtilities.ApplicationDirectory);
String connStr = "jdbc:sqlite:" + Dir + "/HR.db";
conn = new SQLite.JDBCDataSource(connStr).getConnection();
} catch (SQLException e) {
// if the error message is "out of memory",
// it probably means no database file is found
System.err.println(e.getMessage());
return conn;
}The LifeCycleListenerImpl class in the same demo shows how to use this SQL Lite connection
package application;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import javax.el.ValueExpression;
import oracle.adfmf.application.LifeCycleListener;
import oracle.adfmf.framework.api.AdfmfJavaUtilities;
public class LifeCycleListenerImpl implements LifeCycleListener {
public LifeCycleListenerImpl() {
* The start method will be called at the start of the application. Only the
* Application Lifecycle Event listener will be called on start up.
public void start() {
System.out.println("!!!!!!!!!!!!!! App Start !!!!!!!!!!!!!!");
//InitDB();
try {
Statement stat = DBConnectionFactory.getConnection().createStatement();
ResultSet rs = stat.executeQuery("SELECT * FROM EMPLOYEES;");
} catch (SQLException e) {
// if the error message is "out of memory",
// it probably means no database file is found
System.err.println(e.getMessage());
System.out.println("Database does not exist, creating it");
InitDB();
} catch (Exception e) {
System.err.println(e.getMessage());
System.out.println("!!!!!!!!!!!!!! Done App Start !!!!!!!!!!!!!!");
* The stop method will be called at the termination of the application. Only
* the Application Lifecycle Event listener will be called on start up.
* NOTE: Depending on how the application is being shutdown, this method may
* or may not be called. Features should save off their state in the deactivate
* handler.
public void stop() {
// Add code here...
* The activate method will be called when the feature is activated. The
* Application Lifecycle Event listener will be called on application
* being started and resumed.
public void activate() {
// Add code here...
* The deactivate method will be called when the feature is deactivated. The
* Application Lifecycle Event listener will be called on application
* being hibernated.
public void deactivate() {
// Add code here...
private void InitDB() {
try {
System.out.println("!!!!!!!!!!!!!!InitDB Start!!!!!!!!!!!!!!");
ClassLoader cl = Thread.currentThread().getContextClassLoader();
InputStream is = cl.getResourceAsStream(".adf/META-INF/hr.sql");
if (is == null) {
System.err.println("###### Could not look up : /META-INF/hr.sql");
return;
BufferedReader bReader = new BufferedReader(new InputStreamReader(is));
List stmts = new ArrayList();
String strstmt = "";
String ln = bReader.readLine();
while (ln != null) {
if (ln.startsWith("REM") || ln.startsWith("COMMIT")) {
ln = bReader.readLine();
continue;
strstmt = strstmt + ln;
if (strstmt.endsWith(";")) {
System.out.println(strstmt);
stmts.add(strstmt);
strstmt = "";
ln = bReader.readLine();
continue;
ln = bReader.readLine();
DBConnectionFactory.getConnection().setAutoCommit(false);
for (int i = 0; i < stmts.size(); i++) {
Statement pStmt = DBConnectionFactory.getConnection().createStatement();
pStmt.executeUpdate((String)stmts.get(i));
DBConnectionFactory.getConnection().commit();
System.out.println("!!!!!!!!!!!!!!InitDB Done!!!!!!!!!!!!!!");
} catch (Exception e) {
e.printStackTrace();
}Hope this is what you were looking for
Frank -
Use evdre to query data from a SQL View
Hi all
I believe that it is possible to use evdre to query data from a SQL View. If this is possible then how does one go about setting it up in the evdre options (assuming that the view has already been created)?
Regards,
ByronByron, perhaps this is no longer supported, it might be worth opening up a case at service.sap.com on this. However, I did find the following on Page 11 of the "Usages and Considerations of EVDRE" pdf file. This doc is imbedded in the helpfile for BPC 7 SP5 (which was released in August of 2009, well after note 1315011 was last updated.
It looks like you are limited to one custom view per application, since you have to name the view in a parameter at the APPLICATION level. Go into BPC Administration, login to the application related to the custom view, choose "Set Application Parameters" and enter the name of the view to the Application Parameter called "EVDRE_QUERYVIEWNAME" If it is not listed, go ahead and create it at the bottom of the Application parameter screen.
Also: I interpreted the following info from Page 10 of the same doc:
In your EVDRE, set the following options:
QueryEngine: MANUAL
QueryType: enter either NEXJ OR TUPLE see below:
NEXJ - Use two-dimensional queries using the nonemptycrossjoin function
TUPLE - Use two-dimensional queries using tuples"
And I'm assuming you'd enter a Y for the following two parameters:
QueryViewName
"..to enforce the query engine to use a used-defined SQL view of the fact tables, when trying to read the values using SQL queries. This option is typically used in conjunction with the SQLOnly option (see below). "
Option SQLOnly
"..to enforce the query engine to only execute SQL queries, when reading data. This can be achieved using this option."
Maybe you are looking for
-
How to select multiple records in the ALV POP UP by using oops
Hi All, We have a requirement of ALV POP UP by using the OOPS. How to select the multiple records in the POP UP and After selecting that i want do Inteactive ALV means again one more POP UP in ALV. Thanks for help.... Regards, Bharani
-
Transformation in SAP BI 7.0 routine
Hi together, if got the following problem I don't understand. I've got a transformation between 2 DSO's. Some characteristics in the target-ods are filled with routines. The code for one of the characteristics: Global Part of the routine: $$ begin of
-
Dear All, In Adapter Monitoring, i am not able to see the JDBC adapter in the Onlly Installed and Started Adapters, but i am able to see the JDBC Adapter in the All Adapters. When i tried to restart the JDBC adapter service in the Visual Administrati
-
E-mail receivers get a warning
Since upgrading to snow leopard, when I forward or reply an e-mail message to a pc user, they get a warning message that the e-mail may be infected. Yet when I send a new e-mail message they do not get any warnings. What could be wrong?
-
Post wisely. Bear in mind that whatever you have posted is your responsibility and you are liable for its content. Always check the little description under each Forum board and decide which best suit your new thread. Posting in an appropriate Forum