Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT and mySQL - how?
SWT and mySQL - how? [message #454693] Wed, 27 April 2005 14:45 Go to next message
mr. burns is currently offline mr. burnsFriend
Messages: 402
Registered: July 2009
Senior Member
Hello,

I want to develop a frontend for a database application based on mySQL.
What is the right way to get the connection between SWT and mySQL?
Should I use

java.sql.Connection
java.sql.Statement
java.sql.ResultSetMetaData

to fill a SWT table / TableItem? What about the performance then?
What if I have one million records in a table?
Normally one reads only the No. of records which are to be shown on the
screen to increase speed, how to achieve this?

Or is there a control available which supports me in database connection?

Thanks for any help!

Mr. Burns
Re: SWT and mySQL - how? [message #454700 is a reply to message #454693] Wed, 27 April 2005 15:42 Go to previous messageGo to next message
Henning Rogge is currently offline Henning RoggeFriend
Messages: 148
Registered: July 2009
Senior Member
Mr. Burns wrote:
> Hello,
>
> I want to develop a frontend for a database application based on mySQL.
> What is the right way to get the connection between SWT and mySQL?
> Should I use
>
> java.sql.Connection
> java.sql.Statement
> java.sql.ResultSetMetaData
>
> to fill a SWT table / TableItem? What about the performance then?
> What if I have one million records in a table?
> Normally one reads only the No. of records which are to be shown on the
> screen to increase speed, how to achieve this?

You could use a virtual table and read only the visible data entries.

Henning.
Re: SWT and mySQL - how? [message #454715 is a reply to message #454700] Thu, 28 April 2005 06:35 Go to previous messageGo to next message
mr. burns is currently offline mr. burnsFriend
Messages: 402
Registered: July 2009
Senior Member
Hello,

thanks for your reply, I come from C++ I am a beginner in Java/SWT and do
really not know where to start.
Under C++ you have so called components which are ready to use objects which
offer all functionality you need to deal with tables and database.
So its with few effort possible to read, modify and write back data into
e.g. a mySQL database.

What is a virtual table in Java? Is it a SWT table or belongs it to Java?
And how to connect it to the mySQL database?
Does the SWT table offer an possibility to edit?

Do you have any codesnippet for me?

Thanks for further information!

Mr. Burns
Re: SWT and mySQL - how? [message #454717 is a reply to message #454715] Thu, 28 April 2005 07:47 Go to previous messageGo to next message
Yves Harms is currently offline Yves HarmsFriend
Messages: 80
Registered: July 2009
Member
You can find an example how to use the tableviewer framework in this
newsgroup by searching for the subject "Minimal TableViewer example".
Don't forget to check out the introductory articles featured at
eclipse.org's arcticles section also.

SWT and JFACE currently offer no functionality for dealing with the
database. You'll have to fetch your data per jdbc and then put it into
the tableviewer.




> Hello,
>
> thanks for your reply, I come from C++ I am a beginner in Java/SWT and do
> really not know where to start.
> Under C++ you have so called components which are ready to use objects which
> offer all functionality you need to deal with tables and database.
> So its with few effort possible to read, modify and write back data into
> e.g. a mySQL database.
>
> What is a virtual table in Java? Is it a SWT table or belongs it to Java?
> And how to connect it to the mySQL database?
> Does the SWT table offer an possibility to edit?
>
> Do you have any codesnippet for me?
>
> Thanks for further information!
>
> Mr. Burns
>
>
Re: SWT and mySQL - how? [message #454768 is a reply to message #454717] Thu, 28 April 2005 08:31 Go to previous messageGo to next message
mr. burns is currently offline mr. burnsFriend
Messages: 402
Registered: July 2009
Senior Member
Thanks, will try that!

Mr. Burns
Re: SWT and mySQL - how? [message #454769 is a reply to message #454717] Thu, 28 April 2005 08:34 Go to previous messageGo to next message
mr. burns is currently offline mr. burnsFriend
Messages: 402
Registered: July 2009
Senior Member
I tried to find "Minimal TableViewer example" in subject but no result, are
you sure that it is called "Minimal TableViewer example"?

Thanks again!

Mr. Burns
Re: SWT and mySQL - how? [message #454775 is a reply to message #454769] Thu, 28 April 2005 11:56 Go to previous messageGo to next message
Yves Harms is currently offline Yves HarmsFriend
Messages: 80
Registered: July 2009
Member
Yes, its an older post and works for me.
You can either try to download all posts or use the search function at
eclipse.org.


> I tried to find "Minimal TableViewer example" in subject but no result, are
> you sure that it is called "Minimal TableViewer example"?
>
> Thanks again!
>
> Mr. Burns
>
>
Re: SWT and mySQL - how? [message #454788 is a reply to message #454769] Thu, 28 April 2005 17:36 Go to previous messageGo to next message
Henning Rogge is currently offline Henning RoggeFriend
Messages: 148
Registered: July 2009
Senior Member
Mr. Burns wrote:
> I tried to find "Minimal TableViewer example" in subject but no result, are
> you sure that it is called "Minimal TableViewer example"?

If you want to use pure SWT, try this example:

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet144.java?rev=HEAD& amp;content-type=text/vnd.viewcvs-markup

( you will find more SWT snipplets at
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/dev.html#snippets
)

You will just have to load the visible parts of the database on the fly.

To use the database you should use the JDBC interface of java.
( http://java.sun.com/docs/books/tutorial/jdbc/index.html )

Henning Rogge
Re: SWT and mySQL - how? [message #454806 is a reply to message #454788] Fri, 29 April 2005 13:49 Go to previous messageGo to next message
mr. burns is currently offline mr. burnsFriend
Messages: 402
Registered: July 2009
Senior Member
Thanks,

will try that!
Thanks all for help, but how to edit now? [message #454807 is a reply to message #454693] Fri, 29 April 2005 14:00 Go to previous message
mr. burns is currently offline mr. burnsFriend
Messages: 402
Registered: July 2009
Senior Member
Hello,

thanks for all who gave me some hints where to start.
Now I am able to read a table from mySQL database into a SWT table.
But what is now the right way to make a table or just some columns editable?

Thanks again for some hints!

Best regards,

Mr. Burns
Previous Topic:Repainting question
Next Topic:CTabItem selection in a CTabFolder
Goto Forum:
  


Current Time: Tue Apr 16 15:54:51 GMT 2024

Powered by FUDForum. Page generated in 0.51939 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top