Shutdown/Startup database from java

Hi,
I need to execute shutdown/ startup database commands from a java application. I have tried wrapping these in sql / sh file using Runtime.getRuntime().exec("z:\\sql\\shut.sql"), but keep getting:
java.io.IOException: CreateProcess
any ideas ?
thanks,
Daphna

Hi,
I don't see why the 11g Drivers won't work for earlier releases of the DB as long as you follow the steps in the documentation. Have you tried it?

Similar Messages

  • STARTUP DATABASE FROM SQLPLUS

    DEAR ALL,
    I've shutdown the database from SQLPLUS.How to startup the database from sql plus.I tried to connect using sys and i recieve Listener doesn't know currently of service....
    Thanks

    I've shutdown the database from SQLPLUS.How to
    startup the database from sql plus.I tried to connect
    using sys and i recieve Listener doesn't know
    currently of service....Your errors seems that you were using sqlplus in client not in server to shudown
    database and try to startup database.
    If so, you need to config your listener.ora with static listener as well as dynamic listener.
    HTH

  • How to put records in database from java coding?

    I want to insert records in the database from java code. Please help me out. Can i get a sample code for that.

    Google for JDBC tutorial. (...or read about hibernate)
    Kaj

  • [JDBC][ODBC] How to compact access database from Java ?

    Hello,
    I'm developping a java applcation wich is connected to an MS Access file database.
    For now, I don'y compact it but it would be better.
    So How can I compact an access database from Java ?
    thanks :)

    Hi ypiel,
    Try this:
    1) Download JETCOMP.exe (freeware from Microsoft);
    2) Put the following code in your app (assuming your database file name is: "DB.mdb"):
    try {
    File current = new File("DB.mdb");
    File backup = new File("BACKUP.mdb");
    if (current.renameTo(backup)) {
    Runtime.getRuntime().exec("jetcomp -src:BACKUP.mdb -dest:DB.mdb");
    } catch (Exception e) {
    System.out.println(e.getMessage());
    Best regards,
    YT.

  • Error in connecting Oracle Database from JAVA application!!!

    Hi,
    I am trying to connect to the Oracle11g database server from the client machine using JAVA eclipse. I have installed the oracle client in the client machine. Once i try to execute the below code it was throwing below error:
    public class Dbconnect {
    public static void main (String[] args)throws Exception {
    try {
    Class.forName ("oracle.jdbc.driver.OracleDriver");
    String connectString = "jdbc:oracle:thin:@<IP Address>:1521:orcl";
    OracleDriver drivers = new OracleDriver();
    System.out.println(drivers);
    Connection connection = null;
    connection = (OracleConnection)DriverManager.getConnection(connectString,"ADMIN", "admin");
    System.out.println(connection);
    System.out.println("Connected to the database");
    Error:
    java.sql.SQLException: The Network Adapter could not establish the connection
         at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)
         at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
         at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
         at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
         at java.sql.DriverManager.getConnection(Unknown Source)
         at java.sql.DriverManager.getConnection(Unknown Source)
         at DBConnect.main(DBConnect.java:15)
    Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
         at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:359)
         at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:422)
         at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:672)
         at oracle.net.ns.NSProtocol.connect(NSProtocol.java:237)
         at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042)
         at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301)
         ... 7 more
    Caused by: java.net.ConnectException: Connection refused: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(Unknown Source)
         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
         at java.net.PlainSocketImpl.connect(Unknown Source)
         at java.net.SocksSocketImpl.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:141)
         at oracle.net.nt.ConnOption.connect(ConnOption.java:123)
         at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:337)
         ... 12 more
    I am unable to connect using sqlplus as well ORA-12560: TNS:protocol adapter error
    Please advise me on how to resolve this issue..
    Thanks

    Prabhu wrote:
    We are not able to connect from SQLplus as we.. If i issue this command in Sqlplus from client machine 'sqlplus admin/admin@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=<Ip Adddress>)(PORT=1521)))(CONNECT_DATA=(SID=orcl)))'' it was throwing the below error.
    Error: ORA-12541: TNS:no listener
    Do i need add get any config details in the client machine..
    Could please tell me what is the general procedure to access the DB server from client machine..on DB Server issue following OS commands
    lsnrctl start
    lsnrctl status
    lsnrctl service
    COPT commands & results, then PASTE all back here

  • Problems connecting with database from java API

    I've benn using XSQLRequest and I found a problem with
    connections, because it can't connect from Java to database, but
    if I access to a .xsql it works.
    And also if I link to a .xsql first and after that I try to
    access to Database form my servlet it works. So I think my
    problem is to initialize the XSQLConfig.xml file in OC4J server.
    Thanks in advance

    Would you provide the way you deploy your XSQL app to OC4J and
    how you get JDBC connection using JAVA? I execute the next code more or less:
    miXSQLRequest = new XSQLRequest(XSQLQuery.getDOM
    (),null);
    miXSQLRequest.process(htParamsIn, pWriter, pErrors);
    but and it's probabily my mistake I don't get any conecction
    from the session or something similar because I thought that
    it's made by XSQLRequest, and the XSQLRequest class takes the
    default values of the connection pool from the file
    XSQLConfig.xml (I put this file inside the lib directory of
    OC4J) as the XSQLServlet.
    Thanks for your help

  • Connecting sap crm database from java | platform used NWDS

    I need to get some values from one of the SAP CRM 2007 database table and display it in one jsp file. I am working on a e commerce webshop in NWDS. I am new to NWDS. Can you give some sample code showing how to make connection to crm database and to do a select query on a table.

    I have only worked with CRM 3.0/4.0 but I have worked some with other WDP applications.
    So you want to access some data in a table in the CRM backend (R/3)?
    To do that from Java you need to call a BAPI in the CRM system. The BAPI does the acctuall lookup in the table and returns the value to the Java side. To do that in a WDP environment you need to set up Java Connectors (jCo) in your Java server. In some cases you can use a "normal" BAPI call, that is the way CRM ISA 3.0 and 4.0 works. See: http://help.sap.com/saphelp_crm30/helpdata/en/b6/97f8378f975450e10000009b38f8cf/frameset.htm
    and here:
    https://websmp108.sap-ag.de/~form/sapnet?_FRAME=CONTAINER&_OBJECT=011000358700000633682005E
    Here is how to access ABAP functions from WDP: http://help.sap.com/saphelp_webas630/helpdata/en/c3/76b45d9688e04abe1a1070410ddc1e/frameset.htm

  • Running Oracle startup or shutdown bat file from Java code

    I have two bat files for the startup and shutdown of Oracle instance which works fine from the command prompt. But my requirement is to run it through a Java program. Please reply with full Java code. Also mention how I would get the status of the bat files that it is successfully executed or not and if not what is the error.

    Your program is working fine, but there is another problem. What's happening now is I have to open the Login screen after the startup of oracle server is complete, but the next line of my program after Runtime.exec is the LoginScreen.show which immediately shows the login screen after executing Runtime.exec and when I am giving the login name and password and press enter, it shows Oracle not available exception, because the startup process is still in progress. I want to stop the execution of my next line of code until and unless my process of Oracle startup is complete.

  • Insert Image in database from Java Prog, but some excp. occured

    I want to insert the content of an Image file into my database, but I am getting the below exception.
    I am reading the file and taking the content into a string. The string displays perfectly (if I print the string using system.out.println statement) but while inserting into database it gives problem.
    Following is my code::
    import java.io.*;
    import java.sql.*;
    public class ImageInsert
    public static void main(String args[])
    try
    DataInputStream dis = new DataInputStream(new FileInputStream("reshmi.gif"));
    String str="" , ImageContent="";
    while((str = dis.readLine()) != null )
    ImageContent = ImageContent + str;
         //System.out.println("Content :"+ str);
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:somedata" , "sa" , "");
    Statement st = con.createStatement();
    String as = "INSERT INTO TESTIMAGE (ImageFile) VALUES(\"" + ImageContent + "\")" ;
    int q = st.executeUpdate(as);
    System.out.println("The data Inserted:"+q);
         }catch(Exception er) {er.printStackTrace();}
    // end of code
    Where as if I insert it manually in my SQL Server executing the insert statement it inserts the image perfectly:
    Following Exceptions I am receivng :
    *********** BELOW IS THE EXCEPTION********
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation m
    ark before the character string 'GIF89a��'.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Compiled Code)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:4246)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:1172)
    at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:206)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:163)

    It looks like imageContent contains a quote character, making your statement invalid. Something like
    Insert into .... value("<some chars>..."...<some chars>")
    Using single quotes will not resolve this problem since imageContent could also contains single quote chars.
    Try using BLOBs instead strings. I don't know if SQLServer supports BLOBs but Oracle does.
    JCG

  • Problem in storing  as Blob in Oracle Database from java Program

    Hi All,
    Am trying to store an image of size 80000bytes into Oracle database using setBytes() anndsetBinaryStream() method but I'm unable to store in database.can u please tell me what are the various methods to store the Blob data into the database?
    the ways i'm trying to store in Database :
    1) cstmt.setBinaryStream(2, new ByteArrayInputStream(ltImageArr
    .get(i)), ltImageArr.get(i).length);
    2) cstmt.setBytes(2, ltImageArr.get(i)) ;
    waiting for reply
    please help me out

    hi !
    it seems to be a bug under Oracle 10.2, for which i used this workaround :
    PreparedStatement pstmt =
    con.prepareStatement("INSERT INTO blobtable VALUES (?)");
    Blob blob = BLOB.createTemporary(con, true, BLOB.DURATION_SESSION);
    OutputStream out = blob.setBinaryStream(0);
    out.write(byteValues);
    pstmt.setBlob(1, blob);
    i hope it will help you
    bye !

  • Startup/Shutdown database through java code

    I am trying to shutdown/startup my database 10gr2 using a java code.
    I am able to shutdown db through EM dbconsole .. so there should be way to perform these steps using java prog.
    Issue I am getting is that "shutdown immeidate" is not a valid sql statement.
    do "shutdown" command strickly belongs to sqlplus only
    [ shutdown/ shutdown immeidate/shutdown abort ] .. nothing works
    Error is
    Connected ..
    Shuting down database..
    java.sql.SQLException: ORA-00900: invalid SQL statement
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
    Any idea how we can achive it
    here ismy code ..
    ======================
    /* shutdown/startup database */
    import java.sql.*;
    import oracle.jdbc.driver.*;
    class DBTest
         public static void main (String args[])
         Connection connection = null;
         try {
              // Load the JDBC driver
              String driverName = "oracle.jdbc.driver.OracleDriver";
              Class.forName(driverName);
              // Create a connection to the database
              String serverName = "127.0.0.1";
              String portNumber = "1521";
              String sid = "prod";
              String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
              String username = "sys as sysdba";
              String password = "password";
              connection = DriverManager.getConnection(url, username, password);
              System.out.println("Connected ..");
              System.out.println("Shuting down database..");
              Statement stmt = connection.createStatement();
              stmt.execute("shutdown immediate");
              stmt.close();
              System.out.println("Shuting down database complete..");
              connection.close();
         } catch (ClassNotFoundException e) {
              e.printStackTrace();
              // Could not find the database driver
         } catch (SQLException e) {
         e.printStackTrace();
              // Could not connect to the database
    ==================================

    Link is perfect for OCI users.
    Do anyone have an idea how 10g enterprise manager console stops database server. Whats happening in background when shutdown button is clicked after provided database and host credential.

  • How to Cache Data  from database for java mapping ?

    Hi
      I have a scenario where  i have to dynamically query  a huge table in some other database from java mapping code.
    Therefore instead of making a new Database trip everytime is there a mechanism by which i can cache the entire table contents into XI first and then use this cache for looking up data through my java mapping.
    Any other alternative also welcome which would give best performance.
    Please Suggest
    regards
    Nilesh Taunk.

    Hi Nilesh,
    I am not sure if you can actually cache the table in XI. You will have to look up directly from your Database everytime your mapping excecutes.
    To perform DB lookup during mapping very efficiently, I would suggest that you take a look at this blog,
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    Also, instead of doing the DB look up in mapping, you can also use your JDBC adapter as a sender and collect the information you want from your DB,
    If you are using your JDBC as a sender, then your JDBC will poll over your database and select the rows that satisfy your Select Query. Also, there is another field in your JDBC adapter that is very important and that is the Update satatement. Once your JDBC adapter executes your select query and selects rows from the database, you might not need those rows to be selected again. In this csse, you can use the Update statement to update the database.
    http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    The choice between a JDBC sender adapter , and the DB lookup will have to be on the basis of your requirements.
    Regards,
    Bhavesh

  • Shutdown Oracle Database in MSCS Environment

    Dear All,
    We are facing problem regarding shutdown the oracle database in Cluster Environment. We have installed SAP HA on windows 2003 server and backend database is Oracle.
    In order to configure the dataguard we have to create the control file from Primary Database for this purpose we have to shutdown and then startup the database in mount state.
    But whenever i shutdown the database from SQL prompt by "shutdown immediate" command and see the status of
    database it always remains in open state.
    I have tried the following options as well but no success:-
    Stop all the instances of SAP and then shutdown the database.
    Shutdown the second node and then shutdown the database.
    Brought offline the ORACLE<SID> group and then shutdown the database.
    Kind Regards

    Hi,
    ORA-12560: TNS:protocol adapter error"
    The above error message comes if Oracle Listener service is not running. Start Oracle TNS Listener service, if it is not running.
    You can create control file while your Primary Database is ONLINE. Use the below mentioned command to create standby control file and use it for recovery at Standby database.
    ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/path/to/controlfile.ctl';
    If you want to Start/Stop SAP/ORACLE in MCSC environment then refer the steps mentioned in these threads, [thread1|Re: how to start/stop a  MSCS clustered SAP system?; and [thread2|Stop sap and oracle on MSCS;.
    Regards,
    Bhavik G. Shroff

  • How to connect to mysql from java app

    hi
    please say the procedure for connecting to mysql database from java app.
    .) what should i give in environmental variables
    .)where can i find the driver class for the mysql
    .) syntax of the url
    eg:- DM.getConnection("jdbc:mysql:..............what comes here..............");

    You can also get connections from a DataSource. Simple example:
                MysqlDataSource msds = new MysqlDataSource();
                msds.setUrl("jdbc:mysql://127.0.0.1:3306/dbdame");
                msds.setUser("user");
                msds.setPassword("pass");
                Connection c = msds.getConnection();Explore your options and be sure to consider connection pooling.

  • Enter Ms Acess from java with password

    I've written a program that can save the user's detail into a database, which was build with MS Access. This database has been set a password which i need to enter password to access the table to view the data.
    What the java code need to enter the ID and password to connect to the database, but my database onli need the password. So how to connect to the database from java source code.
    This is the part of the code:
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    // set this to a MS Access DB you have on your machine
    String filename = "./database/dbImportant.mdb";
    String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
    database+= filename.trim() + ";DriverID=22;READONLY=true}"; // add on to the end
    // now we can get the connection from the DriverManager
    Connection con = DriverManager.getConnection( database ,"","");

    Connection con = DriverManager.getConnection( database ,"","");
    What should i put into the 2 parameter? One is ID and password, but my database onli need password. If i enter the password parameter only, it will fail to access the database.

