Problem with database connectivity

Hi guys,
I'm having a problem with database connectivity . I'm using the mySQL database & org.gjt.mm.mysql driver.
I've kept the org folder under the directory where the Database.java program is residing .
My program is as follows:
import java.sql.*;
public class Database
     Connection con;
     public void connect()
          System.out.println("In connect.");
     public Connection connectDB(String username,String password,String database)
          try
               Class.forName("org.gjt.mm.mysql.jdbc.Driver");
               String url="jdbc:mysql:"+database;
               con=DriverManager.getConnection(url,username,password);
          catch(SQLException e)
               System.out.println("SQL Exception caught:"+e);     
          catch(Exception e)
               System.out.println("Exception e caught:"+e);     
          return con;
     public static void main(String args[])
          try
          Connection c;
          Database db=new Database();
          c=db.connectDB("root","","//192.168.0.2/squid");
          System.out.println("Connection created.");
          c.close();
          catch(Exception e)
               System.out.println("Exception caught:"+e);     
It gets compiled but gives the following error when run.
Exception e caught:java.lang.ClassNotFoundException: org.gjt.mm.mysql.jdbc.Driver
Connection created.
Exception caught:java.lang.NullPointerException
I don't know why the class is not found.Pl . help me rectify my mistake.Is there any other path to be set?
Thanks.

You need to run it with the JDBC driver in the classpath
java -classpath .;[mySqlJdbcDriver.jar] Database

