Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Netbeans creating a desktop application connecting to SQL Server DB

Posted on 2011-09-21
5
398 Views
Last Modified: 2012-05-12
Hi All,

I am a newbie to Netbeans my knowledge is quite basic.

Is it possible to create a table to update records in one DB Table also showing linked fields from other DB tables (which are not needing to be edited)
I also want to limit the amount of data shown using the equivalent of Select ...Where SQL query.

Is this possible?  
What is the best way to go about it?
Once you have confirmed this I will probably need some help implementing the solution!
Thanks a lot Experts
0
Comment
Question by:GracefBase
  • 2
  • 2
5 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 36574817
Of course it is possible. Just use appropriate SQL statement selecting the fields which you need with the join if you need to link with another table
And you can forst select data - sshow them to user, accept changes in those field where they are possible,
and then update your DB table
 That is what you can do wiith JDBC - you just need correct driver, set up connection and devise SQL statements
This is the JDBC tutorial:
http://download.oracle.com/javase/tutorial/jdbc/
0
 

Author Comment

by:GracefBase
ID: 36579340
Hi For_Yan,
I actually have a desktop application which I made using the example in the tutorial 'Creating a custom desktop database application'
I've set up the connection to the SQL database using JDBC
and I have set up entities for the different tables, but I cannot figure out where to put the SQL query to link them all together.
When I followed the tutorial way of linking the tables in the main entity I kept getting errors as I replaced the integer type with the name of the other table (eg Chargetypes) as it said in the tutorial, but the errors say it is not a valid data type.
The table that shows the data at the moment has a query within the entity manager, and I have changed this to select the data from the main table (MRcharge) :
SELECT m FROM MrCharge m  WHERE m.mrID > 98573 ORDER BY m.mrID

However when I tried to add the join to the query I put eg:
SELECT m FROM MrCharge m, MrChargeView4 c  WHERE m.mrID > 98573 and c.MrChargeId = m.MrCharge ORDER BY m.mrID
but I get  errors - please can you help?  I think its something simple I'm missing?
0
 
LVL 1

Accepted Solution

by:
dileeph earned 250 total points
ID: 36588285
GracefBase,

Following the tutorial 'Creating a custom desktop database application' I believe you end up creating a JPA application. Are you aware of JPA? If not better learn that before you go through rest of the tutorial.  Essentially you have to write JPAQL queries rather than  SQL queries.
0
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 250 total points
ID: 36588379
I actually meant that you would rather go through JDBC tutorial
http://download.oracle.com/javase/tutorial/jdbc/ 
and at least start with the regular JDBC connection and SQL queries used within JDBC without
any JPA , entities, etc.
If you are really new to JDBC - as I understood from your question -  that's what I think is much apprroprite to do at least at first.

>Is it possible to create a table to update records in one DB Table also showing linked fields from other DB tables (which are not needing to be edited)
>I also want to limit the amount of data shown using the equivalent of Select ...Where SQL query.

>Is this possible?

You don't need any entity manager to do all that.
I'd rather start with plain JDBC


If you want to prossed with your path, well, post the errors, otherwise it is hardly possible
to think about any help to you.


 
0
 

Author Comment

by:GracefBase
ID: 36597591
OK thanks I will do that
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Server query - can a #temp table be improved with indexing? 6 43
SQL Activity Monitor detail 2 24
sql server query 12 25
RAISERROR WITH NOWAIT 2 16
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question