Derby making connection

hello,
I need to have a JDBC connection with derby.
I use this code:
            // define the driver to use             String driver = "org.apache.derby.jdbc.EmbeddedDriver";             // the database name             String dbName="deliverDB";             // define the Derby connection URL to use             DeliverFileManager deliverFileManager = new DeliverFileManager();             boolean oldDB = deliverFileManager.deliverExist("\\" + dbName);             String connectionURL;             if (oldDB == true)                 connectionURL = "jdbc:derby:" + dbName; // + ";create=false";             else                 // jdbc:derby:support/bugsdb;create=true                 connectionURL = "jdbc:derby:" + dbName  + ";create=true";                         try {                 //  Load the Derby driver.                 //  when the embedded Driver is used this action start the Derby engine.  // V.I.                 //  Catch an error and suggest a CLASSPATH problem                 Class.forName(driver);                 System.out.println(driver + " loaded. ");             } catch(java.lang.ClassNotFoundException e)    {                 System.err.print("ClassNotFoundException: ");                 System.err.println(e.getMessage());                 System.out.println("\n    >>> Please check your CLASSPATH variable  <<<\n");             }                         //  Beginning of Primary DB access section ...BOOT DATABASE             try {                 dbconn = DriverManager.getConnection(connectionURL);  // V.I. too                 System.out.println("Connected to database " + dbName);             } catch (SQLException ex) {                 JOptionPane.showMessageDialog(null, ex.getMessage());                             } catch ( Exception excp ) {              // process remaining Exceptions here                 excp.printStackTrace();             }          
the connection fail when the line
Class.forName(driver);
it is executed.
The mistake come for the CLASSPATH, and I tried to set it in the control
panel but am not able to set it good for my purpose...
How it is possible to indicate the CLASSPATH, looking for to the future problem of install the program
in other computers too ?
In this moment the program it is run in the IDE of NetBeans 6.1.
thank you
regards
tonyMrsangelo

