Java EE SDK :: MVC - Where Is Database Layer
Jan 6, 2012
In MVC, M is the model, V is the view and C is the controller. But whatever projects I have made till now, I have a separate layer called data layer where I do all the database operations. In MVC, are we saying that the database operations are within the controller layer? That's quite a little mismatch! Separation of layers yet merge of controller & database operations!!
View Replies
ADVERTISEMENT
Apr 15, 2014
I'm trying to create a simple game for that I want to move the ball over a background image. So I am using JLayeredPane. I have added a image with lower layer and ball with above layer. But only ball is being displayed. Here is my code.
Main Class
package game1;
import java.awt.*;
import javax.swing.*;
public class Game1 extends JPanel{
Ball b= new Ball(this);
[Code] .....
View Replies
View Related
May 12, 2013
Web Layer - JSP/Servlets
Business Layer - EJB 3
I want to develop separate projects for web layer (.war) and for Business layer (.jar). I want to deploy these layers on different Glassfish servers.
Here is my Approach -
1. Create a separate module for remote interfaces (.jar), use @remote annotations
2. Create a Web module using JSP/Servlets (.war) and use this remote interface jar in it.
3. Create a EJB module (.jar) and implement these remote interface in it.
4. Use JNDI in Web layer to access the EJB methods.
I want to know if this is the correct approach?
View Replies
View Related
Jun 30, 2014
I am going to develop a new web application of medium complexity. Right now i am somewhat comfortable with JSF and hibernate. I have never used JSF and hibernate together before.I just wanted to ask if it is good practice to use JSF (for both view layer and handling business logic) and hibernate(for persistence) without spring as a middle layer. The reason why i am asking this is i don't know anything about spring framework.
View Replies
View Related
Feb 28, 2015
I cannot restore my database that was backup already. This is my code . . .
public boolean restoreDB(String dbUserName, String dbPassword, String source) {
String[] executeCmd = new String[]{"C:Program Files (x86)MySQLMySQL Server 5.1inmysql.exe",
"--user=" + dbUserName, "--password=" + dbPassword,"-e", "source "+source};
Process runtimeProcess;
try {
runtimeProcess = Runtime.getRuntime().exec(executeCmd);
int processComplete = runtimeProcess.waitFor();
[Code] .....
View Replies
View Related
Sep 3, 2014
how can i stop this loop(while (res.next() )
example: i hava a table conex wich i inser on it two columns name and password i fill it by
name : yosra password : lol
name : najeh password :mdr
i don't know when i fill jTextfield of password and name correctly for ewp i put yosra as name and password as lol the loop continue to the next row and i show the two message dialog on netbeans about correct acces and refused access and the frame of my chatroom is opened
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
String pass=new String(this.pass.getPassword());
String nam=this.name.getText();
acceder(nam,pass);
[code]....
View Replies
View Related
Mar 17, 2014
I want to add this image to database how can i do.
View Replies
View Related
Mar 19, 2014
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?
View Replies
View Related
Oct 27, 2014
I'm using oracle 10g Database and Java 'jdk1.7.0_45' version.I have to a create program to insert data into a table.
View Replies
View Related
Mar 23, 2014
i want o know that how can i connect my sql database to java
View Replies
View Related
Oct 17, 2014
I would like to make a database using HTML and Java. I already made something like this using swing. I am just looking for some pointers here. I just started looking into Java Play 2 and I have a feeling this is what I am looking for. JavaEE is very complicated and I have read that it is being phased out. What is your opinion on this?
I want to make a static HTML page and put it on my home network and treat one of my computers as the sever accessing mySQL.
View Replies
View Related
Feb 26, 2015
I'm having problem with my code when it comes to Restore Database in Java. This is my code:
public boolean restoreDB(String dbUserName, String dbPassword, String source) {
String[] executeCmd = new String[]{"C:Program Files (x86)MySQLMySQL Server 5.1inmysqldump ", "--user=" + "root", "--password=" + "1234" + source};
Process runtimeProcess;
try {
runtimeProcess = Runtime.getRuntime().exec(executeCmd);
int processComplete = runtimeProcess.waitFor();
[Code] ....
View Replies
View Related
Apr 25, 2014
So I am working on a DB homework assignment and I am confused in how to implement a users input into the DB; I have to enter some values into a Table that is filled out by a user. It is a basic program, no GUI needed at this point.
I have written the main part but I don't know how I would get the typed value of the data into the SQL Insert Query.
Here is my code (I have a working Database and table with Java DB)
public class AddPeople
{
public static void main(String[] args)throws Exception
{
Scanner kb = new Scanner(System.in);
try
{
Connection conn = DriverManager.getConnection("jdbc:derby:PeopleDB");
[Code] .....
View Replies
View Related
Jul 18, 2014
I have a sqlite database i already have the connection with java and it works ... I have a method to add a record ...
public boolean AddRecord(CustomerRecord r){
String sql = "INSERT INTO CustomerRecord (Name, Number, Adress)"
+" VALUES(?,?,?)";
try {Connection connection = getConnection(); // call connection method
connection.setAutoCommit(false);
[Code] .....
I call this method in my interface and i write
if (addrecord == true){System.out.printnl("record added");}
I close the interface then enter search for the record i just added using add record method but i do not find it
what i am trying to say the added record using my application is not there. The question is how to save this record in the database ...
I thought
ps.executeUpdate();
should do this but it is not saved.
View Replies
View Related
Jun 18, 2014
I have code which query value from database, the use case is the user can enter value as 1,01,11 in database but when the user enter value in xml file he can only enter 11,01,12 in database there is two columns lets say column test1=1 and test2=2 combination of this is 12, which is the value the use will enter in xml, but sometime the use can enter test1=04 than column test2=00 how can i approach this
I got table called card with column crdind,crdpos1,cardpos2 as primary key. The user can enter value as
crdind=1
crdpos1=5
crdpos2=3
inactivedate=2013-05-24
activedate=null
another row
crdind=1
crdpos1=5
crdpos2=5
inactivedate=2013-05-24
activedate=null
another row
crdind=6
crdpos1=02
crdpos2=00
inactivedate=2013-05-24
activedate=null
The rule say if you enter one number in crdpos1 eg 2 than you must enter value in crdpos2 it can be any number 1-9 but if you enter 00-09 in crdpos1 than crdpos2 is 00
The challenge I have is to query this value after they been enter. I have xml file which got field crdpos the use enter 15 which is the combination of column crdpos1=1 and crdpos2=5 ... How can I split the value crdpos and got and able to query in database in two separate column ....
View Replies
View Related
Jul 13, 2014
for a project im doing i need to create a java app with an embedded database so that the datbase is part of the application instead of run on a server that the app talks to.
the problem im having is finding the documentation for this, ive found the following 2 tutorials that almost do what i need:
NetBeans Platform CRUD Application Tutorial Working with the Java DB (Derby) Database.
how i can accomplish embedding a database into a java app.
View Replies
View Related
Jan 15, 2015
I have a shop and I use visual studio.net to create an Inventory application to manage my shop. So I am familiar with vb.net codes.
Now, I'm trying to built another Inventory application for my shop using java, 'coz now I'm using Linux Ubuntu for my OS desktop and there's no visual studio.net in linux.
So in vb.net, there's a module that I use for database connection that I can call from any form that I needed.
I searched google for the equivalent module for java and there is none. But, there's an example that use a new java class.
Here's the code in MySQLConnect.java :
Java Code:
public class MySQLConnect {
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
static final String DB_URL = "jdbc:mysql://localhost/dbInventory";
static final String USER = "root";
static final String PASS = "root";
public static Connection ConnectDb() {
[Code] ....
View Replies
View Related
Jul 7, 2014
I have written my whole java code in netbeans IDE and create database in MYSQL work bench and connected java Gui with this DBMS through requried driver.when i run this program from Netbeans IDE , my program successfully access the data from DBMS. But when i created this java gui exe file its not working and not accessing data from DBMS, and each times gives exception "Driver not found ".if there is no driver loaded in this program how this file is working when i run this file from netbeans .
View Replies
View Related
Jul 20, 2014
I have java application used to manage a sqlite database (add new records, search .....) I already have everything and I convert it to jar file but the question is how to burn it to cd with the sqlite database . I mean we need to change the database URL for connection class. My question is there any programs would combine my database + my jar file and make it exe file ?
or i should manually change my database url in connection class ? (if yes what should i write knowing that my database and my jar file will be burnt to a cd). I searched online but i could not found any one related sqlite database or at least a clear one . I already has my jar file but if i moved the database from its directory it will not work ...
View Replies
View Related
Jul 1, 2014
I have to store data I've pulled from the web i wanted to do this by storing it in a database but after looking at some tutorials i'm not sure if its possible as the databases don't seem to run with the application but instead run as an independent entity.if its possible to have a database in the java application so it runs when the application runs.
View Replies
View Related
Jun 25, 2014
Ive recently been given a task of recreating an Excel type database in Java.
I need some way of recreating this with a Java form and SQL database.
What the company is doing now is simply opening up the Excel file and filling in the boxes then saving it again.
Here's a sample of a Months entries. Basically just this copy and pasted month after month with Dates changed.
[URL] ....
What I am doing is creating a form that they can input info into daily
[URL] ....
However im not sure how to create a way of presenting the month to month figures continually for years to come.
View Replies
View Related
Sep 17, 2014
I am new to Java Stored Procedures. There is a PL/SQL package in our legacy application(Oracle 9i) which pulls data from Oracle 8i source database through a DB link. Now we have upgraded our databas to Oracle 11g R2 from 9i. So the DB lint to Oracle 8i will no longer work in 11g. Hence I have created a Java stored procedure that establishes JDBC thin connection to the source 8i database. I have loaded the java stored procedure in the database using loadjava and have created a call specifaction.
I have called this java stored procedure inside the PL/SQL package. Now while executing the PL/SQL package, it takes the default driver ojdbc6.jar to establish JDBC connection and fails to connect to the 8i database giving ArrayIndexOutOfBounds Exception. While running the code in the linux application server with classes12.jar the code succeeds. But when the same is called in the database it fails.
1. How can I make my PL/SQL call use classes12.jar while calling the Java Stored Procedure?
2. How can I load the jar file(which includes my classes and the classes12.jar) into the datase as one object? (When I tried to load the whole jar, in database the classes and dependent jar loaded separately)
3. Is there a way to use classpath while calling the Java Stored Procedure like how we do from Unix?
View Replies
View Related
Aug 3, 2014
import data from excel sheet into mysql database through a java program. How coding will be done in Core Java.
View Replies
View Related
Jan 21, 2015
I want to develop desktop application with mysql . How to connect mysql . Any sample project or examples to learn .
View Replies
View Related
Sep 30, 2014
I have written java program which can extract online data from url and i want to store it in data base in new token row in table so than i can use in my application . how could it be done using type4 drive ..
These are my code ...
import javax.swing.text.html.parser.*;
import javax.swing.text.html.*;
import javax.swing.text.*;
import java.io.*;
import java.util.StringTokenizer;
import java.net.*;
public class ParseTest extends HTMLEditorKit.ParserCallback {
[Code] ......
View Replies
View Related
Nov 23, 2014
I would like to import database to the Java pane and connect objects to each other and want to display their information as visually. How can i do.
View Replies
View Related