Home » SQL & PL/SQL » SQL & PL/SQL » get value of DB parameter in JDBC
get value of DB parameter in JDBC [message #405920] Sun, 31 May 2009 17:11 Go to next message
casttree
Messages: 83
Registered: August 2008
Member
I need to get the value of FIXED_DATE for Database, and I tried to use Statement or PrepareStatment in JDBC , but both get the error message,"java.sql.SQLException: ORA-00900: invalid SQL statement " or " java.sql.SQLException: SQL string is not Query"

What JDBC function should we use to check the statement "show parameter " ?

Thanks,





        //      stmt = (prepareStatement) conn.prepareCall("show parameter fixed_date" );
       //       stmt.executeQuery();

                stmt = (Statement) conn.createStatement();
                 stmt.execute("show parameter fixed_date" ) 
Re: get value of DB parameter in JDBC [message #405921 is a reply to message #405920] Sun, 31 May 2009 17:18 Go to previous messageGo to next message
BlackSwan
Messages: 25050
Registered: January 2009
Location: SoCal
Senior Member
When all else fails, please do not hesitate to Read Then Fine Manual (URL below).
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/index.htm#S

scroll down & please note no "SHOW" command exists.

SQL language is NOT the same as SQL*Plus utility.

SELECT NAME, VALUE FROM V$PARAMETER ........
Re: get value of DB parameter in JDBC [message #406209 is a reply to message #405920] Tue, 02 June 2009 18:14 Go to previous messageGo to next message
casttree
Messages: 83
Registered: August 2008
Member
Thanks, I am able to check the parameters status now.

and I tried to run "alter system set fixed_date = 'NONE'" in JDBC too.

from http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/index.htm#S , I can see the "alter system" in SQL index.

but when I tried to run

                 stmt = (Statement) conn.createStatement();
                 stmt.execute("alter system set fixed_date = 'NONE' " ) ;


it shows "java.sql.SQLException: ORA-01031: insufficient privileges" , I think I login as sys as sysdba and the query can be run in sqlplus .

Any limitation for "alter system " in JDBC?
Re: get value of DB parameter in JDBC [message #406247 is a reply to message #406209] Wed, 03 June 2009 00:52 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
Any limitation for "alter system " in JDBC?

The only limitation is on connect account not on language.

Quote:
, I think I login as sys as sysdba

Your assumption might be wrong. Check it.

Regards
Michel
Re: get value of DB parameter in JDBC [message #406308 is a reply to message #406209] Wed, 03 June 2009 04:19 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
You need to connect to Oracle using a User that has the ALTER SYSTEM privilege granted to it.
Re: get value of DB parameter in JDBC [message #406312 is a reply to message #406308] Wed, 03 June 2009 04:36 Go to previous message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Also, if you want to connect as sysdba/sysoper using JDBC, you need to use Session Properties
Previous Topic: table columns populating value
Next Topic: ORA-06502: PL/SQL: numeric or value error: invalid LOB locator
Goto Forum:
  


Current Time: Sat Dec 10 03:25:12 CST 2016

Total time taken to generate the page: 0.21673 seconds