ViKARLL wrote:
Hi Tony,
Have you found a solution ? The Following worked for me.
1) Copy and past derby.jar to your <your drive>\Program Files\Java\jdk <your version>\jre\lib\ext folder.
For me it was on Widows XP;
C:\Program Files\Java\jdk1.6.0_06\jre\lib\ext\derby.jar;2) Set the CLASSPATH in your environmental Variable as you did earlier, but this time point to the above location.
Hope this helps.
ViKARLLWrong approach. Don't do that. If you upgrade JDK after one month, your applications won't work anymore.
Just specify the path to the JAR file in the -classpath (or -cp) parameter of java.exe. To shorten the command you have to enter everytime, write a .bat file with the complete command (or a .sh file in case of *NIX).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Error while making connection with remote oracle database

    Dear,
    I am trying to make connection with oracle database but when i run java file it's raise an error "classnotfoundexception oracle.jdbc.driver.oracledriver"
    DriverManager.getConnection(
      "jdbc:oracle:thin:@erp:1521:ORCL", "apps",
      "apps");
    Pls any body have idea.
    Thanks.

    Thanks for support.
    Below is error which i am getting while making connection with remote database.
    C:\Program Files\Java\jdk1.7.0_05\bin>java OracleJDBC
    -------- Oracle JDBC Connection Testing ------
    Where is your Oracle JDBC Driver?
    java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
            at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:186)
            at OracleJDBC.main(OracleJDBC.java:13)
    Advice.

  • Mach_kernel making connections to random ip?

    Hi guys,
    I hope someone can give me some explanation. I bought first gen macbook, install little snitch and leave it on 24/7. Later, I enabled remote login and remote management function in case it's stolen.
    Then, I just found out from litte snitch that /mach_kernel making connection to some random ip's. I was afraid because remote management was enabled, so I disabled it and still little snitch found it access random ip. Is this a normal behaviour? or someone/automated program just brute forced my mac? and what is weird is little snitch do not ask me whether to block it or not. I'm not sure either whether this connection from outside into my mac or from my mac to outside. anyway i took a screenshot of it.
    http://www.flickr.com/photos/insaturday/2620995356/

    Those connections from the kernel are caused by bittorrent connections. They are nothing to worry about if you are running torrent connections and in your screenshot you have Transmission running so that is the explanation.

  • HT1476 i plug in my phone to the  charger and i tried with two different cables, and it seems like it is not making connection to the clable?

    i plug in my phone to the  charger and i tried with two different cables, and it seems like it is not making connection to the clable. but it is not charging. what are some possible ways o fix that?

    When you plug in your charger and attach it to the MBP, initially the light will turn green.  If the MBP needs charging, a few seconds later the light will turn amber.  That is normal.  If your symptoms are different, then they may or may not be a problem.
    Ciao.

  • Retreive External data from SQL making connection to SQL server take a long time

    I have an Excel pivottable based on a view from SQL server. The view gets data from 2 databases on the sames server. I have the sames login for both databases and also the same rights (datareader, datawriter and owner). When running the view from within
    the SQL Server management tool it goes quick. In Excel once the connection is made everything goes fast. Only making the connection takes a very long time. When I use a view with data from a single database then everything is fine and goes fast.
    Example of the situation: I use the example view below in an excel pivot. This gives as result that the connection takes very long.
    SQLServer A
    View CustomerInfo which contains the following query.
    Select * FROM databaseA.dbo.Customers as Customers
    CROSS APPLY
    SELECT *
    FROM databaseB.dbo.Contacts as Contacts
    Where Customers.Number = Contacts.CustomerNumber
    ) AS Contactdata
    When I remove the CROSS APPLY part, the connection is made directly
    We login to SQL with normal logon  (not windows security) The user has the same rights on both databases.
    I hope the problem is clear. Does anyone have an idea of how I can solve this problem?

    -1* ( prior dataid ) = parentid
    is it multiplying -1 times the prior dataid ?that's exactly what it's doing
    you need:
    prior dataid = ABS(parentid);
    not knowing you're data, and therefore assuming that dataid is always positive (since it doesn't have an ABS), and that parentid can be positive or negative, your criteria becomes
    parentid = prior dataid (handles both are positive)
    or parentid = negative of prior dataid (handles parentid is neg, dataid is pos)
    since the "prior" must be right next to the column (dataid), I put parens around the whole thing, and then mult by -1

  • Retry making connection

    Hi all, I have to make a connection through TCP/IP to a device to read some values. But when the machine where the device is installed on has no power supply, my device also has no power suply and the connection will fail. Now i had the idea to retry to make a connection every couple of minutes when an error is detected. In this case the program does not stop running an will connect automaticly when there is a possibility to connect. How can i solve this or are there any other suggestions for the problem?
    Best Regards
    Stefvg
    Solved!
    Go to Solution.

    Hi, I've implemented the Subvi in my vi and everything works just fine. But i am using some while loops and sequence structures in my program. Is it possible to add a button (or buttons) to abort an action and stop the entire program. An example: when i am trying to make a connection i am in the subvi until a connection is made or i push the emergency stop button. Now i actually want to stop making a connection when pushed at a button whitout stopping the whole program (with the emergency button). Or i want a button that stops the program no matter in which loop the program is in. Is this possible or not? I've added my program in attatchment.
    Best Regards
    Stefvg
    Attachments:
    oplossing2.vi ‏70 KB

  • Help on Livecycle/DSN...API or some type of Active X solution to help making connection

    I have a solution that I'm trying to come up with.
    LiveCycle is a relatively handy tool for automating input from ODBC data
    sources to download to forms
    What we would like to do is automate the process of setting up the DSN used
    by LiveCycle and automate the process of making the connection to that DSN
    to populate the fields in the forms. Automating the DSN setup is done. But
    what I'm looking for is an API or some type of Active X solution to help
    with making the connection, populating the forms using LiveCycle and
    printing the PDF output file. Can you help me with this?
    Currently I'm using LiveCycle Designer 8.0 as part of the Adobe Acrobat
    suite. Can I use this, or do I need to look at a different software package?
    Thank you for any assistance you can provide me with.

    Hiho Ashley,
    Iam sorry that I can´t answer your question about the Active-X-Stuff and I truely doubt, that you will look in this thread again. But Iam interested in your solution for automated build of an DSN. Is it within the PDF-File, so not every user wanting the the PDF to be filled have to settle up an extra connection? And does it work, if the user has no permission to make a DSN on his own?
    Hope, someone can reply
    Greetings

  • FACETIME freezing up on IPAD shortly after making connectivity?

    I've restored the IPAD....shortly after FACETIME did work..approx for 1 hour - no problem.  Then another night....connected with individual and after a moment or so, screen froze...no sound...all I see is a frozen picture of individual.  Tried to reconnect...get error...person on Facetime Not Available.  Tried numerous times - gave up.  Next day, I d retored IPAD once again.  Note:  Have not problem accessing internet.  Tried making contact, okay for a moment...froze once again.  Tried contacting, Factime Not Available with that individual.  All connections are fine with wifi/router/modem..again, no problem linking with internet.  What gives with this?

    Dear Rob,
    I am having exactly the same problem as you with Facetime. Facetime would, in the middle of the conversation, simply quit. And I would have to restart the Ipad 2 to make it work again.
    Safari would do that from time to time as well (but less frequently)

  • IPod headphone-jack no longer making connection

    The headphone-jack connection is worn-out. I've tried using 3 different headphones with the same male specifications and music was still audible from the iPod and not through any of the headphones. Thus, I am sure that the iPod headphone-jack is malfunctioning. It was purchased about a year ago, but it only has a one year warranty and I no longer have the receipt.
    Any suggestions? It would be much appreciated.

    jenrss wrote:
    The headphone-jack connection is worn-out. I've tried using 3 different headphones with the same male specifications and music was still audible from the iPod and not through any of the headphones. Thus, I am sure that the iPod headphone-jack is malfunctioning. It was purchased about a year ago, but it only has a one year warranty and I no longer have the receipt.
    Any suggestions? It would be much appreciated.
    The earphones must be pushed very hard into the iPod. So hard, that the white part of the plug must touch the iPod in order for the external speakers to turn off. You will hear a click.
    If you do a forum search, you will find this same solution. If it does not work, you will need to take your iPod to an apple store or call the Apple iPod tech support if still under warranty or you have Apple Care.  You may have a hardware problem.

  • Making connect against SID high available

    Hi Forum,
    is there any way to make applications that use host/port/SID to connect to the database high available? The background of my question is that we have a legacy application that does not support to connect via servicename to our RAC database. The configuration dialog has no options to use a servicename, you can just enter host/port/sid.
    Now is there anyway to trick this application so that the sid/host can be failed over? The host could be tricked via virtual IP that could be provided by the grid infrastructure, but what about the SID? Is there some kind of "virtual SID" out there?
    Thanks in advance
    Thomas

    Hi,
    If you are lucky, you may be able to trick the application in giving a whole (DESCRIPTION........) tnsnames entry as the host and not using the "port" and "sid" entry in that masks.
    As a normal SQLNET/JDBC client will understand
    @(DESCRIPTION = (ADDRESS = ...))
    equally as
    @host:port:sid
    this could work. If it does then you got no problems, because you can specify the services there with all failover stuff.
    If this does not work, maybe 11gR2 server pools can help you. It will not provide you a load balancing though, just HA.
    With 11gR2 server pools/policy managed, the database SID is not fixed on a server, but will failover to other nodes.
    So lets assume you have 3 servers, and your policy managed database is running on node 1 and 2.
    Furthermore assume, that the policy for the database is minimum 2 servers and maximum 2 servers.
    In this constellation instance on node 1 will be DBNAME_1 and on node 2 DBNAME_2.
    If first server fails, the DBNAME_1 instance will automatically be started on the free node (server 3), and your clients would still be able to connect to the SID.
    The tricky part now is to manage that the additional VIP and listener you created are failing over to server 3 as well and not to server 2.
    But with a correct settings in the clusterware for the newly created VIP that should be addressable (look at the clusterware administration guide Chapter 5).
    Hope that helps
    Sebastian

  • How to disable confirmation dialog when making connection??

    Hi,
    I am trying to use the BT interface on the cell phone to connect with another BT device. However, when the connect.open() fuction is called, a dialog asking for confirmation of the connection will show up. Is there any way I can eliminate the dialog and just establish the BT connection when another device directly when the connect.open() method is called??

    Hi,
    >>however I do not want to see the confirmation message each time data is submitted,  because my loop is paused each time the confirmation message appears, and the only way to resume it, is to click "ok". 
    Sorry, disabling the confirmation message is not possible.  The confirmation is always enabled.
    Thanks,
    Lucia

  • Cisco RV016 making connections drop

    Hi,
    My cisco rv016 is currently set to load balance 2 lines and soon 3.
    However some connections that are active here are with servers and FTP clients.
    With load balancing active it appears that people are getting their sessions timed out rather frequently.
    MySQL database connections
    SSH connections
    FTP, SFTP connections are the ones that spring to mine straight away.
    Any advice?
    Thanks

    Right now I'm testing on a single access point (autonomous) with WEP! The same laptop works fine without the Cisco client. Usually it is several hours, 12 or more when it happens, but I've seen it less than that. And I've seen it up for over a day and a half. At this point I just don't trust the client to roll out to a larger audience.

  • Error when making connection:  You have an error in your SQL syntax;

    I'm getting this error when trying to make a simple Database Connection:
    SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '????????????????????????????????' at line 1
    SQLState: 42000
    VendorError: 1064
    I tried a different driver and got the same error with more "?"s in the "use near....." part.
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class DBTest{         public static void main(String[] args){                 try{                         Class.forName("com.mysql.jdbc.Driver").newInstance();                 } catch(Exception e){                         System.out.println(e);                         System.exit(0);                 }                 Connection conn = null;                 try {                         conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/testDB?" + "user=root&password=password");                         conn.close();                 } catch (SQLException ex) {                         // handle any errors                         System.out.println("SQLException: " + ex.getMessage());                         System.out.println("SQLState: " + ex.getSQLState());                         System.out.println("VendorError: " + ex.getErrorCode());                 }         } }
    MySQL Server Version:
    Server version: 5.0.67-0ubuntu6 (Ubuntu)

    cotton.m wrote:
    c0c0 wrote:
    I've tried Drivers 5.1 , 5.0 and 3.1 now and I get the same problem every time. I've tried switching databases, users, etc but always get this same error:
    java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '????????????????' at line 1
    I have the latest version of mysql from the Ubuntu repositories. Do I have to configure that a certain way? It isn't the URL which I supply that it does not like because I've tried multiple URLs and they all give me the same error when I supply the correct information.
    Any help is greatly appreciated.This is.. very odd.
    I have to ask are you really, really sure that your code is just as you posted? Are you sure you aren't running a query of some sort? My guess at this point would be some sort of rather bizarre encoding issue. I'm sorry but I can't reproduce your behaviour, I am connecting to different MySQL instances with no problem from Ubuntu..
    Yes the code is exactly the same as what I posted (except hiding actual usernames and passwords)
    I've even tried to connect to a remote mysql server and get the same behavior (If I type in the wrong database it alerts me there is no db of that name, if I lg in with the wrong password it alerts me cant login ____ @ ______, when I have all the correct information I get that same old error) , I'm somewhat convinced it's my driver now. I thought at first it was the way I had mysql configured but now I think it's my driver or the way I have everything installed. I simply put the driver location in the classpath and do the command:
    export set CLASSPATH=/usr/share/tomcat5.5-webapps/ROOT/lib/mysql-connector-java-5.1.7-bin.jar
    Was this the wrong way to go about doing it? I'm not currently running tomcat I simply put it there because a book said that's where it should go for tomcat, but I wanted to first try this not running tomcat with just a simple normal Java example.

  • Making connection to Oracle 9i via SQL Plus - Mark

    Hi,
    I am unable to connect to oracle 9i via dos prompt or SQL Plus.
    I installed the satabase on windows.
    The SID is obiwan. Please help, already browsed similar topics and its not happening.
    Thanks in advance.

    The Listener is the process that is listening for incoming remote connections to the DB(s).
    Database and Listener have Windows services, and services have to be started. Also, from DOS prompt you can do :
    C:\> lsnrctl stat
    to see if the Listener is active : the result should be the list of active DB(s).
    To connect locally to the DB do the following :
    C:\> set ORACLE_SID=obiwan
    C:\> sqlplus "/ as sysdba"
    The result should be something like SQL*Plus: Release 9.2.0.4.0 - Production on Dom Apr 10 16:58:32 2005
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.4.0 - Production
    SQL>If the result is something like : SQL*Plus: Release 9.2.0.4.0 - Production on Dom Apr 10 17:01:29 2005
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to an idle instance.
    SQL>                                                                          then it means that the DB is not up. In this case try :
    SQL> startup
    That way you are connected as sysdba, you can startup and shutdown the DB, create users, and so on. Do not use this connection to create objects (tables, indexes and so on) :
    create an user, using the command "create user" (See [url http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/toc.htm]Sql documentation), and connect as that user, for example
    SQL> conn scott/tiger
    or, at DOS prompt
    C:\> sqlplus scott/tiger
    If you create a TNS alias, as I said before, you can use that as connection string from DOS prompt
    C:\> sqlplus scott/tiger@<TNS alias>
    or using SqlPlus in the Oracle menu.

  • Making connection

    I want to integrate my webshop in my website. I would like that a click on the page connects directly to the url of the shop.
    I can make connections by using text (like " click here") or an image on the page, but that's not the way.
    I can't get it done so far as I can not activate the button.
    Someone can help me out?
    Thanks,
    Aart

    I just want clicking on the blanco page to activate a hyperlink to an external page.
    Do you want to have a visitor blick on a blank page and go to another page?  Sounds like a redirect?
    There are two ways to do that.
    1 - put a transparent shape on the blank page and size it to cover the entire page. Hyperlink that shape.
    2 - add an HTML snippet on the blank page with the following code in it:
    <script type="text/javascript">
    parent.window.location = "URL TO PAGE YOU WANT TO REDIRECT TO"; </script>
    When the visitor lands on the blank page they will automatically be sent to the page you linked to. Is this what you're trying to do?

Maybe you are looking for

  • IMessage Words Underlined

    This morning I wanted to send a text to my brother (who has an Android).  I typed in my message and pressed send.  The "sent" message came up in its green balloon, but should some of the words underlined!  But they weren't underlined when I typed the

  • Synchronization error

    Hi I'm trying to synchronize some music from iTunes, but I get an error: "BlackBerry Desktop Software received an error whilst transferring media.  Check your device and try again" The device is connected, as I can browse to it. Any thoughts.  I only

  • Budget not working

    Hi All, I have set block for the budget deviation. I have set budget for PO , GRPO, and Accounting. selected the radio button of monthly budget. I have set the 12000 as budget amount for G L NO EX1111. So per month budget amount is Rs.1000. For the f

  • PreCompilation of JSP in Weblogic

    i am using Weblogic 8.0. i wanna write ant script for precompilation of JSP. Could anybody provide the build.xml           Thanks in advance.

  • Set margin of in the page setup

    hai everybody i have a problem to set the margin of a table in the spreadsheet. can any one give me an idea on how to set the margin in the page setup...