Java with RDBMS

Hi,
I want to use java with oracle (java stored procedures). I am not able to compile my java class even. Is JDK not installed when oracle is insatlled ? or there is some other error? or i shall some other way to create my class?
wht shall i do to start
Thx in advance
Namrata

JDK is installed with oracle.
For compiling the java class you should have <Oracle_HOme>/jdk/bin in your system path variable.
Also set the classpath to have all the jars required by your program. For example if you are using jdbc, include <Oracle_Home>/jdbc/lib/classes12.jar in classpath.
Refer this url for samples on java stored procedure.
http://otn.oracle.com/sample_code/tech/java/jsp/oracle9ijsp.html
Chandar

Similar Messages

  • Can' t connect Java with MySQL

    My goal is to connect Java with MySQL. I found many solutions on Internet, but I always get the same mistake:
    SQLException: No suitable driver
    SQLState: 08001
    VendorError: 0MySQL works fine alone or with php.Only thing left me to think is that the installed versions are not compatible for this mysql-connector-java-5.0.4
    I don't believe that could be a reason.
    Installed versions are:
    Apache Tomcat 5.5.20 Server
    Apache HTTP Server 2.2.4
    PHP 5.2.0
    MySQL 5.2
    jre 1.5.0_11
    jdk1.5.0_11
    Apache Tomacat JK2 connector Version: 1.2.20 File Name: mod_jk-apache-2.2.3.so
    mysql-connector-java-5.0.4
    I also set connector in class path: C:\mysql-connector-java-5.0.4;C:\mysql-connector-java-5.0.4\mysql-connector-java-5.0.4-bin.jar;C:\mysql-connector-java-5.0.4\src\com\mysql\jdbc
    For installation I used manulas from:
    http://apacheguide.org/jsp.php
    http://doc.51windows.net/mysql/?url=/MySQL/ch23s03.html
    Here is also a test code in java:
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
       public class Connect
           public static void main (String[] args)
               Connection conn = null;
               try {
        conn =
           DriverManager.getConnection("jdbc:mysql://localhost/first_test" +
                                       "user=monty&password=greatsqldb");
        // Do something with the Connection
    } catch (SQLException ex) {
        // handle any errors
        System.out.println("SQLException: " + ex.getMessage());
        System.out.println("SQLState: " + ex.getSQLState());
        System.out.println("VendorError: " + ex.getErrorCode());
       }i'm desperate, please help or tell me someone who'll know the answer.
    Thank You in advance

    hey buddy .. it seems yr code is wrong .. in getconnection () method u should also specify the port ,which u r not doing ...
    the default port for MySQL is 3306 ... see below i am giving you a sample code ... its working fine .. and dont forget to put the MySQL driver jar path in to classpath and also copy the jar into common/lib folder of your tomcat ....
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    public class MySQLConnectionTest {
         public static void main(String[] args) {
    new MySQLConnectionTest().connTest();
    public void connTest() {
              String tableName = "portfolio"; //change as per setting
              String hostName = "10.81.9.39"; // please change for the target database ip or hostname
              String dbPort = "3306"; //change if not using the default
              String dbName = "tradingsystem"; //change as per the given DB name
              String username = "root"; //change as per setting
              String password = "password"; //change as per setting
              System.out.println("before try");
              Double data=0.0;
         Double data1=0.0;
              try {
    Class.forName("org.gjt.mm.mysql.Driver");
                   System.out.println("before driver manager");
    Connection conn = DriverManager.getConnection("jdbc:mysql://"+hostName+":"+dbPort+"/"+dbName, username, password);
    String query1 = "select * from "+tableName+" where User_id='trader1' and Stock_Type='Equity'";
    System.out.println("quesry1="+query1);
    Statement stmt = conn.createStatement();
    ResultSet rs1 = stmt.executeQuery(query1);
    while(rs1.next())
         System.out.println("hiiiiii for rs1");
         System.out.println(rs1);
         Quantity=(Integer)rs1.getObject(5);
         MarketPrice=(Double) rs1.getObject(8);
         data=Quantity*MarketPrice;
         data1+=data;
         System.out.println("data1="+data1);
         i=0;
    rs1.close();
    stmt.close();
    conn.close();
    } catch (ClassNotFoundException e) {
    e.printStackTrace(System.err);
    } catch (SQLException e) {
    e.printStackTrace(System.err);
    i hope it will work for u...
    cheers,

  • How to read azure storage data using JAVA with REST API

    Hi,
    We have a cloud service in our lab. We have enabled diagnostics
    in cloud services. So WADPerformanceCounterTable was created in storage account. Now , We want to read the WADPerformanceTable using
    JAVA with REST API. Is there any way to collect these details. please give me any
    sample code to connect azure storage using table service REST API.
    Thanks & Regards
    Rathidevi

    Hi,
    Please have a look at this article:
    https://convective.wordpress.com/2010/08/18/examples-of-the-windows-azure-storage-services-rest-api/, it demonstrate how to use table service Rest API, it also give us the code, hope this helps. Of course, the
    MSDN article could also help us coding.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to use Java with PL/SQL commands to send an email with attachment

    Apologizes in advance if this is the wrong place to ask the question.
    I need to use Java with PL/SQL commands to send an email with attachment. My java application runs from the command line and does some magic to gather info from an Oracle 11g db. If the DB has sendmail configured, I'd like to send the results of the data gathering as an attachment to the email addresses. I'm not sure how to do this. I've been reading up on on PL/SQL can send email with UTL_SMTP - with attachments. I'm just not sure how to translate that into being triggered by my Java application. Any suggestions or pointers on what I should read would be appreciated.
    Background - I've been programming in Java for 10+ years, but this is my first time using databases. I also have been on these forums for a long time, but lost my profile when it was switched to Oracle.
    Thanks for all help.

    user13726880 wrote:
    The original requirements were put together and given to me, an Oracle newbie. They expected the Java app to use something intrinsic to Oracle and Unix sendmail. To solve my problem, I use a JDBC connection to run some SQL commands. I take that data, format it and send the results by email to the user. By default the requirement is to send it as an HTML attachment using Unix 'sendmail'. So I do that using Runtime exec. I have also added JavaMail functionality as an alternative to sendmail. It works great and as expected.Sounds like a reasonable solution.
    Note however that PL/SQL itself can send email. And PL/SQL can call unix sendmail too.
    However myself I would have done it in java with JavaMail.

  • JAVA WITH WINDOWS FORM?

    Dear all,
    I have a question about java with windows form.
    I have an exe or DLL stand alone program make by visual basic 6.
    Also I have a java software build up with swing.
    Can the exe or DLL program executed inside the Java software?
    It means I click the menu and select a function in the Java software.
    And then the exe or DLL will be executed and a windows form will be pop up.
    But I want to fake like a Java jpanel not a stand alone program run outside the Java software.
    Is it possible?
    Thanks you~~

    All here,
    You can do it ... we can hep!
    Once you choose the exe you want to run, execute it via Process ... about like so:
              String theWindowsProcess =
                                  "notepad.exe";         // OR
    //                            "runtc.bat";                // OR
    //                            "cmd /C start /min /Dc:\\temp runtc.bat";
              Process myProcess = Runtime.getRuntime().exec( theWindowsProcess);BTW ... this is a very common question.

  • Date Problem in Java with MySql

    Hello
    I am using Java with Mysql.I want to enter date in some in my format(YYYY:MM:DD:HH:MM:SS), this thing i have convert using format class and format class return date in String and iwwnat to insert this value in MySQL Table,So i want to know how can i convert String value in Date for Mysql is their inbuild function for converting string into date in mysql.
    Regards
    Anupam S

    Use PreparedStatement and SimpleDateFormat classes
    http://onesearch.sun.com/search/onesearch/index.jsp?qt=%2BPreparedStatement+%2BSimpleDateFormat+&qp=siteforumid%3Ajava48&chooseCat=allJava&col=developer-forums&site=dev

  • Can XDK 10g work with RDBMS 8i or 9i?

    Hi there, my stupid question is wheter XDK 10g can work with RDBMS 8i or 9i? I.e. if I decide to use XDK 10g for some application, can I address an Oracle 8i or 9i database to insert or retrieve XML data? Thanks...

    XDK 10g may be used with Oracle 9i or Oracle 10g database.

  • An error occured when connecting java with Ms Access

    Hello Everybody
    I am a new developer in java and want to connect java with Microsoft Access
    i am using JCreator LE
    My code is to insert 3 records for 3 members and then save them in DB and retrieve the information
    Here is the code
    import java.sql.*;
    public class Project3 {
        public static void main(String[] args) {
             try {
                  System.out.println("Beginning Connection");
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                String accessFileName = "Information";
                String connURL = "jdbc:odbc:;DRIVER=Microsoft Access Driver (*.mdb);DBQ="+accessFileName+".mdb;PWD=";
                Connection con = DriverManager.getConnection( connURL ,"","");
                Statement stmt = con.createStatement();
                System.out.println("Connection done successfully");
                stmt.execute("Create table Member(Name String,ID Integer)");
                stmt.execute("insert into Member values ('Joe','1234')");
                stmt.execute(" select * from Member");
                ResultSet rs=stmt.getResultSet();
                if (rs != null)
                     while (rs.next()){
                          System.out.println("Name: "+rs.getString("Name")+ "ID: " + rs.getString("ID"));
                stmt.close();
                con.close();
                catch (Exception e) {
                System.out.println("An error Occurred in Connecting with the DB " );
    }and the error is
    Beginning Connection
    Connection done successfully
    An error Occurred in Connecting with the DB
    it didn't insert information in the DB

    Well, thank u i have traced the error and fx it
    but
    how to modify the code and keep the user entering 3 values and search for the entered values??
    Here is the correct code
    import java.sql.*;
    public class Project3 {
        public static void main(String[] args) {
             try {
                  System.out.println("Beginning Connection");
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                String accessFileName = "jdbc:odbc:Project";
                String connURL = "jdbc:odbc:;DRIVER=Microsoft Access Driver (*.mdb);DBQ="+accessFileName+".mdb;PWD=";
                Connection con = DriverManager.getConnection( accessFileName);
                Statement stmt = con.createStatement();
                System.out.println("Connection done successfully");
                stmt.execute("Create table Member(Name String,ID Integer)");
                stmt.execute("insert into Member values ('Joe','1234')");
                stmt.execute(" select * from Member");
                ResultSet rs=stmt.getResultSet();
                if (rs != null)
                     while (rs.next()){
                          System.out.println("Name: "+rs.getString("Name")+ "ID: " + rs.getString("ID"));
                stmt.close();
                con.close();
                catch (Exception err) {err.printStackTrace();}
    }

  • What contents we can include under JAVA with SAP NetWeaver 7.0?

    hi friends,
    i want to know about JAVA with SAP NetWeaver 7.0.
    whether it covers only java programming or java-WebDynpro,portal and many more?
    can somebody give details on this?
    i have worked on java-WebDynpro,portal.is that enough to get certification on JAVA with SAP NetWeaver 7.0-Associate  C_JAVA_70?
    please provide me details.
    thanks
    Nutan.

    Hi Rajesh,
    I cleared this certification last year. Go through the syllabus mentioned. In our time there were 13 different sections e.g NWDI, EJBs, WD etc which had multiple choice qs and u need to click on the radio button for that.
    How to prepare.
    Go through the topics and course books mentioned in the syllabus well. U should be clear with all the basics especially EJBs and NWDI, lot many qs asked from these. WedDynpro qs are basically easy.if u dnt have books chk sdn and help site fot the topics.Qs chk your understanding of the content. They come from syllabus but are not direct and multiple choice make it difficult to answer.
    How to answer the questions.
    Chk every option in case of mutiple choice. Mark only those options which u are full confident and den if more than 50% confident bcoz we heard there were -ve markings although not sure how they calculated marks.
    Is any sample test program is there?
    There are no sample test program for this.
    All D Best for the certification.
    Regards
    Priyanka

  • Accessing BAPI's using JAVA with out using webdynpro URGENT

    hi Experts,
    What is the procedure for calling RFC/BAPI's using JAVA with out using the webdynpro. Please let me know what are the possibilities with step by step implementation.
    Regards
    Vijay

    Hi Boris Rubarth,
    Thaks for relavant information.
    I have kind of the requirement. The clinet is asking for connecting the SAP RFC using java application. The build Jar or .war or .Ear for which are going to develop should be compatible for running on any of the Applications server like they have Tom cat, weblogic, websphere server.
    so the .jar for or .ear file which we are going to develop should be able to run accessing the RFC/ BAPIs from any of these servers other than SAP WAS that is what their target.
    Please give me your suggestion, which is better approach. currently their SAP system is 4.6c . So presently it is not possible the webservice approach. But they have plans to go for upgrade to ECC6.0
    In that case only JCO option is possible. If use this option . Is it possible to access application which is deployed irrespective of the WAS by doing the required configuration.
    Basically i am aware of the ABAP webservice work bech steps and also the JAVA coding also.
    Please suggest me what is the better way to achieve this.
    Regards

  • How to connect Java with Acces (DSN Less)

    Hi, I'm try to connect an Access DataBase in Java with an example. I find it in this forum, but don't work...
    I've my database in the folder Data, and its name is BaseDat.mdb...
    I'm working in NetBeans 5.5, and the DataBase is in the Folder: "C:/Documents and Settings/MetalTux/POOL/src/Data/BaseDat.MDB"...
    This way, its work, but It's another way to use this... without the "C:/Documents and Settings/MetalTux/POOL/src/"????
    Please help me... and sorry my english...
    Regards...

    I have this in my code:
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conec = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/Documents and Settings/MetalTux/POOL/src/Data/BaseDat.MDB");
    This is OK... work in my code...
    But I want to know if there's another way to do this... without "C:/Documents and Settings/MetalTux/POOL/src" code....
    In Visual Basic I do this with "App.Path", but I don't know how I can do the same thing in Java...
    Please help me...

  • How to connect java with C

    Plz help....
    How to Connect a Java With C ....

    using the JNI, Java Native Interface. there are tons of tutorials on the web about it, that will explain far better and more completely than a few posts on a forum

  • Unable to connect JAVA with Oracle

    I have jdk1.6 and oracle installed on my machine but unable to connect java with database
    have classes12.jar and ojdbc14.jar
    my environmental variables in respect to this are :
    JAVA_HOME= C:\Java\jdk1.6.0_04
    JRE_HOME=C:\Java\jdk1.6.0_04
    PATH=J:\oracle\ora92\lib;
    J:\oracle\ora92\bin;
    C:\Program Files\Oracle\jre\1.3.1\bin;
    C:\Program Files\Oracle\jre\1.1.8\bin
    CLASSPATH=J:\oracle\ora92\jdk\jre\bin\JdbcOdbc.dll;
    J:\oracle\ora92\jdbc\lib\classes12.jar;
    J:\oracle\ora92\jdbc\lib\ojdbc14.jar
    The code is
    import java.sql.*; public class dat1 {               public static void main(String[] args)throws SQLException,ClassNotFoundException {         try     {     Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");     Class.forName("com.oracle.jdbc.OracleDriver");     } catch (ClassNotFoundException e) { System.out.println("unable to load driver"); return; }     } }
    the error message is
    Error in thread "main" java.lang.NoClassDefFoundError
    Please Help Me
    Thanks For Reading
    Thanks a lot in Advance For your ANSWERS

    maybe if you asked nicely instead of ordering people around we might tell you.
    As it is all you're going to hear is that you don't need both those jars, as they contain different versions of the same driver.
    I'm not going to tell you which you need, as you should have the documentation to tell you that. But then you also should have the documentation to tell you how to set your classpath properly and you failed to read that too.

  • How to connect java with database without any dsn.

    is there any way to connect java with database with out creating any dsn..like we do in ado in vb by providing provider.

    Sure use a type 4 driver. No DSN.

  • How to connect java with oracle

    can any body show me the code of how to connect java with oracle database.
    thank you

    To configure Oracle JDBC:
    1. Add Oracle JDBC JAR file classes12.zip or ojdbc14.zip to classpath.
    2. Load and register the JDBC driver.
    Class.forName("oracle.jdbc.driver.OracleDriver");
    3. Obtain a connection:
    String url="jdbc:oracle:thin:@<host>:1521:<database>
    Connection con = DriverManager.getConnection(url,
    "myLogin", "myPassword");
    4. Create a SQL statement.
    Statement stmt = con.createStatement();
    5. Obtain a result set.
    ResultSet rs = stmt.executeQuery(
    "SELECT ...");

Maybe you are looking for

  • Remote control and data logging

    Hello, Somebody can help me? Measuring computer measures data from data acquisition card continuously. Measured data are saved to .txt file and moreover they are transmitting to Data server over Ethernet. Remote computers should be able to access to

  • How to make SSIS Read an Excel File?

    I've been trying for a while now (won't say how long), to get BIDS to read a very simple Excel file.  I'm talking SIMPLE!!  No matter what I don, SSIS keeps throwing an error, and of course it doesn't say what the error is, so I can't really debug it

  • Exporting to Flash - Problem with Audio

    When importing a Captivate movie into Flash, I'm noticing that the audio on each slide runs together when the forward/rewind buttons on the control are pressed. Is this just a bug in the import/export process, or is there a setting that needs to be a

  • Creating a thread inside doPost

    Hello, I have a process which consumes approx 20-30 minutes. I don't want the user to wait till the processing is complete. I would like to display a response as soon as the data is sent to server. So I plan to create an instance of Thread and put th

  • Netweaver trial version - Connection refused

    Hi. When I log into my sap gui for windows 720 trial version - i am not able to connect to the server. the following error message appears. partner : 127.0.0.1:sapdp00 not reached. WSAECONNREFUSED : connection refused pl advice as how to disable the