Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 10 of 10

Thread: Database connection without using netbease

  1. #1
    Junior Member
    Join Date
    Nov 2008
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Database connection without using netbease

    Dear sir,
    I have developed library managment system using netbeans 6.5 and javaDB
    The name of my project in netbeans is "LibMan".
    So a file LibMan.jar is created.
    That file I can run externally without using netbeans but my problem is that i can't update my database without use of netbeans i.e. i have to start netbeans and go to servies window and right click and connect database and than I can update my database.

    Can you please tell me how to update database without using the following process:

    " i have to start netbeans and go to servies window and right click and connect database and than can I connect to database."

    regards
    gaurav khatwani


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: regarding project

    Hello haygaurav,

    It sounds like the JDBC driver classpath is missing from your manifest file.

    Are any errors displayed when you try to connect to the Database?

    You need to set the correct classpath to your JDBC driver before you create the jar file.

    I think you also need to add the JDBC driver into the jar.

    That way, when you execute, your application will know exactly where to look for the required driver.

    These links will help you continue:

    Adding Classes to the JAR File's Classpath (The Java™ Tutorials > Deployment > Packaging Programs in JAR Files)

    Using Java DB in Desktop Applications


    Working with Java DB is easy and fun. Java DB makes it possible to create and distribute an embedded database with minimal effort. Just remember a few tips to make your work with Java DB successful:
    1. Place the derby.jar file in your development environment's classpath so that your Java technology compiler and runtime environment can find the libraries to compile and run the application.
    2. Set the derby.system.home system property to tell Java DB where to find your database. You can set this property programmatically or on the command line.
    3. Create a build process that places the derby.jar file in a lib subdirectory immediately below your application's own directory.
    4. Add derby.jar to the application classpath by including a Class-Path property in your application JAR's manifest file.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  3. #3
    Junior Member
    Join Date
    Nov 2008
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: regarding project

    Dear sir,
    I am totally confused.
    Please spoon feed me in this process.
    regards
    gaurav khatwani

  4. #4
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: regarding project

    OK well unfortunately I have no experience with JavaDB so I will guide you through roughly what I think you need to do.

    How are you creating your jar file? If you look inside your jar you will find the manifest file. You need to edit this and add the class path to derby.jar which im assuming is the JavaDB JDBC driver.

    Add this line to your manifest:

    Class-Path: [I]derby.jar[/I]

    or

    Class-Path: directory-name/[I]derby.jar[/I]

    Locate derby.jar on your computer and add this into your jar file so it corresponds with the class path you added to the manifest.

    If you are creating your .jar in netbeans they you may need to look into how to create a jar file from scratch.

    Take another look at the links above. These explain the same things Im saying her but in a bit more detail. I don't know how I would make this any simpler...
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  5. #5
    Junior Member
    Join Date
    Nov 2008
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: regarding project

    Dear sir,
    My libman.jar file is constructed through netbeans
    And I have seen the contents of libman.jar file

    using command
    jar tf libman.jar

    There is no manifest.txt file in the libman.jar

    So ,please tell me what is the next step

    regards
    gaurav khatwani

  6. #6
    Junior Member
    Join Date
    Nov 2008
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: regarding project

    Dear sir,
    Please help me.
    Ok, i m sending my project files u please deploy it for me and send it to me again
    thanks and regards
    gaurav khatwani

  7. #7
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: regarding project

    Quote Originally Posted by haygaurav View Post
    Dear sir,
    My libman.jar file is constructed through netbeans
    And I have seen the contents of libman.jar file

    using command
    jar tf libman.jar

    There is no manifest.txt file in the libman.jar

    So ,please tell me what is the next step

    regards
    gaurav khatwani
    Hmm.. Something doesn't sound right to me. There needs to be a manifest file in the jar for it to run correctly. Or atleast that is what I thought..

    Yes please upload or send me the project files and I will take a look for you friend.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  8. #8
    Junior Member
    Join Date
    Nov 2008
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: regarding project

    Dear sir,
    I have e-mailed my project files on the e-mail ID: **Email removed by admin for security reasons**
    The file manifest.mf is in the libman.jar
    When i try to update that file the file gets updated but i recieve the the warning message.
    After that i tried to run that file still i can't interact with database without using netbeans
    Please remember i my trying to get same results when i run my project without using netbeans and when i run my project using netbeans

    You please deploy it, and send it to me again at e-mail: **Email removed by admin for security reasons**
    regards
    gaurav khatwani

  9. #9
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: regarding project

    haygaurav, I will PM you my contact details.

    It is not wise to list email addresses in forums because they get picked up by spam bots. The last thing we both need is more spam in our inboxes!!

    Please check your Private Messages
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  10. #10
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: regarding project

    haygaurav, I have looked over your project files.

    Please look at the libman directory. There is an official README file in there that tells you what you need to do. I have quoted it below.
    You really need to read over all of this again and try for yourself. I cannot replicate your setup here on my workstation.

    I suggest you create a new simple project with a single class. Make it really simple with an option to connect and disconnect from the Database. Nothing else.

    Then you can create the jar following the instructions in the driver readme and try again.

    You can keep trying different options until you get it to successfully connect.

    When you build an Java application project that has a main class, the IDE automatically copies all of the JAR files on the projects classpath to your projects dist/lib folder.

    The IDE also adds each of the JAR files to the Class-Path element in the application JAR files manifest file (MANIFEST.MF).

    To run the project from the command line, go to the dist folder and type the following:

    java -jar "LibMan.jar"

    To distribute this project, zip up the dist folder (including the lib folder) and distribute the ZIP file.

    Notes:

    * If two JAR files on the project classpath have the same name, only the first JAR file is copied to the lib folder.

    * Only JAR files are copied to the lib folder. If the classpath contains other types of files or folders, none of the classpath elements are copied to the lib folder. In such a case, you need to copy the classpath elements to the lib folder manually after the build.

    * If a library on the projects classpath also has a Class-Path element specified in the manifest,the content of the Class-Path element has to be on the projects runtime path.

    * To set a main class in a standard Java project, right-click the project node in the Projects window and choose Properties. Then click Run and enter the class name in the Main Class field. Alternatively, you can manually type the class name in the manifest Main-Class element.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

Similar Threads

  1. Netbeans User Manual
    By systech44 in forum Java IDEs
    Replies: 1
    Last Post: December 8th, 2009, 12:56 PM
  2. Netbeans help
    By [Kyle] in forum Java IDEs
    Replies: 2
    Last Post: September 20th, 2009, 06:32 PM
  3. Java ME / Netbeans : Device Name
    By Drakenmul in forum Java ME (Mobile Edition)
    Replies: 0
    Last Post: July 27th, 2009, 02:37 PM
  4. adding rows to coloumns. Netbeans
    By haygaurav in forum Java IDEs
    Replies: 1
    Last Post: April 1st, 2009, 03:16 PM
  5. Are We seriously Ignoring NetBeans?
    By javacrazed in forum Java IDEs
    Replies: 4
    Last Post: November 12th, 2008, 05:08 PM