Designing Jar File Where Access Of Certain Database Provided Through API
Jan 30, 2015
I'm given a task to generate an API (a jar file) where the access of a certain database is provided through the API. basic functionality: Client sends a query through the API to server and the Server responds with data.Since its and API, do I have to implement the code or is it enough if i gave just interfaces? what are the OOP concepts to focus on when designing a good API.
I want to make a database and use it in my java program. I am thinking of using MS Access database, although I m not very sure, sine I will have to use this data later in the SQL database as part of C# program.
How to start to create and use MS database in java program.
I have seen in one tutorial that the steps are:
1. Install your database management system (DBMS) if needed
2.Install a JDBC driver from the vendor of your database
but I am not familiar with this. Any example, or is this above compulsory?
my aim is to make a runnable jar. I've made a program using swings which uses MS Access database to fetch records. So, I've used an absolute path to refer to the database for connection. Now, I intend to distribute this runnable jar to other people as well. So I guess the best option would be to embed the MS Access database as well in the jar file. But I don't know how to do that. Where should I keep the database in my Project Explorer ? Should I use a relative path etc.
I need my java program to insert data into my access database. I get no errors in my code, but it never inserts, deletes the data in my database. Here is my code:
import java.awt.*; import java.awt.event.*; import java.sql.*; public class INS extends Frame implements ActionListener{ Frame f; Label l1, l2; TextField t1, t2; Button b1, b2, b3, b4, b5; Connection c;
I need creating a java keyword program that can encipher and decipher a message using the provided keyword.
The keyword is :javbean
I have attached the message text as well...
public class Caesarcipher { public static final String ALPHABET = "abcdefghijklmnopqrstuvwxyz"; public static void main(String[] args) { String theKey = "JAVBEANDEFGHIJKLMNOPQRSTUVWXYZ"; String text= "message.txt";
I am working on a project that requires me to build a database with random access file, representing products, the base product contains a name (about 30 characters), a price (double), and a quantity (integer). I have worked on this project for probably 15+ hours and have tried so many things and feel like I've barley made any progress...
The part i am really struggling with is taking the data from the text file and creating an object array with it using the product class. Once ive accomplished that, i have to use that data to create a random access file with the data.
Here is the base Product class that must be used to create the objects for the array.
public class Product { public String pName; public String stringName; public double price; public int quanity;
[Code] .....
And then here is the data from the text file that i must extract to use to create product objects.
These continue for about 40-50 entries, they are not separated by a blank line though i had to add those so it would display correctly, each entry is on its own line with name separated with spaces, then price after a comma, then quantity after the second comma.....
I am working on a project that requires me to build a database with random access file, representing products, the base product contains a name (about 30 characters), a price (double), and a quantity (integer). I have worked on this project for probably 15+ hours and have tried so many things and feel like I've barley made any progress...
The part i am really struggling with is taking the data from the text file and creating an object array with it using the product class. Once ive accomplished that, i have to use that data to create a random access file with the data. Here is the base Product class that must be used to create the objects for the array.
public class Product { public String pName; public String stringName; public double price; public int quanity;
[Code]...
these continue for about 40-50 entries, they are not seperated by a blank line though i had to add those so it would display correctly, each entry is on its own line with name seperated with spaces, then price after a comma, then quanity after the second comma.....
I am working on a project that requires me to build a database with random access file, representing products, the base product contains a name (about 30 characters), a price (double), and a quantity (integer). I have worked on this project for probably 15+ hours and have tried so many things and feel like I've barley made any progress...
The part i am really struggling with is taking the data from the text file and creating an object array with it using the product class. Once ive accomplished that, i have to use that data to create a random access file with the data.
Here is the base Product class that must be used to create the objects for the array.
public class Product { public String pName; public String stringName; public double price; public int quanity; //Constructor public Product( String pName, double price, int quanity )
[code]....
and then here is the data from the text file that i must extract to use to create product objects.
Dill Seed,938,34
Mustard Seed,100,64
Coriander Powder,924,18
Turmeric,836,80
Cinnamon (Ground Korintje),951,10
Cinnamon (Ground) Xtra Hi Oil (2x),614,31
Cinnamon (Ground) High Oil (1X),682,19
these continue for about 40-50 entries, they are not separated by a blank line though i had to add those so it would display correctly, each entry is on its own line with name separated with spaces, then price after a comma, then quanity after the second comma.....
I need to write a program that will create an inventory file as a random access file. The problem that I am having is that among the things I need to add to the random access file is a "car name". Since random access files are byte based I don't know how I could possibly write and then read a string value.
I have one question that suppose I am designing a Swing applications and I am using JFrame as Top level container.
So what is best
1)first Extends that class like
public class A Extends JFrame { //Do all stuff with Top Level container with gui }
2)Or design like this from this source
[URL] ....
package components; import java.awt.*; import java.awt.event.*; import javax.swing.*; /* TopLevelDemo.java requires no other files. */ public class TopLevelDemo { /** * Create the GUI and show it. For thread safety, this method should be invoked from the event-dispatching thread. */ private static void createAndShowGUI() { //Create and set up the window.
I am designing a game that simulates a roomba robot vacuum and have most of the framework done. So I have random floating circles and the Roomba bot in the center. The boot is suppose to move with the arrow keys. However when i run the program and select the keys nothing happens. Here's my code.
import java.awt.*; import java.awt.event.*; import java.awt.geom.Ellipse2D; import java.awt.Graphics; import javax.swing.*; public class Roomba extends JFrame implements ActionListener, KeyListener{
So i'm writing a for loop to convert any number entered to base 10 with any base provided as well. My code does not work because I need a way to reverse the code order, so the new number is printed correctly with the given base. My code so far:
public static void main (String[] args) { Scanner kb = new Scanner (System.in); System.out.print("Enter a number :: "); int numOriginal = kb.nextInt(); System.out.print("Enter a base :: "); int base = kb.nextInt();
[Code] .....
newBase has a problem with how it calculates the new number, looking for correct newBase code for conversion?
I am having hard time to grasp the concept of java as i am beginner. according to different sources found in internet, only one class is written in one source file. and all those class can be accessed through the main class. my question is
1.can we access one class present in one source file, through another class present in another source file [not through the class containing main method]?
2.can we create more than 1 class in same source file?is there special way to do it? i do get error always when i try to do so 3.can multiple classes contain main method? or should there be only single class containing it?
I want to access variable of java file into jsp Page. So I tried to do this but it does not work.
Problem : when I am trying to access "getName" method of java class into jsp file it displaying error, i already imported "Ajaxmethod.java" file in to "success.jsp" I want to access "getName" method in to jsp file without creating object of class.
Ajaxmethod.java package a.b; public class Ajaxmethod implements Action{ public String name; public String getName() { return name; }
I'm trying to access class file which is inside the package and package is inside the jar file but I can't access that class file inside my source file . All files are on desktop .
I have a random access file stream. I have below code I want to written data that is currently pointed by pointer till the end and display that data on System.out Stream but it is not working my code is
//Create a Random Access File java.io.RandomAccessFile random=new java.io.RandomAccessFile("D:/input.txt","rw"); //Position the pointer to a seek try { random.seek(300); long pointer=random.getFilePointer(); System.out.println("Current Pointer is:"+pointer); int a; while((a=random.read())!=-1) { System.out.println(a); }
Where am I wrong? Although it is returning actual position of pointer in pointer using
I am creating a read/write, RandomAccessFile that I will use to store several student ID and gpa score. What I don't understand is how I should go about retrieving a particular set of data.
public class ReadWrite { static Scanner keyboard = new Scanner(System.in); static String fileName = "Stu.dat"; static RandomAccessFile raf; public static void main(String [] args) throws FileNotFoundException, IOException {