Maybe you are looking for

  • Using servlet to generate xml

    Hi, I'm not sure if this is the correct forum to post this but hopefully someone can point me in the correct direction or answer my question. I am using swfchart 5.08.  I'm new to this but have read the documentation and had an older version which di

  • H E L P mac math foonths to windows-compatible fonts

    im a novice when it comes to font development. i want to convert mac math fonts to pc-compatible fonts. ive been trying to follow the guidelines on how to do it but i cant seem to have an output. dont know how python works and i dont know if my files

  • Siri Not Working

    My system are crashed and i tried to restore the firmware from 9A405 to 9A406, and after update, my Siri GONE just like that, even i try to reboot, hard reboot, close and open the Siri in general setting and in Restriction. Can anyone help me with th

  • Size of video in sidebar - can it be changed?

    Hello - Does the way the video is published or the dimensions of the video imported into the sidebar affect the display size? We are finding that the size of the square is too small and we would like to make it larger. Is there any way to affect the

  • Hello my MacBook Pro is getting very slow, please help me

    Hardware Information:           MacBook Pro (13-inch, Mid 2012)           MacBook Pro - model: MacBookPro9,2           1 2.5 GHz Intel Core i5 CPU: 2 cores           4 GB RAM Video Information:           Intel HD Graphics 4000 - VRAM: 1024 MB System