Jdbc date minus nowDate
I am trying to rest todays date minus a date coming from mySQL data base:
// I get no.sentDate in the format YYYY - MM - DD
conWorkPartyID = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
String sWorkOrderID = "select co.orderPartyid, no.workOrderListPartyid, wl.workOrdListDesc, no.sentDate from contractorOrders as co "+
"left join newOrders as no on no.orderPartyid = co.orderPartyid "+
"left join workOrderList as wl on wl.workOrderListPartyID = no.workOrderListPartyid "+
"where co.flagSentToContractor = 0 and co.contractorPartyid =" + sCompany;
cWorkPartyID = conWorkPartyID.executeQuery(sWorkOrderID);
while(cWorkPartyID.next()){
//this is the date that i need, which comes from db
Calendar cal = Calendar.getInstance();
Date dateTest = cWorkPartyID.getDate("no.sentDate", cal);
//get today's date
Date Now = new Date();
//rest today's date minus the date coming from db
cal.setTime(new Date(Now.getTime() - dateTest.getTime()));
//difference = cal.getTime();
//stores the years difference, which probably won't be needed
int year = cal.get(Calendar.YEAR);
//the varible months stores the months which probably won't be needed
int month = cal.get(Calendar.MONTH);
//the varible day stores who many days difference are there
int day = cal.get(Calendar.DAY_OF_MONTH);
System.out.println("and the difference between the insertDate and the today is in days: "
+ String.valueOf(day));
and the error is a java.lang.NullPointerException, any suggestions to change the above will be very much appreciated.
Thank you
Thanks for the reply, I found the problem, i was returning no.sentDate in the form YYYY-MM-DD and method getTime doesn't like so it was returning null, so what I have done was cast(no.sentDate as datetime) and also store the difference of the dates as a long variable as I need the difference between the dates not the day of the month.
My code now looks like this:
conWorkPartyID = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
String sWorkOrderID = "select co.orderPartyid, no.workOrderListPartyid, wl.workOrdListDesc, cast(no.sentDate as datetime) as newDate from contractorOrders as co "+
"left join newOrders as no on no.orderPartyid = co.orderPartyid "+
"left join workOrderList as wl on wl.workOrderListPartyID = no.workOrderListPartyid "+
"where co.flagSentToContractor = 0 and co.contractorPartyid =" + sCompany;
cWorkPartyID = conWorkPartyID.executeQuery(sWorkOrderID);
while(cWorkPartyID.next()){
Object x = cWorkPartyID.getObject("co.orderPartyid");
Object y = cWorkPartyID.getObject("no.workOrderListPartyid");
Object z = cWorkPartyID.getObject("wl.workOrdListDesc");
Date dateTest = cWorkPartyID.getDate("newDate");
Date Now = new Date();
System.out.println("dateTest is: " + dateTest.getTime());
long dif = ((Now.getTime() - dateTest.getTime())/86400000);// milliseconds to days
System.out.println("Order PartyID that require your attention is : "+ x + " and workOrderPartyid: " + y +" and WorkOrderListDesc: "
+ z + " and the sent date is: "+ dateTest + "and the difference between the insertDate and the today is in days: "
+ dif);
cWorkPartyID.close();
Any other suggestions are welcome.
Thanks for answering so soon.
Good night!
Similar Messages
-
Standalone application can't get JDBC data source from Weblogic 10.3
We have the following configuration :
A Weblogic server 10.3 (default installation).
The server contains a JMS queue (jndi name: "DMQ") and JDBC data sources (jndi names: Oracle thin XA - "dataSource", MS SQL - "dataSource1")
We have built wlfullclient5.jar for Java 1.5 ([http://edocs.bea.com/wls/docs103/client/jarbuilder.html#wp1078122]) (according to the docs)
And now we use a test standalone application with the wlfullclient5.jar :
public static void main (String[] args) throws NamingException {
bq. Hashtable<String, String> env = new Hashtable<String, String>(); \\ env.put(Context.+INITIAL_CONTEXT_FACTORY+, "weblogic.jndi.WLInitialContextFactory"); \\ env.put(Context.+PROVIDER_URL+, "http://serv1:7001"); \\ env.put(Context.+SECURITY_CREDENTIALS+, "weblogic"); \\ env.put(Context.+SECURITY_PRINCIPAL+, "weblogic"); \\ InitialContext ic = new InitialContext(env); \\ \\ System.+out+.println("Get DMQ"); \\ ic.lookup("DMQ"); \\ System.+out+.println("Get dataSource"); \\ ic.lookup("dataSource");
bq. System.+out+.println("Get dataSource1"); \\ ic.lookup("dataSource1"); \\ System.+out+.println("Done"); \\
Here is the output when connected to WLS 10.3:
bq. Get DMQ \\ Get dataSource \\ Exception in thread "Main Thread" java.lang.AssertionError: Failed to generate class for weblogic.jdbc.common.internal.RmiDataSource_1030_WLStub \\ at weblogic.rmi.internal.StubGenerator.generateStub(_StubGenerator.java:790_) \\ at weblogic.rmi.internal.StubGenerator.generateStub(_StubGenerator.java:779_) \\ at weblogic.rmi.extensions.StubFactory.getStub(_StubFactory.java:74_) \\ at weblogic.rmi.internal.StubInfo.resolveObject(_StubInfo.java:213_) \\ at weblogic.rmi.internal.StubInfo.readResolve(_StubInfo.java:207_) \\ at sun.reflect.NativeMethodAccessorImpl.invoke0(_Native Method_) \\ at sun.reflect.NativeMethodAccessorImpl.invoke(_NativeMethodAccessorImpl.java:39_) \\ at sun.reflect.DelegatingMethodAccessorImpl.invoke(_DelegatingMethodAccessorImpl.java:25_) \\ at java.lang.reflect.Method.invoke(_Method.java:585_) \\ at java.io.ObjectStreamClass.invokeReadResolve(_ObjectStreamClass.java:1033_) \\ at java.io.ObjectInputStream.readOrdinaryObject(_ObjectInputStream.java:1728_) \\ at java.io.ObjectInputStream.readObject0(_ObjectInputStream.java:1305_) \\ at java.io.ObjectInputStream.readObject(_ObjectInputStream.java:348_) \\ at weblogic.utils.io.ChunkedObjectInputStream.readObject(_ChunkedObjectInputStream.java:197_) \\ at weblogic.rjvm.MsgAbbrevInputStream.readObject(_MsgAbbrevInputStream.java:564_) \\ at weblogic.utils.io.ChunkedObjectInputStream.readObject(_ChunkedObjectInputStream.java:193_) \\ at weblogic.rmi.internal.ObjectIO.readObject(_ObjectIO.java:62_) \\ at weblogic.rjvm.ResponseImpl.unmarshalReturn(_ResponseImpl.java:240_) \\ at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(_ClusterableRemoteRef.java:348_) \\ at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(_ClusterableRemoteRef.java:259_) \\ at weblogic.jndi.internal.ServerNamingNode_1030_WLStub.lookup(Unknown Source) \\ at weblogic.jndi.internal.WLContextImpl.lookup(_WLContextImpl.java:392_) \\ at weblogic.jndi.internal.WLContextImpl.lookup(_WLContextImpl.java:380_) \\ at javax.naming.InitialContext.lookup(_InitialContext.java:351_) \\ at test.main(_test.java:23_) \\ Caused by: java.lang.reflect.InvocationTargetException \\ at sun.reflect.NativeConstructorAccessorImpl.newInstance0(_Native Method_) \\ at sun.reflect.NativeConstructorAccessorImpl.newInstance(_NativeConstructorAccessorImpl.java:39_) \\ at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(_DelegatingConstructorAccessorImpl.java:27_) \\ at java.lang.reflect.Constructor.newInstance(_Constructor.java:494_) \\ at weblogic.rmi.internal.StubGenerator.generateStub(_StubGenerator.java:788_) \\ at weblogic.rmi.internal.StubGenerator.generateStub(_StubGenerator.java:779_) \\ at weblogic.rmi.extensions.StubFactory.getStub(_StubFactory.java:74_) \\ at weblogic.rmi.internal.StubInfo.resolveObject(_StubInfo.java:213_) \\ at weblogic.rmi.internal.StubInfo.readResolve(_StubInfo.java:207_) \\ at sun.reflect.NativeMethodAccessorImpl.invoke0(_Native Method_) \\ at sun.reflect.NativeMethodAccessorImpl.invoke(_NativeMethodAccessorImpl.java:39_) \\ at sun.reflect.DelegatingMethodAccessorImpl.invoke(_DelegatingMethodAccessorImpl.java:25_) \\ at java.lang.reflect.Method.invoke(_Method.java:585_) \\ at java.io.ObjectStreamClass.invokeReadResolve(_ObjectStreamClass.java:1033_) \\ at java.io.ObjectInputStream.readOrdinaryObject(_ObjectInputStream.java:1728_) \\ at java.io.ObjectInputStream.readObject0(_ObjectInputStream.java:1305_) \\ at java.io.ObjectInputStream.readObject(_ObjectInputStream.java:348_) \\ at weblogic.utils.io.ChunkedObjectInputStream.readObject(_ChunkedObjectInputStream.java:197_) \\ at weblogic.rjvm.MsgAbbrevInputStream.readObject(_MsgAbbrevInputStream.java:564_) \\ at weblogic.utils.io.ChunkedObjectInputStream.readObject(_ChunkedObjectInputStream.java:193_) \\ at weblogic.rmi.internal.ObjectIO.readObject(_ObjectIO.java:62_) \\ at weblogic.rjvm.ResponseImpl.unmarshalReturn(_ResponseImpl.java:240_) \\ at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(_ClusterableRemoteRef.java:348_) \\ at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(_ClusterableRemoteRef.java:259_) \\ at weblogic.jndi.internal.ServerNamingNode_1030_WLStub.lookup(Unknown Source) \\ at weblogic.jndi.internal.WLContextImpl.lookup(_WLContextImpl.java:392_) \\ at weblogic.jndi.internal.WLContextImpl.lookup(_WLContextImpl.java:381_) \\ at javax.naming.InitialContext.lookup(_InitialContext.java:351_) \\ at test.main(_test.java:26_) \\ Caused by: java.lang.ArrayIndexOutOfBoundsException: 6 \\ at weblogic.jdbc.common.internal.RmiDataSource_1030_WLStub.ensureInitialized(Unknown Source) \\ at weblogic.jdbc.common.internal.RmiDataSource_1030_WLStub.<init>(Unknown Source) \\ at sun.reflect.NativeConstructorAccessorImpl.newInstance0(_Native Method_) \\ at sun.reflect.NativeConstructorAccessorImpl.newInstance(_NativeConstructorAccessorImpl.java:39_) \\ at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(_DelegatingConstructorAccessorImpl.java:27_) \\ at java.lang.reflect.Constructor.newInstance(_Constructor.java:494_) \\ at weblogic.rmi.internal.StubGenerator.generateStub(_StubGenerator.java:788_) \\ at weblogic.rmi.internal.StubGenerator.generateStub(_StubGenerator.java:779_) \\ at weblogic.rmi.extensions.StubFactory.getStub(_StubFactory.java:74_) \\ at weblogic.rmi.internal.StubInfo.resolveObject(_StubInfo.java:213_) \\ at weblogic.rmi.internal.StubInfo.readResolve(_StubInfo.java:207_) \\ at sun.reflect.NativeMethodAccessorImpl.invoke0(_Native Method_) \\ at sun.reflect.NativeMethodAccessorImpl.invoke(_NativeMethodAccessorImpl.java:39_) \\ at sun.reflect.DelegatingMethodAccessorImpl.invoke(_DelegatingMethodAccessorImpl.java:25_) \\ at java.lang.reflect.Method.invoke(_Method.java:585_) \\ at java.io.ObjectStreamClass.invokeReadResolve(_ObjectStreamClass.java:1033_) \\ at java.io.ObjectInputStream.readOrdinaryObject(_ObjectInputStream.java:1728_) \\ at java.io.ObjectInputStream.readObject0(_ObjectInputStream.java:1305_) \\ at java.io.ObjectInputStream.readObject(_ObjectInputStream.java:348_) \\ at weblogic.utils.io.ChunkedObjectInputStream.readObject(_ChunkedObjectInputStream.java:197_) \\ at weblogic.rjvm.MsgAbbrevInputStream.readObject(_MsgAbbrevInputStream.java:564_) \\ at weblogic.utils.io.ChunkedObjectInputStream.readObject(_ChunkedObjectInputStream.java:193_) \\ at weblogic.rmi.internal.ObjectIO.readObject(_ObjectIO.java:62_) \\ at weblogic.rjvm.ResponseImpl.unmarshalReturn(_ResponseImpl.java:240_) \\ at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(_ClusterableRemoteRef.java:348_) \\ at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(_ClusterableRemoteRef.java:259_) \\ at weblogic.jndi.internal.ServerNamingNode_1030_WLStub.lookup(Unknown Source) \\ at weblogic.jndi.internal.WLContextImpl.lookup(_WLContextImpl.java:392_) \\ at weblogic.jndi.internal.WLContextImpl.lookup(_WLContextImpl.java:380_) \\ at javax.naming.InitialContext.lookup(_InitialContext.java:351_) \\ at test.main(_test.java:23_)
But at the same time the output when connected to WLS 10.0 is :
Get DMQ \\Get dataSource \\Get dataSource1 \\Done
(so that the test passed)
Could you give me a piece of advice ?
Thanks,
SergeyI hit the same problem as yours. This issue is caused by JDK version. The JDK used by Weblogic 10.3 is java 6, while your client program's jdk version is java5. So change the both of them to java 6. This issue will be fixed.
Don't forget to rebuild the wlfullclient.jar which also should be java 6.
Good luck! -
How to set JDBC Data Sources in Oracle MapViewer for Oracle database 12c Release 1 (12.1.0.1)?
The following is my configuration in the conf\mapViewerConfig.xml:
<map_data_source name="mvdemo12"
jdbc_host="127.0.0.1"
jdbc_sid="orcl12c1"
jdbc_port="1522"
jdbc_user="mvdemo"
jdbc_password="7OVl2rJ+hOYxG5T3vKJQb+hW4NPgy9EN"
jdbc_mode="thin"
number_of_mappers="3"
allow_jdbc_theme_based_foi="true"
editable="true"/>
<!-- **** -->
But it does not work.
After use "sqlplus mvdemo/[email protected]:1522/pdborcl", it connected to the Oracle database 12c.
Does anyone know it?
Thanks,For 11.1.1.7.1 use the syntax for jdbc_sid, i.e.
//mypdb1.foo.com as described in the README,
- MapViewer native (non-container) data sources can now use database service name in place of SID. To supply a db service name, you will use the same jdbc_sid attribute, but specify the service name with double slashes in front, such as follows:
<map_data_source name="myds"
jdbc_host="foo.com"
jdbc_sid="//mypdb1.foo.com"
jdbc_port="1522"
/>
For 11.1.1.7.0 use a container_ds instead.
i.e. instead of using
<map_data_source name="my_12c_test"
jdbc_host="mydbinstance"
jdbc_sid="pdborcl12c"
jdbc_port="1522"
jdbc_user="mytestuser"
jdbc_password="m2E7T48U3LfRjKwR0YFETQcjNb4gCMLG8/X0KWjO00Q="
jdbc_mode="thin"
number_of_mappers="6"
allow_jdbc_theme_based_foi="false"
editable="false"
/>
use
<map_data_source name="my_12c_test"
container_ds="jdbc/db12c"
number_of_mappers="6"
allow_jdbc_theme_based_foi="false"
editable="false"
/>
In my case the Glassfish 3.1.2.2 JDBC connection pool definition was
Property
url jdbc:oracle:thin:@mydbinstance:1522/pdborcl12c.rest_of.service.name
Uncheck the Wrap JDBC Objects option in Advanced panel, i.e. the Edit JDBC Connection Pool Advanced properties page.
Add a JDBC resource for that newly created pool
Use that in mapviewerconfig.xml as above -
Problem in creating jdbc-data-vew to oracle10g
I have installed DSEE7.0 and setup the directory proxy server successfully
my oracle environment:
ip=202.205.16.93
sid=nicdbs
table: CAMPUS.CAMPUS_USER { USERID, NAME, TEL, EMAIL }
my steps (refer to the administrator guide a reference):
dpconf create-jdbc-data-source -b nicdbs -B jdbc:oracle:thin://202.205.16.93:1521: -J file:///opt/sun/dsee7/var/jdbc/ojdbc14.jar -S oracle.jdbc.driver.OracleDriver oracleds
dpconf set-jdbc-data-source-prop oracleds db-vendor:oracle
dpconf set-jdbc-data-source-prop oracleds db-pwd-file:/etc/oraclepass.txt
dpconf create-jdbc-data-source-pool oraclepool
dpconf attach-jdbc-data-source oraclepool oracleds
dpconf create-jdbc-data-view oracleview oraclepool o=oracle
dpconf create-jdbc-table user CAMPUS.CAMPUS_USER
dpconf add-jdbc-attr user uid USERID
dpconf add-jdbc-attr user cn NAME
dpconf add-jdbc-attr user telephoneNumber TEL
dpconf add-jdbc-attr user mail EMAIL
dpconf create-jdbc-object-class oracleview person user uid
every thing return succefully
but when I test the view by
ldapsearch -b o=oralce -x uid=1422
it returns:
ldap_search: DSA is unavailable
ldap_search: additional info: Unable to process the search request. Reason: [Original error=52] No JDBC server available.
i cant get any help from this error message.I want some help, Maybe some steps were left.
thanks in advace.thanks but it didn't solve it,
ldapsearch -b o=oracle uid=1422
ldap_search: DSA is unavailable
ldap_search: additional info: Unable to process the search request. Reason: [Original error=52] No JDBC server available.
i also have tried:
db-name: (CONNECT_DATA =(SERVICE_NAME = nicdbs))
db-url: jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 202.205.16.93)(PORT = 1521)))
but it still didnt work.
#[root@dsee7 ~]# dpconf get-jdbc-data-source-prop oracleds
db-name : nicdbs
db-pwd : {3DES}+j6AoBZNIGx+7st/KDPgSmzVMlDcL6zs
db-url : jdbc:oracle:thin:@202.205.16.93:1521:
db-user : campus
db-vendor : oracle
description : -
driver-class : oracle.jdbc.driver.OracleDriver
driver-url : file:///opt/sun/dsee7/var/jdbc/ojdbc14.jar
is-enabled : true
is-read-only : false
monitoring-inactivity-timeout : 2m
monitoring-interval : 30s
monitoring-mode : reactive
num-connection-incr : 5
num-connection-init : 5
num-connection-limit : 30
#dpconf get-jdbc-data-view-prop oracleview
Enter "cn=Proxy Manager" password:
alternate-search-base-dn : ""
attr-name-mappings : none
base-dn : o=oracle
contains-shared-entries : false
custom-distribution-algorithm : none
description : -
distribution-algorithm : none
dn-join-rule : none
dn-mapping-attrs : none
dn-mapping-source-base-dn : none
excluded-subtrees : -
filter-join-rule : none
is-enabled : true
is-read-only : false
is-routable : true
jdbc-attr-date-format : yyyy-MM-dd
jdbc-attr-time-format : hh:mm:ss
jdbc-attr-timestamp-format : yyyy-MM-dd hh:mm:ss
jdbc-data-source-pool : oraclepool
lexicographic-attrs : all
lexicographic-lower-bound : none
lexicographic-upper-bound : none
non-viewable-attr : none
non-writable-attr : none
numeric-attrs : all
numeric-default-data-view : false
numeric-lower-bound : none
numeric-upper-bound : none
pattern-matching-base-dn-regular-expression : all
pattern-matching-base-object-search-filter : all
pattern-matching-dn-regular-expression : all
pattern-matching-one-level-search-filter : all
pattern-matching-subtree-search-filter : all
process-bind : -
replication-role : master
viewable-attr : all except non-viewable-attr
writable-attr : all except non-writable-attr
Edited by: mickypc1979 on Mar 1, 2010 4:31 PM -
Using WLST to set up credential mapping on JDBC Data Source
I am wanting to write a script (WLST) to set up a large initial set of credential mappings on a JDBC data source.
I can create the datasource and do all the basic set ups, but I can't figure out how to do the credential mappings.
I tried the "record" option from the Admin console, but it created a script that says that credential mappings are not recorded.
This is the mapping function that you get to from the "Security" tab on the DataSource page, and then the "Credential Mappings" tab. This allows you to map a "WLS user" to a "remote user" - which in my case is an Oracle OLS user.
I am using Weblogic 10.3
Can anyone point me to a set of commands which can perform this function?
Thanks!I wonder if there isn't a publicly visible MBean for the credential mapping. That would explain why the recorded script doesn't have the mbean method invocations.
-
Using JDBC Data Sources with ADFBC, NoInitialContextException
Using JDBC Data Sources with ADF Business Components, NoInitialContextException
I follow the instruction in the link below to create an ADF Swing application using datasource. I am using JDeveloper version 10.1.3.
http://www.oracle.com/technology/products/jdev/howtos/10g/usingdatasources/using_datasources.html
The ADF generated code looks like this:
JUMetaObjectManager.setErrorHandler(new JUErrorHandlerDlg());
JUMetaObjectManager mgr = JUMetaObjectManager.getJUMom();
mgr.setJClientDefFactory(null);
BindingContext ctx = new BindingContext();
ctx.put(DataControlFactory.APP_PARAM_ENV_INFO, new JUEnvInfoProvider());
ctx.setLocaleContext(new DefLocaleContext(null));
HashMap map = new HashMap(4);
map.put(DataControlFactory.APP_PARAMS_BINDING_CONTEXT, ctx);
mgr.loadCpx("datasource.view.DataBindings.cpx" , map);
final FormMain frame = new FormMain();
frame.setBindingContext(ctx);
I got this error when executing the last line: frame.setBindingContext(ctx);
(oracle.jbo.common.ampool.ApplicationPoolException) JBO-30003: The application pool (datasource.datamodel.AppModuleDS) failed to checkout an application module due to the following exception:
----- LEVEL 1: DETAIL 0 -----
(oracle.jbo.JboException) JBO-29000: Unexpected exception caught: oracle.jbo.DMLException, msg=JBO-27200: JNDI failure. Unable to lookup Data Source at context jdbc/xe_hrDS
----- LEVEL 2: DETAIL 0 -----
(oracle.jbo.DMLException) JBO-27200: JNDI failure. Unable to lookup Data Source at context jdbc/xe_hrDS
----- LEVEL 3: DETAIL 0 -----
(javax.naming.NoInitialContextException) Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
If I configure the application module connection type as JDBC URL, everything works.
If the connection type is JDBC Datasource, I got the above error.
Can someone show me how to adjust the generated code by ADF to use datasource?ADF BC has a bug. With Data Source in Application Module, application module does not connect. Use JDBC Connection URL.
Also refer
ADF BC: JDBC URL vs JDBC DataSource -
How to create JDBC data source w/o LDAP server
I am trying to test using JDBC data source on a computer without a LDAP server. Is there an alterative JNDI solution? How about using file system or RMI registry JNDI service providers?
Any J2EE container should be able to handle that. I use JNDI data sources with Tomcat 4.1.27. I'm sure any other J2EE app server (e.g., WebLogic, WebSphere, JBOSS, etc.) would be able to manage it, too. - MOD
-
Setting up JDBC Data Source for JCA Database Adapter in WLS - only SID?
Following the documentation for setting up a connection for use with the JCA Database Adapter (http://otnbeta.oracle.com/fmw11g/582tj30eapvb/integration.1111/e10231/life_cycle.htm), section 2.4.1, Step 8 simply says "Enter the connection properties in the Connection Properties page, and then click Next"
In the "Create a New JDBC Data Source" screen of the WLS Administration Console there is the entry field vaguely labeled as "Database Name:" Of course I entered the Oracle RDBMS service name (which we should ALWAYS be using), only to be informed upon clicking next, that WLS was expecting the SID.
Two things:
1. At least through this maintenance console, it appears that BEA did not understand the whole concept or value of Oracle RDBMS logical service names versus the SID (I have seen this in several products that Oracle has acquired). Best practice would be to use the Oracle RDBMS service name, which doesn't appear to be an option in this console.
2. The OFM documentation should be more helpful in explaining.Compare to the analogous setup in OAS 10.1.3.4/EM... far better clarity in the maintenance console and option of either SID or service name.
-
WLS 10.3.4: How to use OS authentication for JDBC Data Source
Hello all,
As a preface, I've tried searching the forum/Google for "OS authentication" and reading the WLS JDBC doc to no avail - if it's documented somewhere, a RTFM link would be much appreciated.
I'm trying to set up a JDBC data source on WLS that leverages the OS Authentication capability of the Oracle database. If it would help, I can go into the reasoning behind why I want to do this, but basically, it's to simplify the config/deployment of a COTS application. What I have in the database is an "identified externally" user that corresponds to the OS user that is running the WebLogic Server. Normally, in tools such as SQL*Plus, I would use "/@db" as the username/password (in other words, no username and no password specified), and I would be logged in as the "idenfitied externally" user. I want to configure the same thing for a WebLogic Data Source, but if I leave the username/password blank, testing the connection in the WLS console gives me "invalid username/password, login denied" I've also tried using "/" as the username, as was documented in a quite old WLS faq, but that gives me the same result.
Is there some magic switch I need to flip?
Thanks,
JohnHi John, there's no way to do that with connection pools, which is how WLS datasources get their
connections, or middleware in general. WebLogic would have no way of knowing which if any of the
pooled connections was appropriate for the current 'user', which is not the application user, but
instead is the OS identity of the person who started the WebLogic server! If you start up your
WebLogic server, and people start pointing their browsers to it, doing various stuff, the OS knows
you started WebLogic, and maybe with the help of OCI, Oracle's JDBC might know it was you who
started WebLogic's OS process, but what does the OS know about any user that may be running
a browser or application elsewhere (even if on this same machine), when that browser or application
connects to your WebLogic server process?
HTH,
Joe -
In MS BI Query Designer I want to query the last 365 days from a DB2 table. I can pull this data from Access, but can not figure out how to select the dataset for current date minus 365 days. Here is what I have that works in Access
select txn_date (format is MM/DD/YYYY)
from Inventory
where txn_date >Date()-365
I've tried Date(), NOW(), Getdate() and date_add(), but not having any luck . Your assistance would be much appreicate.Hi Rkk5,
According to your description, I suggest you referring to the command below:
select txn_date from Inventory
where datediff(D, txn_date ,(GETDATE()-365))<0
Hope this helps.
Regards,
Heidi Duan
Heidi Duan
TechNet Community Support -
JDBC Data Sources: Potential Issue with JDeveloper 10.1.3.4
I think I found a bug or issue with the latest JDeveloper 10.1.3.4 release when using JDBC Data Sources on the Embedded OC4J container.
To state the issule bluntly, If I use a JDBC Data Source in an ADF Faces application, I get the following error on the screen when I run my application if I create a simple page using a Form layout for database data:
[http://cs.uwindsor.ca/~ruston7/jdbcError.jpg]
Or if I use a simple drag and drop ADF Faces Table:
javax.faces.el.PropertyNotFoundException: Error testing property '<<FIRST_FIELD_ON_THE_PAGE>>' in bean of type null
at com.sun.faces.el.PropertyResolverImpl.isReadOnly(PropertyResolverImpl.java:274)
at oracle.adfinternal.view.faces.model.FacesPropertyResolver.isReadOnly(FacesPropertyResolver.java:124)
at com.sun.faces.el.impl.ArraySuffix.isReadOnly(ArraySuffix.java:236)
at com.sun.faces.el.impl.ComplexValue.isReadOnly(ComplexValue.java:209)
at com.sun.faces.el.ValueBindingImpl.isReadOnly(ValueBindingImpl.java:266)
at oracle.adfinternal.view.faces.renderkit.core.xhtml.EditableValueRenderer.getReadOnly(EditableValueRenderer.java:211)
at oracle.adfinternal.view.faces.renderkit.core.xhtml.FormElementRenderer.renderAsElement(FormElementRenderer.java:155)
at oracle.adfinternal.view.faces.renderkit.core.xhtml.InputLabelAndMessageRenderer.getLabelFor(InputLabelAndMessageRenderer.java:53)
at oracle.adfinternal.view.faces.renderkit.core.xhtml.LabelAndMessageRenderer$Label.getForId(LabelAndMessageRenderer.java:500)
at oracle.adfinternal.view.faces.renderkit.core.xhtml.OutputLabelRenderer.encodeAll(OutputLabelRenderer.java:69)
at oracle.adfinternal.view.faces.renderkit.core.CoreRenderer.delegateRenderer(CoreRenderer.java:281)
at oracle.adfinternal.view.faces.renderkit.core.xhtml.LabelAndMessageRenderer.encodeAll(LabelAndMessageRenderer.java:123)
at oracle.adfinternal.view.faces.renderkit.core.xhtml.InputLabelAndMessageRenderer.encodeAll(InputLabelAndMessageRenderer.java:94)
at oracle.adfinternal.view.faces.renderkit.core.CoreRenderer.encodeEnd(CoreRenderer.java:169)
at oracle.adf.view.faces.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:624)
at oracle.adfinternal.view.faces.renderkit.core.CoreRenderer.encodeChild(CoreRenderer.java:246)When I change my Application Module connection to a JDBC URL, this all works perfectly. Also, everything works fine when I deploy to our Oracle AS 10.1.3 application servers.
I also tried this on a different computer using a fresh install of JDeveloper just to make sure that the copy of JDeveloper that I downloaded didn't have a fluke in it.
Thanks!M. Ruston,
It must be something on your side. i just tried the same thing using the employees table from the HR sample schema (it has a date column). It works with JDBC URL and datasource both.
Just out of curiosity - if you look at the properties for your Business Components project at the business components section, what does it show for the SQL Flavor and Type Map?
John -
Cannot connect to JDBC data source
We are trying to configure Visual Composer to connect to the backend BI-ABAP
BI database which is DB2, from the Visual Admin on the windows box.
Downloaded the driver for DB2 JDBC from IBM website
(ibm_data_server_driver_package_win64_ALL_LANG_v97.exe) Not sure if this is the correct driver, because we are unable to connect to the BI
Landscape information
BI- ABAP: NW 701 SP4 AIX 6100-3/DB2 v9.5.0.4,FIXPACK 4
BI-JAVA: NW 701 SP4 WIN2003 X64/SQL2005 SP3
When i run this url http://servername:port/TestJDBC_Web/test2 i i get the following error
Exception Details:
com.sap.ip.bi.sdk.exception.BIConnectionFailedException: Cannot open the connection
at com.sap.ip.bi.sdk.dac.connector.jdbc.JdbcConnectionFactory.getConnectionEx(JdbcConnectionFactory.java:238)
at com.sap.ip.bi.sdk.trialarea.connector.servlet.model.JDBCModel.getConnection(JDBCModel.java:796)
at com.sap.ip.bi.sdk.trialarea.connector.servlet.model.JDBCModel.getTables(JDBCModel.java:132)
at com.sap.ip.bi.sdk.trialarea.connector.servlet.controller.Control2.doPost(Control2.java:25)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
Caused by: com.sap.ip.bi.sdk.exception.BIResourceException: Cannot open the connection
at com.sap.ip.bi.sdk.dac.connector.jdbc.JdbcManagedConnection.(JdbcManagedConnection.java:123)
at com.sap.ip.bi.sdk.dac.connector.jdbc.JdbcManagedConnectionFactory.createManagedConnection(JdbcManagedConnectionFactory.java:112)
at com.sap.engine.services.connector.jca.ConnectionHashSet.match(ConnectionHashSet.java:338)
at com.sap.engine.services.connector.jca.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:262)
at com.sap.ip.bi.sdk.dac.connector.jdbc.JdbcConnectionFactory.getConnectionEx(JdbcConnectionFactory.java:233)
... 19 more
Caused by: com.sap.ip.bi.sdk.exception.BIResourceException: Cannot connect to JDBC data source
at com.sap.ip.bi.sdk.dac.connector.jdbc.impl.Connection.connectDB(Connection.java:336)
at com.sap.ip.bi.sdk.dac.connector.jdbc.impl.Connection.connect(Connection.java:99)
at com.sap.ip.bi.sdk.dac.connector.jdbc.JdbcManagedConnection.(JdbcManagedConnection.java:118)
... 23 more
Caused by: java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:532)
at java.sql.DriverManager.getConnection(DriverManager.java:140)
at com.sap.ip.bi.sdk.dac.connector.jdbc.impl.Connection.connectDB(Connection.java:320)
... 25 moreHi,
you can check the configuration:
http://help.sap.com/saphelp_scm50/helpdata/en/43/e35b3315bb2d57e10000000a422035/content.htm
Regards, Mayur -
Oracle CEP JDBC Data Cartridge
Hello,
I'm trying to implement Oracle CEP JDBC Data Cartridge
according to :
http://docs.oracle.com/cd/E23943_01/apirefs.1111/e12048/datacartjdbc.htm#CIHCEFBH
The problem is that it fails on deployment with following error :
<Exception thrown from prepare method com.oracle.cep.cartridge.jdbc.JdbcCartridgeContext.checkCartridgeContextConfig.
java.lang.AssertionError: java.lang.ClassNotFoundException: weblogic.jdbc.wrapper.PoolConnection
I've added file that contains this class to classpath (com.bea.core.datasource6_1.10.0.0.jar) ,
but get the same error .
Any help would be appreciated .
Regards,
DmitryHello Wei Xiong,
I have the same error when I trying to configure Oracle CQL Processor Table Source according to :
http://docs.oracle.com/cd/E23943_01/dev.1111/e14301/processorcql.htm#CIHCCADG
I've configured table source and had the same error on deployment :
<The application context "check_entrance" could not be started: org.springframework.beans.FatalBeanException: Error in context lifecycle initialization; nested exception is com.bea.wlevs.ede.api.StatementException: Could not start rule [DBEventQuery] due to error: java.lang.ClassNotFoundException: weblogic.jdbc.wrapper.PoolConnection
org.springframework.beans.FatalBeanException: Error in context lifecycle initialization; nested exception is com.bea.wlevs.ede.api.StatementException: Could not start rule [DBEventQuery] due to error: java.lang.ClassNotFoundException: weblogic.jdbc.wrapper.PoolConnection
at com.bea.wlevs.spring.ApplicationContextLifecycle.onApplicationEvent(ApplicationContextLifecycle.java:145)
It's look like a same issue.
I've added zip file of my Eclipse project and config.xml of my CEP domain to e-mail.
Thank you !
Regards,
Dmitry -
Need Help on using CAS Incremental Crawl with JDBC data source
Hi,
As part of one of the e-commerce implementations, we are implementing a delta pipeline which reads the data from the database views. We plan to crawl the data with the help of CAS JDBC data source. In order to optimize the data reads, we want to use the CAS capabilities of incremental crawl. We rely on CAS to be able to identify the updates available in the subsequent incremental crawl and only read the updated data for any given crawl unless we force a full crawl.
We have tried implementing the above setup using JDBC data source. CAS reads from the database and stores it in the record store. The Full crawl works fine however; we observed some unexpected behavior during the incremental crawl run. Even when there is no change in the database, crawl metrics show that certain number of records have been updated in the record store and the number of updates differ in every subsequent run.
Any pointers what can be the issue ? Does CAS has the incremental crawl capability using JDBC data source ?
Regards,
Nitin MalhotraHi Ravi,
Generic Extraction is used to extract data from COPA tables. And delta method used to extract delta records (records created after initilization) is timestamp.
What is this timestamp?
Assume that, you have posted 10 records one after the other to the COPA tables. And we do initilization to move all these 10 records to BW system. Later another 5 records are added to COPA tables. How do you think the system identifies these new 5 records (delta records).?
It identifies based on a timestamp field (eg : Document created on ,a 16 digit decimal field).
Assume that, in our previous initilzation, say "document created on" field for the last (or the latest) record is 14/11/2006, 18.00 hrs. and timestamp is set to the 14/11/2006, 18.00hrs. then when you do delta update, the system treats all the records with "document created on" field is greater than 14/11/2006, 18.00 hrs as delta records. This is how new 5 records are extracted to bw system and timestamp is again set to the new value besed in field in the records.(say 14/11/2006, 20.00hrs)
Assume that, you have two records with "document created on" field as 14/11/2006, 17.55hrs and 14/11/2006, 17.57hrs. and they were updated to the COPA table after 14/11/2006,20.00hrs (at this time last delta load is done) due to some reason. How can you bring these two records? For this, purpose we can reset the timestamp at KEB5. In this eg, we can reset as 14/11/2006, 17.50 hrs) and do the delta again. So, the system picks all the records which are posted after 14/11/2006,17.50hrs again. But remember that, doing this, you sending some of the records again (duplicate records). So, make sure that you sending ODS object. otherwise you end up with inconsistant data due to duplicate records.
Hope this helps!!
Vj -
Getting JDBC data source from PersistenceUnit
I have an application accessing a database, and am using JPA to read/write/update records in the database.
Some of the database tables use stored procedures to perform complex computations across entire
database tables, and I need to call these stored procedures when I the user does certain operations,
such as cloning an object and all its associated data. To call the stored procedures I use the same
JDBC data source that is used to define the PersistenceUnit.
Is there any way to get that DataSource from the PersistenceUnit?
Since I do not know how to do this I am currently using @Resource DataSource annotations to get the JDBC
datasource. That is ugly because I have the datasource specified in two different places in my code.
Please help!I hit the same problem as yours. This issue is caused by JDK version. The JDK used by Weblogic 10.3 is java 6, while your client program's jdk version is java5. So change the both of them to java 6. This issue will be fixed.
Don't forget to rebuild the wlfullclient.jar which also should be java 6.
Good luck!
Maybe you are looking for
-
I am trying to create an interactive PDF form for use in an educational activity. It is basically in the form of a lecure with quiz questions in the mix. I see how to create a drop down list or select list in Acrobat pro, and I see how to either su
-
CAS SSO not working for VPN Group
Hello, I am trying to get SSO working for a CAS/CAM in a inband virtual gateway for VPN users coming in off a ASA5520. There are two VPN groups each with its own group policy and tunnel group. One group uses a Windows IAS Radius Server and the other
-
Printing in US and Europe. Options
I have a Crystal Report that needs to be printed in both US and Europe. So sometimes it needs to be legal and sometimes (A3). Not sure if that is the equvilant but you get the point. I want to have it just print and nothing gets cut off and a user
-
MARS 6.0.5 Incident Details Times Out
We have a MARS-50 that I recently upgraded to version 6.0.5. I did a series of upgrades, so this may or may not be related to 6.0.5. Everything seems to work fine except the incidents. If I click on an incident number to view the details, MARS will
-
Hello, I need to change the file name for images I am using in a website I am building with iWeb. The file names for the images cannot include any special characters. I have tried to change the file name as suggested through iPhoto Help. It seems to