Similar Messages

  • Problem with Database Connections in the designer - Catalog not updated

    This is Crystal Reports 2008 (12.2.0290). We have a number of reports that are viewed using the .Net runtime with the connection details set at runtime using ODBC to talk to SQL Server on different systems. This all works fine and is not the problem. The problem is when editing reports in the designer take the following example:
    Developer 1 creates report on their machine that references tables. DSN Name is DEV_DSN, pointing at their local database on their machine called DEV_DB1. Developer 2 needs to edit the report on their machine with a DSN of the same name (DEV_DSN) but this points to a different database on developer 2's machine called DEV_DB2.
    Developer 2 goes to the Set Datasource Location option in the Database menu to get it to point at their local DB only it doesn't work. They click on the first table included  (or the connection name) in the report and click update - they are prompted for the logon details for their local DSN/DB and supply them but they see an error indicating that there is an "Invalid object name" because the table is still being prefixed with the database name from developer 1's machine. When the table is expanded in this view the Catalog still shows as the DB name from developer 1's machine despite the connection properties above correctly showing the local DB name.
    As I say this is a design time issue not a runtime issue.
    Any ideas? Is there any way we can edit the Catalog name manually?

    Try setting the Over ridden qualified Table Name
    Set Datasource - > Tablename -> Properties
    Double click Over ridden qualified Table Name, type name as shown in in the table name field above it.
    Repeat for each table, this removes schema and db names associated with Table. Take a look at the SQL and make sure all tables are no longer prefixed.
    Report should now be totally portable.
    Ian

  • Problem with database connectivity toolkit

    I have problem with Labview database connectivity toolkit. I build and deploy the real_web.vi (attached to the post) to the web server. It seems that the DB Tools Open Connect can not connect to the data base, and it issues the following error:
    NI_Database_API.lvlib:DB Tools Open Connec (String).vi->real_web.vi->real_web.vi.ProxyCallerADO Error: 0x80004005 Exception occured in Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified in NI_Database_API.lvlib:DB Tools Open Connec (String).vi->real_web.vi->real_web.vi.ProxyCaller
    But in highlight execution, I do not get this error! My program connects to the database and read the data. What is wrong ?
    Moreover, when I connect to the vi using the web-browser, the cpu usage of ApplicationWebServer process goes up to 100% (The same problem as stated in this post). 
    Attachments:
    real_web.vi ‏28 KB

    Say what you will about the problems that the DCT can cause (and goodness knows I have) my suspicion is that this is not a toolkit ptoblem. When ever something only works with execution highlighting on, two words should immediately jump to mind: "race" "condition".
    Execution highlighting will muck aound with the order in which things get done in your code. Can you post what your code looks like?
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Processes 'stuck' after problems with database connection

    First in the production environment, during database failover (MSSQL Server cluster), and later in testing, we encountered processes that are 'stuck' on some random operation. Admin console doesn't show stalled operation or branches, process is running, all operations are completed except last which was in several cases still in status Running, and in one case it was Completed but next operation was not started.
    When operation is still running one would expect to select it and click 'Retry' in hope that process will continue but it seems there exist a bug in "Process Instance Detail" part of the admin console - it gives an error: "This operation cannot be completed without the selection of one or more operations from the list below!"
    We can try using 'Terminate' for this operation and probably several that follow (because they would probably stall without data from first terminated operation) in hope that process which runs in big user loop can arrive at a step where it can recover from all this using existing data but it's messy and doesn't always work.
    When the operation is in status Completed admin cannot do anything at all. This completed operation cannot be retried or terminated because selection box is grayed out. Process and data in it is irrecoverably lost and must be initiated from start.
    I must say we had large problems before if database connection is lost even for few seconds (intentional fail over from one db node to another) - but now, when we filled check-connection-sql in datasource configuration Livecycle is behaving a lot better but still with above problems.
    How can it happen that LC stops executing process workflow and stops on some operation just because it wasn't able to get valid db connection for several seconds? Is it some problem with transactions or what? What can I do? Where to look?
    We are still on LC ES2 SP3. JBoss on Windows Server 2003 and MSSQL 2005.
    Any help is appreciated.

    I would suggest you to contact the Adobe support so they can look further in system as well as LC database.

  • Problem with database connection in Jdev 11

    Hello,
    my jdev version is 11 and i want do really simple task create new database connection to my oracle db.
    I open database navigator and click new connection. i want jdbc connection but after i fill this form i pressed test connection button and get this error msg:
    Test failed: 4
    i think i have correct information but i tried this, i opened my older jdev 10 and copy jdbc url from my old db connection.
    In jdev 11 i checked Enter Custom JDBS Url and pasted url from jdev 10 and i get:
    Test failed: 4
    What is wrong?
    Thanks for your advice.
    J.

    I add new information:
    i cant connect to oracle db 8, but i try another db in my company which is 10 and its working fine.
    I write java class and try connect to db 8 via jdbc manually:
    String url = "jdbc:oracle:thin:@SERVER:1525:SID";
    String user = "user1";
    String password = "aaa";
    Class.forName("oracle.jdbc.driver.OracleDriver");
    // DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection(url, user, password);
    and i get this:
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4
         at oracle.jdbc.driver.T4C8TTIdty.marshal(T4C8TTIdty.java:468)
         at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:339)
         at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:621)
         at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:203)
         at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:34)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:501)
         at java.sql.DriverManager.getConnection(DriverManager.java:525)
         at java.sql.DriverManager.getConnection(DriverManager.java:171)
         at project1.Class1.main(Class1.java:31)
    i hope this will be more usefull and i know i write this info about db's version little bit late.
    J.

  • Problems with Database connection from a servlet

    Hi everybody:
    I got the following message:
    java.lang.ClassNotFoundException: weblogic/jdbc/oci/Driver
    when I try to connect to a Database.
    public Connection getConnection()
    Connection con = null;
    Driver myDriver = null;
    try
    Properties props = new Properties();
    props.put("user", "fangc");
    props.put("password", "fangc");
    myDriver = (Driver) Class.forName("weblogic.jdbc.oci.Driver").newInstance();
    con = myDriver.connect("jdbc:weblogic:oracle:occd01", props);
    catch(Exception e)
    System.out.println("Connection failed! - " e);
    finally
    return con;
    What am I doing wrong? I try the code without problem for a simple Java Client

    Cristina Fang wrote:
    >
    Hi everybody:
    I got the following message:
    java.lang.ClassNotFoundException: weblogic/jdbc/oci/DriverYou won't get that unless your code has:
    myDriver = (Driver) Class.forName("weblogic/jdbc/oci/Driver").newInstance();
    Make sure your servlet code is just like the right way that you have it
    below:
    myDriver = (Driver) Class.forName("weblogic.jdbc.oci.Driver").newInstance();
    Joe
    >
    when I try to connect to a Database.
    public Connection getConnection()
    Connection con = null;
    Driver myDriver = null;
    try
    Properties props = new Properties();
    props.put("user", "fangc");
    props.put("password", "fangc");
    myDriver = (Driver) Class.forName("weblogic.jdbc.oci.Driver").newInstance();
    con = myDriver.connect("jdbc:weblogic:oracle:occd01", props);
    catch(Exception e)
    System.out.println("Connection failed! - " e);
    finally
    return con;
    What am I doing wrong? I try the code without problem for a simple Java Client

  • Can any body identify my problem with database connection?

    My connection statement looks like this
    Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);
    DriverManager.getConnection("jdbc:odbc:ram");
    Iam using jdk1.3 and oracle 9i client edition.
    The exception is .......
    java.sql.sqlexception: No suitable driver.
    The interesting thing is, with the same above connection statement , i am able to connect my core java program with oracle. But not with J2ee application.
    Can anybody resolve my prob?

    This is the thread where Guhan asked the same question:
    http://forum.java.sun.com/thread.jspa?threadID=5209455&tstart=50
    He's a classmate of the OP.
    If anyone thinks they can improve on this mess, please be my guest.
    %

  • Strange problem with Database LInk

    Hi Everyone,
    I have strange problem with Database Link in Oracle 11g Express Edition;
    There are two computers: computer-server and computer-client. Tnsnames.ora are the same on both computers ie.
    CT =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = krzysztof)(PORT = 1521))
    (CONNECT_DATA = (SERVICE_NAME = XE)
    I created database link :
    Create database link zdalny
    Connect to <user_id> identified by <password>
    using ‘CT’;
    Client can’t connect with server when I am using above command. But when I change “using” for using ‘krzysztof:1521’ or using ‘krzysztof’ or using ‘server IP:1521’ – everything is ok.
    Why I am asking. Because in all materials which I am reading about Oracle command with using ‘CT’ should be working correct. But there is not. Do you know, why?
    Thanks in advance and apologize for my English.
    Rgds
    Krzysztof

    Krzysztof Szymaniak wrote:
    Thanks for all replies.
    Below is server's tnsnames.ora
    CT =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = krzysztof)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = XE)
    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    (CONNECT_DATA =
    (SID = PLSExtProc)
    (PRESENTATION = RO)
    ORACLR_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    (CONNECT_DATA =
    (SID = CLRExtProc)
    (PRESENTATION = RO)
    SQL Error: ORA-12154: TNS:could not resolve the connect identifier specified
    12154. 00000 - "TNS:could not resolve the connect identifier specifie
    Rgds
    Krzysztof
    PS. I tried with using 'XE' - not working.Assuming that is the correct tnsnames, of course XE is not working. You don't have a tnsnames entry for 'XE'.
    You need to be aware that when using a dblink, the client is the db in which the link is defined, not the desktop from which you connect to that database.
    I think you need to start here:
    http://edstevensdba.wordpress.com/2011/02/26/ora-12154tns-03505/
    http://edstevensdba.wordpress.com/2011/02/09/sqlnet_overview/ (Help! I can’t connect to my database )
    http://edstevensdba.wordpress.com/2011/02/16/sqlnet_client_cfg/ (Help! I can’t connect to my database (part duex) )
    The fact that your client (db link) is a database doesn't change anything taught in the above.

  • Problem with dropped connections...

    Hi,
    I'm having a problem with dropped connections. Let me explain...
    I have a computer with Windows XP SP3 where I have installed Toad, PuTTY and Oracle 10g client. I need to connect to several database and Linux hosts and have a strange problem. What happens is the following:
    1 - When I arrive at a customer location, I boot up my computer (I'm not using hibernate or standby) and plug-in to the network.
    2 - After I login to Windows, every session in PuTTY (to Linux), SQL*Plus or Toad (to database) gets dropped after only a few seconds.
    3 - I reboot my computer again, and everything works fine.
    I have no explanation for this beahavior. This happens across different customers, database versions and Linux OS kernels and versions. It seems to be related to something in my computer that is fixed on the 2nd restart.
    Has anybody experienced any similar problem?
    Thank you!

    pmcatarino wrote:
    I plug directly at client's site.
    And I can access the web and messaging on the first reboot... the only thing that appears to be malfunctioning is putty and toad as I stated above.
    Edited by: pmcatarino on Oct 24, 2008 6:25 PMDoes that mean you can ping to the server without problem when putty and toad having problem?
    If you install an Oracle client on your machine and configure TNS, will the sqlplus drop as well? Or download and install SQL Developer, see if SQL Developer having any problem connect.

  • Problem with JCo Connection Pool

    Hi,
    I have a problem with using an RFC Model in my WebApplication. So sometimes the access to the function block works, and sometimes it doesn't work. Now I know, that there is a problem with the connection pool. Look at this message:
    com.sap.mw.jco.JCO$Exception: (106) JCO_ERROR_RESOURCE: Connection pool WD_X24_MODELDATA_DEST_CPIC_REKTO_DE_useDefinedUser is exhausted. The current pool size limit (max connections) is 10 connections.
    So it looks like a problem with closing the JCo Connections after using. Do know where the problem is? Because I'm using many other function blocks with no problems.

    Hello,
    You need to increase the pool size via Visual Administrator.
    Server 0 -> Services -> JCO RFC Connections.
    Change the pool size from there. I believe a restart is in order.
    Regards,
    Jan

  • Problems with ipod connection.

    Problems with ipod connection.
    I have problems to connect my ipod to computer windows 7.
    When I connect I get the following error:
    "We encountered an ipod, but could not be identified correctly. Disconnect and reconnect the ipod and try again."
    And it recognizes the ipod when trying to go play music or videos make me the following error:
    "Error while trying to copy on disk. The device is not connected."
    I've uninstalled all apple applications and re-installing, as I formatted the ipod and continues to set the same error.
    What else can I do?

    Hello,
    While your symptoms don't exactly match the descriotion, this article may be usefull in discovering if there is a setting on your computer that is causing this to happen.
    iPod not recognized in 'My Computer' and in iTunes for Windows
    http://support.apple.com/kb/ts1369
    -Griff W.

  • Every time I try and update my iphone 4 to ios 7.1 in iTunes 11.1.5 it says "connection reset" even when there is no problem with my connection

    I have an iPhone 4. I use iTunes 11.1.5 on my Mac. I am trying to update to ios 7.1 through iTunes, but every time I do that, I get a "connection reset" error, even when I know there has been no problem with my connection.
    The exact error message is as follows:
    "There was a problem downloading the software for the iPhone "Anne's iPhone". The network connection was reset.
    Make sure your network settings are correct and your network connection is active, or try again later."
    I have checked several times. There is no problem with the connection, and I have tried to download the software several times today.
    Any help you can give me would be appreciated.

    Just managed to successfully download the update, having retried five or six times. I did unplug my phone while the download was taking place (had asked iTunes to download only, not to update) -- suspect this had no bearing on it whatsoever, and that persistence is the only way here.

  • Problem with database schema objects in the entity object wizard

    Hi All,
    When creating a new entity object, I am facing a problem with database schema objects in the entity object wizard, database schema objects (check boxes for tables,synonyms...) are disabled. Actually I am using a synonym but I am not able to select the synonym check box.
    Can any of you folks tell me how to enable the database schema objects (check boxes for tables,synonyms...).
    Thanks in Advance.
    Raja.M

    Make sure your using rite version of jdeveloper..
    Make sure your using apps schema and check whether your able perform DML operations in the schema vis sql developer.
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                           

  • Exchange Server 2010 SP3 - Rollup 8 - Issue - Problems with client connections - MS Outlook 2013

    Exchange Server 2010 SP3 - Rollup 8 - Issue - Problems with client connections - MS Outlook 2013
    Detected Problems:
    - Access denied for attached mailbox (department mailbox)
    - Access denied for delete or move messages on own mailbox
    - Can't send new messages with error (Error: [0x80004005-00000000-00000000])
    Solution:
    - Rollback to Exchange 2010 SP3 - Rollup 7
    - You can rollback to Exchange 2010 SP3 - RollUp 7 in 30 min
    Algunos de los destinatarios no recibieron su mensaje.
    Asunto:     Hola
    Enviado el: 11/12/2014 8:35
    No se puede localizar a los destinatarios siguientes:
    '[email protected]' en 11/12/2014 8:35
    Este mensaje no se pudo enviar. Inténtelo de nuevo más tarde, o póngase en contacto con el administrador de red. 
    Error: [0x80004005-00000000-00000000].

    See the following forum thread: 
    https://social.technet.microsoft.com/Forums/en-US/1be9b816-b0ab-40ea-a43a-446239f8eae3/outlook-client-issues-following-exchange-2010-rollup-8

  • My station is listed on Itunes Radio stations, but there's a problem with the connection. Does any body help us regarding this issue? The station name is KRAL FM under the Top 40 / Pop category

    My station is listed on Itunes Radio stations, but there's a problem with the connection. Does any body help us regarding this issue? The station name is KRAL FM under the Top 40 / Pop category

    My station is listed on Itunes Radio stations, but there's a problem with the connection. Does any body help us regarding this issue? The station name is KRAL FM under the Top 40 / Pop category

Maybe you are looking for

  • Matrix report not printing report totals

    I've created a 'Matrix with Group' report using the wizard that works great. It prints the sub-totals for each product at the end of each group, but won't print a grand total for each product at the end of the report - just displays a grand total for

  • Error 1638 - iPhone software update server can not be contacted.

    Hi, I can't update my iPhone iOS to 4.3.3 with iTunes since a few months i still have the 4.3 version. I am using iTunes with an iMac with all software updated. I am getting the error "iPhone software update server can not be contacted..." I made a f

  • Count number of times an instructor has taught a class

    Howdy Folks, I'm using a lifeline to see if i can get some help for a question. I apologoze in advance, i know this is a numbers forum, but i am working with an excel spreadsheet and was hopng someone could give me a push in the right direction. i wa

  • List of PURCHASE Requisitions..?

    Hi guru's Can anybody explain me , how to get 1.List of pending PR for release (Only pending list). 2.List of pending for create PO (Released , pending for Create PO). Thanks sap-mm

  • Users getting upgrade prompt with SilentAutoUpdateEnable=1 set

    We've been deploying Flash Player  11.6.602.180 to our desktops recently, along with this mms.cfg: AutoUpdateDisable=0 SilentAutoUpdateEnable=1 SilentAutoUpdateServerDomain=(internal server) Users are getting propted to upgrade via the red Adobe box.