The problem about java.sql.CallableStatement
we need call oracle store procedure to get a record set.
the code below is the oracle's pl/sql program for test
package test2 as
type sample_record is record(id char(4),
name varchar2(10),
addr varchar2(30));
type sample_cursor is ref cursor return sample_record;
function get_resultset return sample_cursor;
end;
package body test2 as
function get_resultset return sample_cursor is
p_cursor sample_cursor;
begin
open p_cursor for select 'aaaa' id,'John' name,'guangzhou' addr from dual;
return p_cursor;
end get_resultset;
end;
and ,in java,how to use java.sql.CallableStatement to
run the store procedure to get the cursor,a sql type define in our oracle programme
see the code below,
public static sun.jdbc.rowset.WebRowSet testmethod(){
Connection conn = null ;
CallableStatement cstmt = null ;
String str = null ;
ResultSet result = null ;
str = "{?=call test2.get_resultset()}" ;
try
conn = DbPool.getConnection() ;
cstmt = conn.prepareCall(str) ;
cstmt.registerOutParameter(1, OracleTypes.CURSOR);
cstmt.execute();
result = (java.sql.ResultSet)cstmt.getObject(1) ;
sun.jdbc.rowset.WebRowSet wrs = new sun.jdbc.rowset.WebRowSet() ;
wrs.populate(result) ;//in this statement,it will throw a NullPointerException
return wrs;
catch (Exception e)
CommLog.writeLog("pr", "PrLogic test: " + e.toString()) ;
return null ;
}finally
try
result.close() ;
catch (Exception e3)
try
cstmt.close() ;
catch (Exception e1)
try
conn.close() ;
catch (Exception e2)
}
Similar Messages
-
The problem about Java media framework
Excuse me, How to use Real Time Protocol Vedio with web camera?
My program can use MIC, but can't found camera?
Please Help meHi,
You can try a package named: JTwain, which is available at http://asprise.com/product/jtwain.
JTwain supports all kinds of digital cameras and scanners. You can use Java to access, contorl digital cameras and scanners, and of course, to acquire images with flexible settings.
The developers' guide is available @ http://asprise.com/product/jtwain/devGuide.php
In the simplest case, one line of Java code can solve your problem.
Good luck! -
Problem Writing java.sql.Date to MS Access
I have a relatively simple application that is for my own use (not distributed on an enterprise-wide basis). As I don't have an IT staff, I'm using a rudimentary Java front-end (v1.3.1) and a Microsoft Access backend.
I seem to have trouble using INSERT/UPDATE statements with the MS Access Date/Time data type. Below is an example of code being used (id is defined as Text, amount is a Number and timestamp is Date/Time):
conn = DriverManager.getConnection("jdbc:odbc:markets", "", "");
conn.setAutoCommit(true);
String sql = "INSERT INTO temp (id, amount, timestamp) VALUES (?, ?, ?)";
PreparedStatement stmt = conn.prepareStatement(sql);
String id = args[0];
int len = id.length();
java.sql.Date dt = new java.sql.Date(new java.util.Date().getTime());
stmt.setString(1, id);
stmt.setDouble(2, id.length());
// I think the problem is here - the JDBC driver doesn't properly map dates to Access???
stmt.setDate(3, dt);
stmt.execute();
stmt.close();
conn.close();And I get the following error:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access
Driver] Syntax error in INSERT INTO statement.
at sun.jdbc.odbc.JdbcOdbc.createSQLException (JdbcOdbc.java:6879)
at sun.jdbc.odbc.JdbcOdbc.standardError (JdbcOdbc.java:7036)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect (JdbcOdbc.java:3065)
at sun.jdbc.odbc.JdbcOdbcStatement.execute (JdbcOdbcStatement.java:338)
at TestWritingDate.main(TestWritingDate.java:31) I'm virtually certain this is a translation problem with
the java.sql.Date and the JDBC driver. But I can't seem
to overcome this. Any help is DESPERATELY needed.
Thanks.
MattThat was it....thanks...didn't even consider that....perhaps I should start using class names that are already in use too :-). Thanks again...
-
Hello apple
I have the problem with my iPhone and my friends have this problem too.
My iPhone have the problem about calling and answer the call. When I use my iPhone to call I can't hear anything from my iPhone but the person that I call can answer it but when answer both of us can't hear anything and when I put my iPhone to my face the screen is still on and when I quit the phone application and open it again it will automatic call my recent call. And when my friends call me my iPhone didn't show anything even the missed call I'm only know that I missed the call from messages from carrier. Please check these problem I restored my iPhone for 4 time now in this week. I lived in Hatyai, Songkhla,Thailand and many people in my city have this problem.
Who have this problem??Apple isnt here. this is a user based forum for technical questions. The solution is to restart, reset, and restore as new which is in the manual after that get it replaced for hard ware failure. if your within your one year warranty its replaced if it is out of the warranty then it is 199$
-
I've got the problem about sharing the screen
Hi, i bought iMac 21.5 (Late 2013), i'v upgraded it to the Mavericks. I've got the problem about sharing the display, i have thunderbolt to hdmi adapter and while i plug it to my TV, it doesn't work, it has no signal on TV, can someone help me ?? Thank Yo
Hello Gukakila
Start your troubleshooting with the article below. Try out the cable on a different tv or monitor to see if it shows up there. You may also need to reset the SMC and Parameter Ram.
Apple computers: Troubleshooting issues with video on internal or external displays
http://support.apple.com/kb/ht1573
Regards,
-Norm G. -
Some problems about oracle.sql.CharacterSet.java
When I debugging a program,which should execute an insert statement into Oracle database,but I found there's missing Oracle.sql.CharacterSet.java source file,and some errors occur:
java.sql.SQLException: ORA-01400: cannot insert NULL into ("EPICS"."IOC_DB_FILE_ASGN"."EXT_SRC_FILE_NM")
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:304)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:271)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:622)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:180)
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:542)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1027)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2887)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:2978)
at gov.sns.apps.jeri.apps.dbimport.DBFileParser.updateDBFileIOCData(DBFileParser.java:3028)
at gov.sns.apps.jeri.apps.dbimport.DBFileParser.saveToDatabase(DBFileParser.java:2930)
at gov.sns.apps.jeri.apps.dbimport.DBImportFrame$19.run(DBImportFrame.java:640)
at java.lang.Thread.run(Thread.java:534)
The database is Oracle 10g,and development tools is Jdeveloper10g。I have added oracle_home/jdbc/lib/classes12.jar into the classpath.but it doesn't work。I hope someone can tell me what's the matter and how to get the source file of CharacterSet.java?I'll be very grateful for your help!Thank you very much!hello user457523
I have found the reason to that error.It's because there's a trigger and ext_src_file_nm is populated by the trigger from another column ext_src_file_loc when inserting and I didn't give any value to ext_src_file_loc so ext_src_file_nm is null.
I have disabled that trigger and now I get new errors.When I traced to a line of Jave code I got missing source file warning,and the source file is also oracle.sql.CharacterSet.java.I can not trace into the source file and then I skipped that code and then I got new errors.I want to know how to trace into the jave code and find what's the matter.
Thank you very much. -
Problem with java.sql.Clob and oracle.sql.CLOB
Hi,
I am using oracle9i and SAP web application server. I am getClob method and storing that in java.sql.Clob and using the getClass().getName() I am getting the class name as oracle.sql.CLOB. But when I am trying to cast this to oracle.sql.CLOB i am getting ClassCastException. The code is given below
java.sql.Clob lOracleClob = lResultSet.getClob(lColIndex + 1);
lPrintWriter = new PrintWriter(new BufferedWriter (((oracle.sql.CLOB) lOracleClob).getCharacterOutputStream()));
lResourceStatus = true;
can anybody please tell me the what is the problem with this and solution.
thanks,
Ashok.Hi Ashok
You can get a "ClassCastException" when the JVM doesn't have access to the specific class (in your case, "oracle.sql.CLOB").
Just check your classpath and see if you are referring to the correct jar files.
cheers
Sameer
PS: Please award points if you find the answer useful -
A problem about Ms Sql 7 - Oracle 8.1.5 ?
hi
I used OMWB to migrate MS sql 7 to Oracle 8.1.5, both of our env are on chinese character set,it worked well. Thank OMWB work team. The whole process of migration did't meet any problem. But I met a problem about character set,I don't see right content on CLOB column,all data in CLOB columns are like the following something :
0F5C3A53A44E1A904575BE8FBF4F776302303052FD56388D01303100380006529F943052B065164E
I maped text datatype of SQL to CLOB datatype,I can see the right data directly in SQL by select command,but I can't see the right data in SQL*PLUS.
How can I do? Migration workbanch don't support the multi-bit char set such as chinese?
nullI already knew the solution of the problem,but I met another problem.
I checked my sql 7 database again, I found large columns are ntext datatype. I changed the ntext to text and migrated data again. In SQL*PLUS ,I found the data of clob columns change to '????.?-?'. I know this is caused by NLS_LANG, my NLS_LANG=simplified chinese_china.zhs16gbk. How do i set my nls_lang to get the right data?
null -
Problem saving java.sql.timestamp
I am using java.sql.timestamps for all date fields inside the database.
the client program is using a session bean to insert the data into the database. Afterwards when I do a select in sql plus the date is always 2 hours and 30 minutes above the value I supplied to the database.
Are there any timezone settings I have to supply on the server ?
thx in advance
nullPlease shrink your code down to the bare minimum that compiles and demonstrates the problem. Do not include any tests that pass. Just the one that fails, and describe clearly exactly how it fails--what's expected and what is observed instead.
You can probably even get rid of the separate test class and just put it all in main, or at least all in the same class with main and one or a small handful of other methods. -
Help! problem about jstl sql with "LIKE?" in query
Hi All,
I have a problem about getting data by using "LIKE" in my sql statment.
here is my case:
<sql:query var="tmp">
SELECT ...... FROM ...
WHERE a LIKE ?
<sql:param value="%${param.a}%"/>
</sql:query>
Once I used "LIKE" keyword, the query failed to use this critica.
and couldn't find any match cases
thx or help
Michealbesides, i found that:
this works:
"AND a.block LIKE '%' + 'a' + '%'"
but these don't work:
"AND a.block LIKE '%' + 'a' + '' + '%'"
or
"AND a.block LIKE '' + '%' + 'cp' + '%'"
or
"AND a.block LIKE '%' + 'cp' + '%' + ''"
it seems '' is the casue of error... so strange, anyone has idea?
micheal -
hello there...:) this is veeery strange error:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]ResultSet can not re-read row data for column 5.
and what next?
(in DB this column type is "text" and Java can not read it and convert to "String".
I've tried:
String zzz = (String) ResultSet.getObject("columnName");
and even
convert(varchar(2000),columnName) columnName)
in SQL and still having the same error)
does someone know what to do next?
I'll recieve any suggestions with big pleasure :)This is one of the gotchas with JDBC. From the JavaDoc for ResultSet: "For maximum portability, result set columns within each row should be read in left-to-right order, and each column should be read only once."
With some drivers you can read the columns out of sequence and multiple times, others you can't.
The first time you hit this problem it drives you insane (I know it did me). -
The problem about settuping up the development Enviroment for OA
Hi, All
I just began to learn the development of OA Framework, I met the problem of setting up the dev environment by using jdevelop 9i OA
extension.
The following is steps of setting up the env by referrring to the "Oracle Application Framework Developer's guide".
1, set the environment variable JDEV_USER_HOME to <jdeveloper dir>\jdevhome\jdev
2. copy the DBC file from <EBS install dir>\visappl\fnd\11.5.0.\secure in EBS server to the local machine.
3. create a tester user and assign it the responsibility "OA Framework ToolBox Turtorial" and "OA Framework ToolBox Turtorial
Labs" in EBS
4. create a database connection. set the connection type as Oracle(JDBC), username and password as "Apps" and "Apps" , Set the
hostname and SID the same values as those specified in the DBC file. And the connection is created successfully.
5. Then open the toolbox.jws (The sample code in the jdeveloper9i)
i) select the tutorial.jpr , select Project > Project Setting -> Runtime Connectiong. setting the "DBC File Name" to the
DBC file path in local machine. setting the "user name" and password to EBS user I just created in step 3. Set the Application Short Name
to "AK" and Responsibility Key as "FWK_TBX_TUTORIAL".
ii) right click tutorial.jpr. select "Edit Business Components Poject..." -> Connection . choose the Connection created in step 4.
6. setting the same configuration for LabSolutions.jpr.
7. After all these setting , then rebuild the toolbox.jws and run the project. It took a long time to display the test_fwktutorial.jsp and when I click the link in it. I wil get an error page. The Detail Info is the following:
oracle.apps.fnd.framework.OAException: Application: FND, Message Name: FND_GENERIC_MESSAGE. Tokens: MESSAGE = oracle.adf.mds.exception.MDSRuntimeException; (Could not lookup message because there is no database connection) at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:888) at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1145) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1960) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418) at OA.jspService(OA.jsp:40) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306) at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:209) at com.evermind.server.http.GetParametersRequestDispatcher.forward(GetParametersRequestDispatcher.java:189) at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:199) at OA.jspService(OA.jsp:45) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803) at java.lang.Thread.run(Thread.java:534)
I'm not sure whether my configuration is set correctly. can anyboy help to figure it out, thansk in advancer u able to connect to schema from sqlplus ??
I suspect check that first ,also see if you are able to TNS ping to the SID you have mentioned and if the port and hostname is correctly specified in ur dbc file .
here is my dbc file .. if it helps
#DB Settings
#Mon Mar 20 07:58:34 CST 2006
FND_JDBC_USABLE_CHECK=false
APPS_JDBC_DRIVER_TYPE=THIN
APPL_SERVER_ID=1EDB3E51DEE569E3E0440003BA68147136073878907234418604230042147702
TWO_TASK=IG10B
FND_JDBC_STMT_CACHE_SIZE=200
FND_JDBC_CONTEXT_CHECK=true
FND_JDBC_BUFFER_DECAY_SIZE=5
FND_JDBC_BUFFER_DECAY_INTERVAL=300
FND_JDBC_BUFFER_MAX=5
GUEST_USER_PWD=GUEST/ORACLE
FND_JDBC_STMT_CACHE_FREE_MEM=TRUE
FND_JDBC_BUFFER_MIN=1
DB_HOST=<host Name>
FND_JDBC_PLSQL_RESET=false
FNDNAM=APPS
FND_MAX_JDBC_CONNECTIONS=500
GWYUID=APPLSYSPUB/PUB
APPS_JDBC_URL=jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=YES)(FAILOVER=YES)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=maxcold)(PORT=1525)))(CONNECT_DATA=(SID=IG10B)))
DB_PORT=1525 -
Dear all,I have a problem about vrrp,my core switch is cisco 3750x and huawei S5700-28C-EI, after I configured vrrp between them,the switch log got the error problem as follow:
*Jan 11 00:01:43.111: %VRRP-6-STATECHANGE: g1/0 Grp 3 state Backup -> Master
*Jan 11 00:01:43.111: VRRP: tbridge_smf_update failed
*Jan 11 00:01:44.187: VRRP: Advertisement from 10.252.200.34 has an incorrect group 10 id for interface g1/0
*Jan 11 00:01:46.539: VRRP: Advertisement from 10.252.200.36 has an incorrect group 10 id for interface g1/0
*Jan 11 00:01:50.323: VRRP: Advertisement from 10.252.200.34 has an incorrect group 10 id for interface g1/0
*Jan 11 00:01:51.707: VRRP: Advertisement from 10.252.200.36 has an incorrect group 10 id for interface g1/0
*Jan 11 00:01:52.079: VRRP: Advertisement from 10.252.200.34 has an incorrect group 10 id for interface g1/0
*Jan 11 00:01:53.079: VRRP: Advertisement from 10.252.200.34 has an incorrect group 10 id for interface g1/0
If cisco and huawei cannot interconnect with each other?Can you post the interface config from the huawei and cisco device?
HTH,
John
*** Please rate all useful posts *** -
Help me sort out the problems with Java 2 SDK SE
I install Java SDK 2 standard Eddition version 1.4 in my computer (Window NT4). When I test the installation by typing in "java -version", it displays the following message.
C:\JavaPractice>java -version
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
But, When I compile a simple programme, it doesn't work and displays the following message.
C:\JavaPractice>javac HelloDan.java
The name specified is not recognized as an
internal or external command, operable program or batch file.
Could anybody help me sort out the problem, Please?i might guess that you have j2sdk1.4.0\jre\bin on your PATH, but not j2sdk1.4.0\bin ...
Larry -
How can I get rid of the alert about java during startup?
I am currently on OS X LION 10.7.2 and everytime I start my MacAir(2010 version), there's this flash of a popup that goes away too quickly. I was able to read the first few words and it states "Do you want to.....Java.....?" SO it's something about Java. I've manually installed it in my MacAir already but it still pops up and goes away. It's kind of annoying. Help???
Hi nur.dta,
You can check to see if it's enabled in start-up options. Go into System Preferences > Users & Groups > Login Items
You can see if it is in there and remove it. You'll need to authenticate prior to removing it.
Maybe you are looking for
-
My iPhone is not recognized by my Windows Vista or by iTunes anymore!
Hello all! I would greatly appreciate any help that anyone can offer that would point me in the right direction. I have an iPhone 4 (AT&T) that works fine. I have a Gateway Fx MS2252 P-7805U laptop operating Windows Vista Home Premium at 64-bit. I
-
External Content Typ: "Connection manager did not return valid connection."
Hi, I created an external content typ in the sharepoint designer which takes my custom WCF Service as a data source. I sucessfully added all my required operations and created a new list based on the new content typ. At first I had a security issue w
-
How to avoid the port in portal
Hi Gurus, Please help me on this we have implementd SSL in our portal EP7.0 my question is i needs to avoid the port No. now and give normal url now the url is https://<host>.<company>:50001/irj/portal now want to change it to https://host.company/ir
-
I can't go to the previous/next page by swiping left/right
I am using Asus Vivobook Win 8, I can go to the previous webpage by swiping left with 3 fingers. I can do the same with Chrome but am wondering why this is not possible in firefox. Thanks!
-
Restore toolbar / menu bar / gear icon Safari Windows
Hi Some combination of keys got pressed and now I have no toolbar, menu bar or gear icon on Safari. Ctrl-shift-\ doesn't do anything either. Every post I've seen mentions clicking on buttons I don't have. The only bar I have is my bookmarks bar, and