Need help connecting to a database with an applet

I am making a Java game that runs in an applet and needs to connect to a Java DB database. I created the database and table in NetBeans and now I have no idea how to connect this applet to the database. I tried using a DataSource and an InitialContext and I got a NoInitialContextException. Any help would be appreciated thanks.

Already made the InitialContext. This is the code I used in the applet:
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("jdbc:derby://localhost:1527/GameDatabase");
Connection con = ds.getConnection();
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM Scenery");

Similar Messages

  • Need Help Connecting New MacBook Pro with Wireless Network Password

    Hi Linksys Community,
    I would like to ask for your help and advice.
    I recently purchased a new MacBook Pro, OS X, Version 10.8.3.
    I need to setup a password to the wireless internet network (I've successfully done this)
    I have a Wireless G,  WRT54G Router. 
    When I setup the password, I'm not able to connect to the internet with my new MacBook Pro, which is running Mac OS X Version 10.8.3.  I get the message 'cannot connect to Internet, connection timeout) However, I'm able to connect to the internet with an older MacBook Pro, and my iPad. The password works fine with other models.
    Would anyone be able to help me troubleshoot what is going on, or how I can solve this problem?
    I would like to be able to have a password on my network, and use the internet with my new MacBook Pro.
    I have read about manually adding in the MAC address of computers, and setting up a Wireless MAC fiter.
    Does anyone think this would solve the problem?  if so, how can I find out the MAC address of my MacBook Pro?
    Thanks in advance for you help and time!

    Hi,
    Thanks for your response.
    Yes, my computer connects when your network is open (no password set)?
    I used WPA Pre-Shared Key.
    Do you know how I could check if my new MacBook Pro is compatible with this?
    Thanks!

  • Newby Needs Help Connecting to Oracle Database

    I'm very very new to java. I'm trying to write a program to connect to and read some fields in an oracle table. I'm having problems and am not sure how to correct it. I downloaded and installed the oracle thin driver. I'm using Eclipse 3.3 and JRE 1.6. This is my code:
    import java.sql.*;
    public class One {
         public static void main(String[] args) {
              try {
                   DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
                   System.out.println("let's connect");
                   Connection conn=DriverManager.getConnection(
              "jdbc:oracle:thin:@a571p05.pt.com:1521:orap1","username","password");
                        System.out.println("I'm connected");
                        Statement stmt=conn.createStatement();
                        ResultSet rset=stmt.executeQuery(
                             "select CUSTNUM,CUST_LNAME from TBL.CUSTOMER where " + "CUSTNUM=\"12345678900\"");
                   System.out.println("Result set?");
                   while (rset.next())
                        System.out.println(rset.getString(1)); //Print col 1
                   stmt.close();
              catch(Exception x) {
                   System.out.println("Unable to connect!");
              System.exit(0);
    If I just run it, this is the output:
    let's connect
    I'm connected
    Unable to connect!
    So, it looks like it may be connecting, at least it runs the line that establishes the connection then the next line which prints a comment. However, it seems to fail at some point thereafter. I've tried debugging it and as far as I can tell, it's erroring out on thie line:
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    with this stack trace:
    Thread [main] (Suspended)     
         ClassNotFoundException(Throwable).<init>(String, Throwable) line: 217     
         ClassNotFoundException(Exception).<init>(String, Throwable) line: not available     
         ClassNotFoundException.<init>(String) line: not available     
         ClassLoader.findBootstrapClass(String) line: not available [native method]     
         Launcher$ExtClassLoader(ClassLoader).findBootstrapClass0(String) line: not available     
         Launcher$ExtClassLoader(ClassLoader).loadClass(String, boolean) line: not available     
         Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line: not available     
         Launcher$AppClassLoader.loadClass(String, boolean) line: not available     
         Launcher$AppClassLoader(ClassLoader).loadClass(String) line: not available     
         Launcher$AppClassLoader(ClassLoader).loadClassInternal(String) line: not available     
         One.main(String[]) line: 8     
    I checked the project properties\java build path and I have JDBC_THIN_DRIVER and JRE_SYSTEM_LIBRARY listed there. Do I need something else? I'm not quite sure what I'm missing or what the errors are telling me. Any help, or pointers are appreciated. Thanks much!

    I would write that class more like this, assuming that customer ID is a String:
    import java.sql.*;
    public class One
       private static final String DEFAULT_DRIVER = "com.oracle.jdbc.Driver";
       private static final String DEFAULT_URL = "jdbc:oracle:thin:@a571p05.pt.com:1521:orap1";
       private static final String DEFAULT_USERNAME = "username";
       private static final String DEFAULT_PASSWORD = "password";
       private static final String SQL = "select CUSTNUM,CUST_LNAME from TBL.CUSTOMER where CUSTNUM=?";
       private static final String DEFAULT_CUSTOMER_ID = "12345678900";
       public static void main(String[] args)
          Connection conn = null;
          PreparedStatement stmt = null;
          ResultSet rset = null;
          try
             Class.forName(DEFAULT_DRIVER);
             conn = DriverManager.getConnection(DEFAULT_URL, DEFAULT_USERNAME, DEFAULT_PASSWORD);
             stmt = conn.prepareStatement(SQL);
             String customerId = ((args.length > 0) ? args[0] : DEFAULT_CUSTOMER_ID);
             stmt.setString(1, customerId);
             rset = stmt.executeQuery();
             while (rset.next())
                System.out.println(rset.getString(1));
          catch (Exception x)
             x.printStackTrace();
          finally
             close(rset);
             close(stmt);
             close(conn);
       private static void close(Connection conn)
          try
             if (conn != null)
                conn.close();
          catch (SQLException e)
             e.printStackTrace();
       private static void close(Statement stmt)
          try
             if (stmt != null)
                stmt.close();
          catch (SQLException e)
             e.printStackTrace();
       private static void close(ResultSet rset)
          try
             if (rset != null)
                rset.close();
          catch (SQLException e)
             e.printStackTrace();
    }%

  • Need help Connecting Crystal Reports 8.5 with GBS Agency Expert 6.7.6c

    Need help Connecting Crystal Reports 8.5 with GBS Agency Expert 6.7.6c.  I need assistance on connecting these together so I can run a report.  I am not an IT person so if someone could dumb it down it would be great.
    Thanks,
    NBGHealth

    Hello,
    I assume GBS Agency Expert 6.7.6c is some sort of database or data source? If you have an ODBC driver then create or use a System DSN to the database. Then you can create a report using that DSN.
    Otherwise I suggest you contact the makers of GBS Agency Expert 6.7.6c and ask them how to connect to the database.
    Let them know CR is ANSII 92 ODBC 3 compliant.
    Thank you
    Don

  • Need to connect to GreenPlum Database in SAP BI 4.0

    Hi ,
    We Need to connect to GreenPlum Database in SAP BI 4.0,
    i dont see any specific driver to set up a system dsn for this data source.
    So can any one share your experience if you built a universe based on green plum db(UNX using IDT in 4.0)
    or even in earlier versions of BO how to create a system dsn for greenplum db,
    which driver we need to use.

    Hi,
    Infact, GreenPlum 4 is not 'officially supported' with BI 4.0 until Feature Pack 03 next year.
    This is OK currently:
    Greenplum     3.2     JDBC     PostgreSQL 8.4 JDBC
    Greenplum     3.2     ODBC     PostgreSQL 8.4 ODBC
    This will come with 4.0.FP03 :
    Greenplum     4     JDBC     PostgreSQL JDBC 8.4-701
    Greenplum     4     ODBC     PostgreSQL ODBC 9.00.03.00
    Regards,
    H

  • Need help connecting a windows network printer to my Mac (Xerox Phaser 3600) over a windows home network

    Need help connecting a windows network printer to my Mac (Xerox Phaser 3600) over a windows home network.
    My Mac runs lion and the windows desktop runs Windows XP
    I have tried for a few hours or so to connect my mac to this printer over a home network.
    For your information it does work when connected directly to my mac using a USB Cable.
    If there is no soultion could I have help getting the drivers for a Dell All-in-One Photo 926

    In most cases you can connect to the Windows shared printer from the Mac. But there is a dependence on the Mac driver being compatible. For many consumer inkjets, the vendor created driver cannot be used for this type of connection so you need to look at alternative drivers, such as Gutenprint or PrintFab. If you can tell us which brand and model of printer you have shared from Windows then we can answer your question with the preferred procedure on the Mac.

  • INS0009: Unable to connect to the database with user SYS

    Hi all,
    I'm trying to create an OWB repository with OWB repository assistant (10.2.0.2.) on a 10.2.0.1. database (windows XP platform). I get the following error every time I fill in the connect info for the SYS user:
    INS0009: Unable to connect to the database with user SYS. java.sql.SQLException: ORA-01017: invalid username/password; logon denied
    I can connect to the database (sqlplus sys/<password>@orcl as sysdba) and the OS user is in the ora_dba group. Also checked the database parameters remote_login_passwordfile (= EXCLUSIVE) and O7_DICTIONARY_ACCESSIBILITY=TRUE.
    Does anyone know what the problem is? Any help is appreciated.
    Regards,
    Quinten

    Ok I found the problem myself, I used the wrong sys password :-(. I thought the password I used to logon in sqlplus was right (sqlplus sys/<password>@orcl as sysdba) but the password doesn't matter when you logon as sysdba! So I altered the password for the user sys and now I can continue the steps of the repository assistant.
    Quinten

  • Connecting MS-Access database with Oracle Forms

    Hai,
    Can any one suggest as to how I can connect MS-Access database
    with Oracle Developer Forms. What is the procedure ? Suggest me
    if I need to install any drivers. Waiting for an early reply.
    Warm Regards,
    Raghav.
    email:[email protected]

    Not possible as far as I know.
    Probably because ODBC itself (the defined interface) doesn't support it.
    There is a commercial MS Access (java only) driver that might support it.

  • Need to connect G3 (8.6) with a G5 (10.4.6) via ethernet

    need to connect G3 (8.6) with a G5 (10.4.6) via ethernet.after upgrading G5 from 10.3 to 10.4 ,i lost server connection. to connect to server or browsing for server, G5 cant find G3. manually input of server ip adress of G3 doesn't do it either.apple talk is active and computers are via ethernet connected.anybody can help?!

    I know that this one is already solved, but another solution is to just copy/install the AppleShare Client 3.8.8 to your older equipment that is having trouble connecting to 10.4 servers.

  • Need help connecting to my home Wireless Network

    I need help connecting my LaserJer M1212nf MFP to my home wirless network. I would like to use Apple's AirPrint, and be able to print from my iPad.
    I've spent a few hours following the directions I found on the manuals through hp.com and I've had no luck. I've already unistalled and reinstalled the printer. I've also updated the firmware. If anyone can provide assistance I would greatly appreciate it. Thank you!

    This is NOT a wireless printer (see product spec: http://www.shopping.hp.com/shopping/pdf/ce841a.pdf), you can NOT add the printer to the wireless network. This printer do support LAN connection, so if your wireless router has LAN ports, you can added it to your home network by connecting a network cable from the printer to a LAN port on the router. You need then reinstall the printer as a network printer, to use airprint.
    ======================================================================================
    * I am an HP employee. *
    ** Make it easier for other people to find solutions, by marking my answer with "Accept as Solution" if it solves your issue. **
    ***Click on White “Kudos” STAR to say thanks!***

  • I need help connecting my iPhone and computer together.

    I need help connecting my iPhone to computer

    Howdy sprinklemk,
    Welcome to Apple Support Communities.
    Take a look at the iPhone User Guide, it answers your question about how to connect your iPhone to your computer and provides additional information that you may find helpful.
    http://manuals.info.apple.com/MANUALS/1000/MA1565/en_US/iphone_user_guide.pdf
    You may need to connect iPhone to your computer in order to complete activation. Connecting iPhone to your computer also lets you sync photos and other content to iPhone from your computer, using iTunes. See Sync with iTunes on page 18.
    To use iPhone with your computer, you need:
    An Internet connection for your computer (broadband is recommended)
    A Mac or a PC with a USB 2.0 or 3.0 port, and one of the following operating systems:
       OS X version 10.6.8 or later
       Windows 8, Windows 7, Windows Vista, or Windows XP Home or Professional with Service Pack 3 or later
    Connect iPhone to your computer. Use the Lightning to USB Cable (iPhone 5 or later) or 30-pin the other device.
    Cheers,
    -Jason

  • Do I need to connect the AirPort Extreme with a ethnet cable

    Do I need to connect the AirPort Extreme with a ethnet cable

    Hi Tracy,
    I have an airport express connected by ethernet cable to a Netgear modem which is connected to a phone socket. Those devices stay at one end of the house. I can use my MacBook Pro to connect to the internet (by Wi-Fi, no cables) anywhere else in the house.  I hope this helps.
    Ian.

  • Why do I need to connect my Ipad mini with my Mac Book Pro via iCloud?

    Why do I need to connect my Ipad mini with my Mac Book Pro via iCloud? I don't have iCloud on my MacBook Pro and only intend to use the mini to check e-mail and use Garage Band and Photo Booth for song writing when traveling . . .

    Thanks Community! I solved the problem. In fact it was not a problem but lack of understanding. These guys at Apple are way ahead in thir thinking. I will try to explain as short as I can.
    In Lion, ihe Prefferences/Display show only two choices: 6-7 steps of resolution and some color tab. No two screens, no two display to overlap, nothing for us to do. "That was the problem"! Everything is automatic.
    When I connected the HDMI cable to the Miniport into a T-bolt slot, the TV screen showed the "spiral galaxy" how Zyriab is calling it. In fact he gave me the best clue. That shows the connection is good. But where is the Mac Book image?
    You have to drag it to the right out of the Mac Book display area, and "voila!" it will continue on the TV screen. The same with the mouse pointer, push it out ofthe Mac Book display area and you see it on the TV sreen. Good image, you can keep the max resolution, etc. The sound is still on the Book's speakers. I have to figure that out.
    Thank everybody, especialy Zyriab, ne was the closest.
    High regards to everybody

  • I need to connect my mac air with my mac mini home computer?

    I cannot find out what is needed to connect my mac air with my home computer, a mac mint

    If you have a WiFi network at home, the MBA should easily connect to the Mac mini or vice-versa for anything from file sharing, oprical disc sharing, or even screen sharing. Start in System Preferences > Sharing and turn on the desired services. In that same panel you can choose whether that access is for all users or for specific user accounts on the particular system.
    Then go to the other computer and open Finder then look under "shared" and select the computer you want to share. If you have activated screen sharing as well as file sharing you will actually have logon to both shares using the user account and password for the user you specified on the other machine.

Maybe you are looking for

  • IPad 3 USB cable doesn't fit flush in back...normal?

    I notice when I plug the USB cord into my new iPad 3, it's flush in the front but not in the back. In the back, you can see part of the metal sticking out. Is this normal? Hard to believe Apple would not create a better-fitting cord for the iPad's sl

  • HT201210 how come i cant update my ipod. im trying to update it but it always says error. why?

    why cant i update my ipod? when i try to update it. it always says error. why does it say that?

  • Services error "could not be started"

    The "Right-Click" Services Menu options are giving me an error.  It doesn't matter which Service I choose.  The error I get is this:: "The "New Bean Document Containing Selection" service could not be used."  Or, it could be "Statistics" in the quote

  • Install a package temporarily?

    Sometimes you install a package, because you need it, but never use it again. That way root is growing unnecessarily. So I was thinking: Is there a way to install a package temporarily, so the installation and all additional dependencies are gone whe

  • Siri has left the building

    I have an iPhone 4 which used to have Siri but she's now left the building. There is no Siri tab in the settings under general, I've got all restrictions turned off and I can't find her anywhere. I've tried a soft restart and I've also tried a settin