How to create a oracle database by java code?

how to create a oracle database by java code?
please give some ways then that way's code

I'm not sure what you mean with "database". Do you mean an Oracle instance or an Oracle user/schema (probably the latter, because that's the equivalent to a MS SQL Database).
Creating an instance is definitely not possible from within Java. To create a new user this should be possible, as this can be done with SQL:
GRANT connect,resource TO <newuser> IDENTIFIED BY <password>;
I'm always cautious with questions like this. In 90% of the cases there is something wrong with the initial design. Creating a database shouldn't be something the application is doing.
Thomas

Similar Messages

  • How to create an Oracle DATABASE through Java Programming Language.. ?

    How to create an Oracle DATABASE through Java Programming Language.. ?

    Oracle database administrators tend to be control freaks, especially in financial institutions where security is paramount.
    In general, they will supply you with a database, but require you to supply all the DDL scripts to create tables, indexes, views etc.
    So a certain amount of manual installation will always be required.
    Typically you would supply the SQL scripts, and a detailled installation document too.
    regards,
    Owen

  • Create new oracle database with JAVA

    Hi!
    I would appreciated it if you could help me to solve a problem that i have.
    I am trying to create a new oracle database by a JAVA 1.4.2 application. I am using the scripts that Oracle 10.g supplies during the creation of a new database from the server (Generate Database Creation Scripts) with the appropriate changes, generated by a java application. Unfortunately, i am unable to connect with the database and the listener. Is there any other way to create a new database by java and how can i solve my current problem with the oracle scripts?
    Thank you.

    A) To create a new schema, you need to be connected as a user that has create schema privilege, or as tyhe user who is to own the schema (remembering that the user has appropriate create privs, as seen in the GRANT command in the SQL Reference manual). Not an issue at all, I think, if you coordinate this with your DBA. Discussed very well in the Administrator's manual.
    B) Alternately, you could create a complete copy of the schema, including all desired objects (tables, views, etc.) in a separate database and simply export the user and schema. Then simply invoke the OS-based import command (imp) to load that entire thing into the target database.
    C) To create a new database, there are 3 simple steps ...
    1) create the appropriate initialization parameter file
    the init{sid}.ora file should be placed in the $ORACLE_HOME/dbs or %ORACLE_HOME%\database directory. (I recommend you do not attempt to create the spfile.) Of critical interest will be setting the block size information, the control file parameters, and using the appropriate memory management parameters, based on the version of the software you will be using to create the database instance.
    2) start an empty instance, pointing to the parameter file
    This will be an OS specific call, and will require that you have the correct OS environment set up as well as access to the ORACLE_HOME which will provide the software that you will invoke. In *nix you will need to call the sqlplus command with sysdba provs and in Windows you will need to call oradim to initialize this as a service.
    3) run the SQL create database command
    You might want to use the dbca to create a template of the create database command, or look in the SQL Reference manual for the variations on the command. Of critical interest will be initializing the redo logs as well as the system, sysaux (if needed), temp and undo tablespaces after which you can set up the regular tablespaces, users and schemas. I highly recommend that you have redundant copies of the control files on separate drives.
    You may want to review the online Concepts manual and the Adminstration Guide for some of the specifics to your needs, but I think I've covered the basics.
    Remember that ideally you will only have one database instantiated on any given server as the memory and CPU overhead of each instance is significant.
    Good luck.

  • How to create the oracle database for MDM

    Hello Friends,
    I am new to MDM technology. I have been asked to install MDM 5.5 on windows with oracle database.
    i have gone through the installation guides and master guide of MDM. But in the installation the procedure is not given to create the data base after oracle installation. i want to know do i need to create the database manually if yes then what should be the DBSID of the database and schema name etc.
    Please help.
    Thanks,
    Manoj

    Well, let's rock.
    <b>Oracle database creation</b>
    Use <b>Oracle Database Configuration Assistant</b> (Start -> Programs -> ...) to create a new database.
    The database naming (on Step 3) is up to you. I used MDM as for SID and MDM.<MYHOSTNAME>.<MYDOMAIN> as for the db name.
    Be sure you select UTF8 for the character set (on Step 12) - this requirement is mentioned in the SAP MDM Installation Guide.
    All other settings can go default.
    <b>Listener and TNS name configuration</b>
    The next step is to configure a listener and tns name for your database.
    Run the <b>Oracle Net Configuration Assistance</b> and select the "Listener configuration". Default settings on the wizard pages should suite your configuration.
    Click Finish.
    Run the <b>Oracle Net Configuration Assistance</b> again and select the "Local Service Name configuration". Add one. Choose the name of the database for the service name. It was MDM.<MYHOSTNAME>.<MYDOMAIN> for me.
    Ensure that you use name of the database that you've entered during the database creation.
    Everything else should go as suggested by default.
    Once you are at the Test stage of the wizard and get the "invalid login/password" message, clisk "Change login" and use SYSTEM user and the password you\ve entered during databae creation.
    After the test passes, you can connect to your Oracle database through the MDM Console.
    Please, let me know if you have any questions, I'll help.
    Thanks!

  • How to Create Symbolic link using pure Java code?

    Hi,
    I would appreciate if someone can tell me how to create symbolic link using JAVA API. I have looked into many forums but couldn't get a better answer.

    Java is likely not the tool to use here, as symlinks are not present in Windows while "pure" Java attempts to be platform independent. You could use Runtime.exec to execute the ln -s command
    http://forum.java.sun.com/thread.jspa?threadID=664475&messageID=3892685
    Good Luck
    Lee

  • How To Store pdf or doc file in Oracle Database using Java Jdbc?

    can any one help me out How To Store pdf or doc file in Oracle Database using Java Jdbc in JSP/Serlet? i tried like anything. using blob also i tried. but i am able 2 store images in DB not files. please if u know or else if u have some code like this plz send that to me, and help me out plz. i need that urgent.

    Hi.. i am not getting error, But i am not getting the original contents from my file. i am getting all ASCII vales, instead of my original data. here i am including my code.
    for Adding PDF in DB i used image.jsp
    Database table structure (table name. pictures )
    Name Null? Type
    ID NOT NULL NUMBER(11)
    IMAGE BLOB
    <%@ page language="java" import="java.util.*,java.sql.*,java.io.*" pageEncoding="ISO-8859-1"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%
    try{
         Class.forName("oracle.jdbc.driver.OracleDriver");
         Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
         PreparedStatement ps,pstmt,psmnt;
         ps = con.prepareStatement("INSERT INTO pictures VALUES(?,?)");
    File file =
    new File("D:/info.pdf");
    FileInputStream fs = new FileInputStream(file);
    ps.setInt(1,4);
    ps.setBinaryStream(2,fs,fs.available());
    int i = ps.executeUpdate();
    if(i!=0){
    out.println("<h2>PDF inserted successfully");
    else{
    out.println("<h2>Problem in image insertion");
    catch(Exception e){
    out.println("<h2>Failed Due To "+e);
    %>
    O/P: PDF inserted successfully
    i tried to display that pdf using servlet. i am giving the code below.
    import java.io.IOException;
    import java.sql.*;
    import java.io.*;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class DispPDF extends HttpServlet {
         * The doGet method of the servlet. <br>
         * This method is called when a form has its tag value method equals to get.
         * @param request the request send by the client to the server
         * @param response the response send by the server to the client
         * @throws ServletException if an error occurred
         * @throws IOException if an error occurred
         public void service(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
              //response.setContentType("text/html"); i commented. coz we cant use response two times.
              //PrintWriter out = response.getWriter();
              try{
                   InputStream sPdf;
                   Class.forName("oracle.jdbc.driver.OracleDriver");
                        Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
                        PreparedStatement ps,pstmt,psmnt;
                   psmnt = con.prepareStatement("SELECT image FROM pictures WHERE id = ?");
                        psmnt.setString(1, "4"); // here integer number '4' is image id from the table.
                   ResultSet rs = psmnt.executeQuery();
                        if(rs.next()) {
                   byte[] bytearray = new byte[1048576];
                        //out.println(bytearray);
                        int size=0;
                        sPdf = rs.getBinaryStream(1);
                        response.reset();
                        response.setContentType("application/pdf");
                        while((size=sPdf.read(bytearray))!= -1 ){
                        //out.println(size);
                        response.getOutputStream().write(bytearray,0,size);
                   catch(Exception e){
                   System.out.println("Failed Due To "+e);
                        //out.println("<h2>Failed Due To "+e);
              //out.close();
    OP
    PDF-1.4 %âãÏÓ 2 0 obj <>stream xœ+är á26S°00SIá2PÐ5´1ôÝ BÒ¸4Ü2‹ŠKüsSŠSŠS4C²€ê P”kø$V㙂GÒU×713CkW )(Ü endstream endobj 4 0 obj <>>>/MediaBox[0 0 595 842]>> endobj 1 0 obj <> endobj 3 0 obj <> endobj 5 0 obj <> endobj 6 0 obj <> endobj xref 0 7 0000000000 65535 f 0000000325 00000 n 0000000015 00000 n 0000000413 00000 n 0000000168 00000 n 0000000464 00000 n 0000000509 00000 n trailer <<01b2fa8b70ac262bfa939cc786f8770c>]/Root 5 0 R/Size 7/Info 6 0 R>> startxref 641 %%EOF
    plz help me out.

  • How to Create A new Database in the oracle 10g XE

    i have oracle 10g XE i tried to create a new database but its giveing me error when i execute the sql command that is create database testDatabase how to create a new database in oracle 10g XE

    Hi there 785434,
    (This is a generic SQL question relating to Database Triggers, please post future questions of this type into the relevant forum area.)
    Moderator, please move this if able
    I use Before Update and Before Delete Triggers to record a 'snapshot' of the row being changed in my applications.
    Example:
    CREATE TABLE TEST
    DATA VARCHAR2(64 CHAR),
    CREATING_USERID VARCHAR2(20 CHAR) DEFAULT user NOT NULL,
    CREATED_DATE DATE NOT NULL,
    CHANGED_BY_USERID VARCHAR2(20 CHAR),
    CHANGED_DATE DATE
    LOGGING
    STORAGE
    (MAXEXTENTS UNLIMITED);
    CREATE TABLE TEST_HISTORY
    DATA VARCHAR2(64 CHAR),
    CREATING_USERID VARCHAR2(20 CHAR) DEFAULT user NOT NULL,
    CREATED_DATE DATE NOT NULL,
    CHANGED_BY_USERID VARCHAR2(20 CHAR),
    CHANGED_DATE DATE,
    CHANGE_DESCRIPTION
    NOLOGGING
    STORAGE
    (MAXEXTENTS UNLIMITED);
    CREATE OR REPLACE TRIGGER TRG_BU_TEST
    BEFORE UPDATE ON TEST FOR EACH ROW
    BEGIN
    INSERT /*+ append */ INTO TEST_HISTORY
    (DATA, CREATING_USERID, CREATED_DATE, CHANGED_BY_USERID, CHANGED_DATE, CHANGE_DESCRIPTION)
    VALUES
    (:old.DATA, :old.CREATING_USERID, :old.CREATED_DATE, USER, SYSDATE, 'UPDATE');
    END;
    CREATE OR REPLACE TRIGGER TRG_BD_TEST
    BEFORE DELETE ON TEST FOR EACH ROW
    BEGIN
    INSERT /*+ append */ INTO TEST_HISTORY
    (DATA, CREATING_USERID, CREATED_DATE, CHANGED_BY_USERID, CHANGED_DATE, CHANGE_DESCRIPTION)
    VALUES
    (:old.DATA, :old.CREATING_USERID, :old.CREATED_DATE, USER, SYSDATE, 'DELETE');
    END;
    Using triggers like this will record who made an update or delete to the database and record the row before it was changed.
    Note that this method might not be suitable for very high transaction rates.
    You will need to 'clear' these history tables as part of routine maintenance.
    Hope that this Helps.
    Ronald.

  • How to connect oracle database with JAVA

    how to connect oracle database with JAVA....
    using j2sdk and Jcreator . which connector to use .. what are the code for that ..

    PLEASE .... Ask in an Oracle Java forum.
    And read the documentaiton. There is a whole document devoted to doing that. http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/toc.htm has examples.
    PLEASE ... do not ask product questions in a forum which clearly has a title saying it is devoted to assisting with download problems.

  • How to use Oracle objects in java code

    Hi all!
    I'm reading an xls and i need to fill me oracle objects with java code:
    OBJECT_NAME OBJECT_TYPE
    LETTURA_OBJ TYPE
    LETTURA_OBJ TYPE BODY
    In the past weeks i've been using both java code into oracle and oracle objects, but new i need to write those objects with data i read with java, anybody can help me?
    I know that the easiest work around would be to put the data i read from the excel file into a table and then fill the oracle objects, but now i want to learn how to write directly those objects with a command like the following one:
    a sample of the code i'm tryng to write:
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED REPORT."Manage_Excel_ASMBS" AS
    import java.io.*;
    import java.io.IOException;
    import jxl.*;
    public cass ....
    #sql{  variabili_globali.var_ER_F3.Tipo_Lettura := 5}
    thanks,
    Massimo
    Edited by: LinoPisto on 16-mag-2011 16.38

    mmmh i'm not understanding so much....
    well... as i told before i'm working in oracle database environment and i'm developing a java procedure.
    now, i have this object
    CREATE OR REPLACE
    TYPE REPORT.FATTURA_OBJ AS OBJECT (
    POD VARCHAR2(1000),
    ID_FATTURA NUMBER,
    ID_FILE NUMBER,
    COERENZA_EA_F VARCHAR2(1000),
    COERENZA_ER_F VARCHAR2(1000),
    COERENZA_EA_M VARCHAR2(1000),
    COERENZA_EF_M VARCHAR2(1000),
    ANOMALIA VARCHAR2(1000),
    MOTIVO_INVALIDAZIONE VARCHAR2(1000),
    MATRICOLA_CONTATORE VARCHAR2(1000),
    POTENZA_DISPONIBILE VARCHAR2(1000),
    MEMBER PROCEDURE pulisci
    /and i need to work with it inside this procedure:
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED REPORT."Manage_Excel_ASMBS" AS
    import java.io.*;
    import java.io.IOException;
    import java.io.StringWriter;
    public class Manage_Excel_ASMBS
    public static void read_Excel(String inputFile,int var_Id_Caricamento, int var_Id_Distributore, String var_Distributore) throws SQLException, IOException
              **here i need to put what i'm reading inside the excel file into oracle objects**
    /can you please give me a sample ?
    thanks

  • How to connect to  Oracle database from webdynprojava application

    Hi
    How to connect to  Oracle database from webdynprojava application. where can we provide the code to connect to database.?
    Thank You.

    Hi,
    You need to create  Java Bean model. The bean is a typical java bean with default constructor, getter and setter. You can have additional methods for query etc. The attributes in the class will be your model node and attributes.
    However you need to configure the connection and create JNDI using visual administrator before writing the code.
    You can also consider writing Session EJB with oracle and using them in WD.
    http://help.sap.com/saphelp_nwce10/helpdata/en/45/dcaa4f05535591e10000000a1553f7/frameset.htm
    Srini

  • How to create a standby database?

    I am running Oracle 8.1.5 on Sun Solaris. How to create a standby database? Can somebody tell me the step-by-step procedure?

    Can you tell what version of Oracle you are running, because the steps can vary depending on your version.

  • How to create User and Database in different Table spaces

    How to create User and Database in different Table spaces using oracle 10g
    Regards
    daya

    I am sorry but your question does not seem to make much sense.
    Can you please rephrase your question?

  • How to create physical standby database without dataguard

    Hi,
    Can anyone please help me how to create Physical Standby Database without dataguard. As i am using Oracle 10.2.0.1 Standard Edition for production databases.
    Please find the specifications of my server :
    Database : Oracle 10.2.0.1(Standard Edition)
    Server : Linux 4.0(32 bit machine)
    As we know that Dataguard cannot be created in Standard Edition as we dont have that option in this edition. So please help me how to create the physical standby database.
    Thanks in advance.
    Regards,
    Farooq

    Hello,
    I hope this link helps you out...
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14239/rcmbackp.htm
    http://www.dbasupport.com/oracle/ora10g/manual_standby.shtml
    Thanks & Regards
    Pratik Lakhpatwala
    Jr Oracle DBA
    Edited by: Pratik.L on Dec 31, 2009 12:03 PM

  • How to create a Cloning Database

    Dear all,
    Would you plz help me with How to create a Cloning Database in Oracle9i and Windows 2000 Server
    and how to automatically synchronize the cloned database with data
    Thanks,
    Ahmed Abd El Latif

    Oracle Data Guard Concepts and Administration
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96653/toc.htm
    theres the answer to your question.
    In big detail.
    i hope it helps

  • How to create tables in Database when webdynpro project is deployed

    Hi
    I Created a project.in that i created stuctures using simpletypes.Based on structure  i created the Context,then created screens.Now how to create tables in database using this structures .Because i want to store the values in the database.Please help.this is very urgent.i will give good points
    thanks
    prasad

    Hi Prasad,
    You can write normal JDBC code in your controller.
    Check this Web Dynpro Java
    You can use the tool for generating the classes from your DB.Check this too
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/dfad6017-0301-0010-bdb8-a8b7d2006f36
    Best Regards, Anilkumar

Maybe you are looking for

  • Weird keyboard behavior in MacBook Pro 13'

    Hi guys, I have a MacBook Pro that's starting to show a strange keyboard behavior. The problem is that the keys: e r t y u i o (curiously all belong to the same row) sometimes get unresponsive. It's very annoying of course and it happened about 4 mon

  • LE-TRA Shipment costs as inbound delivery costs, goods receipt

    Hello gurus: We are facing the following scenario, regarding inbound transportation. We plan our shipment document and shipment  costs, and they feature several items. Each of those items represent a shipping service, which in certain cases be taken

  • How can i set predictive text to a foreign language

    I'm new to apple and iPhones. I've got everything setup in English but I frequently want to send text and/or email messages in French. When I do this predictive text jumps in and changes things to what it thinks I want in English. e.g. if I type tous

  • JDBC Design Patterns

    Hi All, I am new to patterns and have started understanding them using the Head First Series. I would like to know what all design patterns are there in JDBC? Can i say that JDBC uses a Facade design patterns as it hides the database specific details

  • Bit patterns in Java

    How do I create a bit pattern (bit string, bit stream?) in Java? What I'd like to do is to contract data and use a bit pattern instead of the Java built-in standard classes. With what Java tools/classes can I achieve this? Example: Storing personal d