SQLJ connection help?

I don't know if I writing the code correctly for SQLJ to connect to the database.
But when I wrote it, it show me error on statement DefaultContext c1 = Oracle.getConnection("jdbc:oracle:thin@url", "ID", "Password", true);
I have imported:
java.sql.*;
sqlj.runtime.*;
sqlj.runtime.ref.*;
java.io.*;
oracle.sqlj.runtime.*;
I using IBM websphere with db2_v9_db2driver_for_jdbc_sqlj that I downloaded
The error statement states that
The method getConnection(String, String, String, boolean) is undefined for the type Object. Oracle cannot be resolve
Can anybody help me, I'm new to database. I got the Oracle.getConnection() from the Oracle 9i Programming book. Is this the right statement to connect to the database?

This is wrong pretty much in it's entirety. Whatever book you are using can go in the rubbish bin right now.
You do not import db specific or driver specific packages.
Your error is a classpath/configuration error..

Similar Messages

  • SQLJ Connection Context

    Hi,
    i was trying to create a SQLJ connection context following the procedure given in the following link.
    https://help.sap.com/saphelp_nw04/helpdata/en/70/a19cc472e72c4481172909938578fc/frameset.htm
    But i am getting  error when i am inserting this sqlj statement inside the class Ctx
    public class Ctx
         #sql public context Ctx with (dataSource = "java:comp/env/TMP_PERSISTENCE_EXAMPLE");//here i am getting this error
    Error               
    SQLJ: The ConnectionContext class "Ctx" must not be declared as an inner class of the class "temp.persistence.gettingstarted.dao.Ctx". It may be declared as a static inner class.     Ctx.sqlj     OpenSQLWeb/source/temp/persistence/gettingstarted/dao     
    could u tell me how i can resolve this.

    Hi,
      i think you are refering to the sqlj file
      with reference to the example its ctx.sqlj
      The contents of the file are
    <-- Start -->
    package temp.persistence.gettingstarted.dao;
    #sql public context Ctx with (dataSource = "java:comp/env/TMP_PERSISTENCE_EXAMPLE");
    <-- End -->
    its not a class file.
    If you have installed JDT, you will have the complete working example in 'C:\Program Files\SAP\JDT\eclipse\examples\J2EE_GettingStartedOpenSQL.zip'
    Hope that helps.
    Regards,
    S.Divakar

  • Hi, my iphone 4s is saying im not connected to the internet, my wifi is on and ive tried switching it off and on and nothing, still cant connect. help!

    hi, my iphone 4s is saying im not connected to the internet, my wifi is on and ive tried switching it off and on and nothing, still cant connect. help! it was working perfectly fine earlier today.

    Try a reset by pressing the home and sleep buttons until you see the Apple logo, ignoring the slider. Takes about 5-15 secs of button holding and you won't lose any data or settings.

  • HT5538 My facetime and imessage aint working now, when i try to turn it on, it says waiting for activation then when it finishes it says something to do with a network connection. help me!!!

    My facetime and imessage aint working now, when i try to turn it on, it says waiting for activation then when it finishes it says something to do with a network connection. help me!!!

    iOS: Troubleshooting FaceTime and iMessage activation

  • This morning I was able to access iTunes Store on my computer and iPod 5G - and now I cant access the store at all - something about my network connections - help? ive restarted rebooted

    This morning I was able to access iTunes Store on my computer and iPod 5G - and now I cant access the store at all - something about my network connections - help? ive restarted rebooted

    Thank you so much for replying. But resetting my apple I'd Password seems to have done the trick. I am able to download apps :). Got me worried I even uninstalled kaspersky 2012 :( got to reinstall back

  • All adobe products that I have will not connect help when I seek online help?

    all adobe products that I have will not connect help when I seek online help?

    Waht version of the software are you trying to use? And the error seems pretty self-explanatory...

  • My ipad says it has an internet connection but when i try to access safari it says it is unable to as there is no internet connection, help!

    My ipad says it has an internet connection but when i try to access safari it says it is unable to as there is no internet connection, help!

    Tap Settings / General / Reset / Reset Network Settings.
    Restart your IPad. Press and hold the On/Off Sleep/Wake button until the red slider appears. Slide your finger across the slider to turn off iPhone. To turn iPhone back on, press and hold the On/Off Sleep/Wake button until the Apple logo appears.
    If that doesn't help, try here >   Apple - Support - iPad - Wi-Fi

  • My iphone is not syching at itunes. Everytime it says your iphone as been diconnected whenever I try to synch it, while logo on phone and itunes says it is still connected. help I have this problem with both my Iphone4 and Iphone5 with backup as well

    My iPhone is not synching at iTunes. Every time it says your iPhone as been disconnected whenever I try to synch it, while logo on phone and iTunes says it is still connected. help I have this problem with both my Iphone4 and Iphone5. This problem is with the back up as well.

    Hi singhgurwinder79,
    The article linked below provides details that can help troubleshoot this error and get your iPhone to sync correctly with iTunes.
    iTunes: Resolve USB-related alerts
    http://support.apple.com/en-us/HT203843
    Regards,
    Allen

  • Trouble context in SQLJ (please help)

    Hi,
    I have a problem using "Oracle JDeveloper" as tool to compile sqlj programs.
    I have created a connection conn and I want to use this connection with a context. This is the code that I have writed:
    import java.sql.*;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import sqlj.*;
    import oracle.sqlj.runtime.*;
    import java.util.Vector;
    import sqlj.runtime.*;
    import java.math.*;
    import sqlj.runtime.ConnectionContext;
    public class Sqlj2 {
    public static Connection getConnection1() throws Exception {
    String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    String url = "jdbc:Odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=c:/Oracle/Progetto.mdb";
    String username = ";UID=Roberto;";
    String password = "PWD=prova";
    Class.forName(driver); // load MySQL driver
    Connection conn = DriverManager.getConnection(url+username+password);
    return conn;
    public static void main(String[] args) {
    Connection connection1 = null;
    try {
    connection1 = getConnection1();
    #sql context Ctx1;
    Ctx1 context = new Ctx1(connection1);
    #sql [context] { SELECT id_dip,nome_dip,budget FROM Dipartimento WHERE budget > 1000 };
    } catch (Exception e) {
    e.printStackTrace();
    System.exit(1);
    } finally {
    try {
    connection1.close();
    } catch (SQLException e) {
    e.printStackTrace();
    In particular this peace of code give me a trouble:
    Ctx1 context =  new Ctx1(connection1);
    The word "Ctx1" is always red in JDeveloper!!!! I think I import all the classes that I need....
    How can I solve this problem?
    Can you try to run this code to look if the text is red in your compiler?
    Please help me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Thanks!!!
    Edited by: user1762560 on 2-dic-2008 10.41

    please answer me...it's very important...can you give me the name of another sqlj compiler?

  • Itunes crashes if ipod is connected, help???

    itunes version 6.0.4.2 crashed when i connect my ipod. i can see my ipod as an usb device and am able to transfer data (from and on) but it is not possible to do anything with itunes. i later installed itunes version 7.0.2.16 but that did not help either. also most of the files shown on the ipod are not accessible (videos and music) for whatever reason...
    the only thing that i changed was the automatic synchronize option which i turned off.
    if anybody knows what to do please help...

    I discovered another thread posting which mentioned that Diego episodes were causing some sort of corruption which prevent the sync ad crashing iTunes. Deleted the podcasts from both iPhone (using swipe function) and iTunes (without iPhone connected) and it seemed to fix the problem.

  • No longer got internet connection. help, tryed to down load to many Apps at once, ipad froze. dealeted Apps, no longer got internet connection. help

    help, tryed to down load to many Apps at once, ipad froze. dealeted Apps, no longer got internet connection. help

    What's your problem is 1) your ipad froze or 2) you now have no internet connection?
    Have you restarted/reset your device?
    http://support.apple.com/kb/HT1430
    https://discussions.apple.com/message/19521062#19521062

  • SQLJ connection exception in oracle 8i and jdk 1.5

    This is the code through which i am trying to extract current date from oracle database and print Helloworld
    // import required packages
    import java.sql.Date;
    import java.sql.SQLException;
    import oracle.sqlj.runtime.Oracle;
    public class HelloWorld {
    public static void main(String [] args) {
    java.sql.Date current_date;
    try {
    // connect to the database
    Oracle.connect(
    "jdbc:oracle:thin:@localhost:1521:orcl",
    "student",
    "student"
    // get the current date from the database
    #sql { SELECT sysdate INTO :current_date FROM dual };
    // display message
    System.out.println("Hello World! The current date is " +
    current_date);
    } catch ( SQLException e ) {
    System.err.println("SQLException " + e);
    } finally {
    try {
    // disconnect from the database
    Oracle.close();
    } catch ( SQLException e ) {
    System.err.println("SQLException " + e);
    } // end of main()
    this is the error
    unexpected error occurred...
    java.lang.ExceptionInInitializerError
         at sqlj.translator.Translator.addUnit(Translator.java:117)
         at sqlj.translator.Main.translate(Main.java:112)
         at sqlj.translator.Main.runTranslation(Main.java:92)
         at sqlj.translator.Main.runTranslation(Main.java:85)
         at sqlj.tools.Sqlj.statusMain(Sqlj.java:280)
         at sqlj.tools.Sqlj.main(Sqlj.java:125)
    Caused by: java.lang.NullPointerException
         at sqlj.framework.ClassFileReader.attribute_info(ClassFileReader.java:326)
         at sqlj.framework.ClassFileReader.readClass(ClassFileReader.java:224)
         at sqlj.framework.ClassFileReader.describeClass(ClassFileReader.java:62)
         at sqlj.framework.ClassFileReader.getDeclaringClass(ClassFileReader.java:146)
         at sqlj.framework.JSClass$ClassWrapper.getDeclaringClass(JSClass.java:1649)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1496)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1545)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1552)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1507)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1533)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1545)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1552)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1507)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1545)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1552)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1507)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1533)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
         at sqlj.framework.JSClass.resolveIfNonNull(JSClass.java:1513)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1493)
         at sqlj.framework.JSClass.resolveIfNonNull(JSClass.java:1513)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1493)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1534)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1545)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1552)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1507)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1533)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
         at sqlj.framework.JSClass.resolveIfNonNull(JSClass.java:1513)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1493)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1545)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1552)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1507)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1494)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1533)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1533)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1534)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
         at sqlj.framework.JSClass.resolveIfNonNull(JSClass.java:1513)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1495)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1534)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1494)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1534)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
         at sqlj.framework.JSClass.resolveIfNonNull(JSClass.java:1513)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1493)
         at sqlj.framework.JSClass.resolveIfNonNull(JSClass.java:1513)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1493)
         at sqlj.framework.JSClass.reflectSystemClass(JSClass.java:1340)
         at sqlj.framework.JSClass.<clinit>(JSClass.java:49)
         ... 6 more
    HelloWorld.sqlj: Error: Exception caught:
    Total 1 error.

    SQLJ 8i with jdk1.5?
    Please try SQLJ 10.2 with jdk1.4.

  • After 10.7.5 update, Bluetooth can't connect, help!

    I'd been using a BT speaker (Logitech Boombox) with more or less reliable connectivty with my MacBook Air (2012) (my Android phone never has a problem connecting to speaker), but after updating to 10.7.5 now, I can't connect to any BT device!  The MBA is paired to both devices (phone and speakers), but now won't connect to either.  I've tried to re-pair the devices, I've tried the "update services" trick, my MBA is "discoverable", yet nothing works.  It's not the speaker, as it connects fine with my Android phone.  Losing my mind on this one, please help!

    UPDATE, SOLVED?:  Somehow, it has magically fixed itself...I literally have no idea how, as I have spent 2 hours messing with it, it just started to work again and list itself as connected.  One idea is that perhaps the MBA wouldn't connect until it was "needed", i.e. until I tried to play something from ITunes?  But I had tried that before with no luck, soooo. Another Idea is that I had my HDMI hooked up while playing around, and perhaps that would try and take the audio signal instead of letting it go into the BT?...It's a mystery but at the moment, it works, knock on wood.

  • Apple shop changed my iphone 3gs today, got home and cannot join my wifi. both my mac and ipad is working on wifi. tried rebooting, resetting still doesnt hold the wifi, it's there for a sec then its not connected.help please?

    Hi,
    Apple shop exchanged my iphone 3gs today. got home but it doesnt pick up the wifi. first the correct supplier appears then it says not connected.
    both my mac and ipad is working on wifi (so did the previous phone) i ve tried rebooting, tried reset supplier...nothing works. can someone help please?
    thanks

    Yes, they should be able to verify that WiFi is working properly. If I just got a new phone & it didn't work perfectly, right out of the box, before I started restoring or whatever, I'd be right back where I got the phone.

  • Laptop to ultra 10 connection help required

    Hi ,
    I recently purchased a used ultra 10 for trying out , but i get no display on my monitor. I assume the display card is not working.
    I would like to connect it to my laptop (IBM T42). I used hyperterminal along with a serial cable but i dont get any display on my laptop.
    Can you guide me with which cable i should use (i dont know much about cables so pls try to elaborate for me.)
    and do i have to do any other settings.
    Any help is apprecaited

    The Sun systems have a 25 pin female RS-232 connector while PCs have a 9 pin male connector. If you buy a Null-Modem cable you'll usually only find cables with 9-pin plugs on both ends.
    If you want to solder the cable yourself you do not need to solder a "complete" Null-Modem cable; a so-called 3-wire cable is enough.
    The pinning is:
    PC (9 pin female)               SUN (25 pin male)
        2 (RX) ------------------------ 2 (TX)
        3 (TX) ------------------------ 3 (RX)
        5 (GN) ------------------------ 7 (GN)Typically the SUN has the following serial port settings:
    9600 bauds, 8 bits/byte, no parity, 1 stop bit
    Martin

Maybe you are looking for