Database connection problem when i try store the values in JTable
Hi Sir,
I have a database connection problem when i try to store the data's in a JTable.I think the problem is with in the database connection.I have used 3 vectors here.The database which i have used is
Access.Where the program is compiling well.But when i run it only the first column heading is printed and error message showing that
"Invalid Cursor State".I need to solve this problem.pls. do help me.
I will provide u with the code.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.util.*;
import java.sql.*;
public class DataBaseVector extends JPanel
//Container contentPane=getContentPane();
JScrollBar jsb = new JScrollBar(JScrollBar.HORIZONTAL);
JScrollBar jsb1 = new JScrollBar(JScrollBar.VERTICAL);
Image i1;
String url="jdbc:odbc:Ananth";
Vector col=new Vector();
Vector rows=new Vector();
Vector rdata=new Vector();
Connection conn;
public DataBaseVector()
//super("JTable With ScrollBars");
this.setLayout(new BorderLayout());
UIManager.put("ScrollBar.track",Color.red);
UIManager.put("ScrollBar.thumb",Color.blue);
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection(url); // Is there any problem here?
Statement st=conn.createStatement();
ResultSet rs=st.executeQuery("Select * from AccountMaster");
// rs is the result set obtained
ResultSetMetaData rsmd=rs.getMetaData();
int cols=rsmd.getColumnCount();
for(int i=1;i<=cols;i++)
col.addElement(rsmd.getColumnName(i));
rdata.addElement(rs.getString(i));
rows.addElement(rdata);
}catch(Exception e)
System.out.println("The Error Message was:"+e.getMessage());
JTable jt=new JTable(rows,col);
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp=new JScrollPane(jt,v,h);
this.add(jsp,BorderLayout.CENTER);
this.add(jsb, BorderLayout.SOUTH);
this.add(jsb1, BorderLayout.EAST);
public static void main(String args[])
JFrame jf=new JFrame();
JPanel frame=new DataBaseVector();
jf.getContentPane().add(frame);
jf.setSize(800,600);
jf.setVisible(true);
Thanx,
m.ananthu
The problem is ResultSet.next() is not called.
Try this and modify the table creation as you need.
ResultSetMetaData rsmd=rs.getMetaData();
int cols=rsmd.getColumnCount();
while(rs.next()) {
for(int i=1;i<=cols;i++)
col.addElement(rsmd.getColumnName(i));
rdata.addElement(rs.getString(i));
rows.addElement(rdata);
Hope this helps
Similar Messages
-
Problem when i try reconnect the same user to tuxedo 8.0
Hello
I build a dll for use in a java application by JNI. This dll work very fine
under Tuxedo 6.4.
Now I use Tuxedo 8, I recompile the dll for tuxedo 8 and try my system, this
work fine. The problem is that my application detect a network error and try
to make a tpinit for reconnect.
This funcionality work very fine under Tuxedo 6.4, but on Tuxedo 8 the
client side sendme the follow error: Error in tpinit = -1, TPEPERM Bad
Permissions.
In my Tuxedo server i get the meesage error: A workstation client does not
have a proper application password.
I use the same ubbconfig file for Tuxedo 6.4 and Tuxedo 8, i don?t know what
happend.
Info: i don?t using a password system for connecto to tuxedo server.
Thanx for any help
Rodrigo Ca?ete MolinaHmm i made it but i have the same error.
Remember that i have a dll created by using JNI to make tpinit, I set the
variable WSINTOPPRE71 inside of .BAT file that stating my application.
Thanxs
Rodrigo Ca?ete Molina
Ingeniero de desarrollo
Bolsa Electr?nica de Chile
Fono: (56 2) 484 0146 - (56 2)484 0100
Fax: (56 2) 484 0101
"Per Lindstr?m" <[email protected]> escribi? en el mensaje
news:[email protected]..
Hello Rodrigo,
important changes were made to the TUXEDO security model between 6.5 and7.1 (and subsequent releases).
>
Clients and servers on different releases (pre-7.1 and post-7.1) are notnormally allowed to communicate, you need to explicitly enable this.
>
If your CLIENT is running post-7.1 version, you need to set theenvironment variable WSINTOPPRE71=Y on the client prior to starting your
/WS-based application.
>
If your SERVER is running post-7.1 version, you need to add '-t' in theCLOPT for your WSL on the server.
>
Hope this helps,
/Per
Per Lindstr?m - R2Meton AB, SWEDEN -
i have a problem when i try to update or install apps in my ipad, and a message come up says "can not connect to Itunes Store", anyone know why? please advise. however i had update all my detail of payment method.
Settings > General > Reset > Reset Network Settings.
Power cycle the router.
Basic troubleshooting from the User's Guide is reset, restart, restore (first from backup then as new). Try each of these in order until the issue is resolved. -
i have installed photoshop elements 12.
when I try use the editing features it said that i must login to Adobe to register the product.
but each time i try to it said there is a problem.
help
the problem stated that the internet is not connected, but that is not the case.I had the same issue and I'm running Windows 7. Tried working with technical support for several hours but they were no help. They just had me doing the same things over and over, offering no real answers. I finally got fed up and have decided to return my product for a full refund.
-
My ipad has the Internet connected nut when I try to update apps a message pops up to say it cannot connect to,iTunes store.
The Complete Guide to Using the iTunes Store
http://www.ilounge.com/index.php/articles/comments/the-complete-guide-to-using-t he-itunes-store/
Can't connect to the iTunes Store
http://support.apple.com/kb/TS1368
iTunes: Advanced iTunes Store troubleshooting
http://support.apple.com/kb/TS3297
Best Fixes for ‘Cannot Connect to iTunes Store’ Errors
http://ipadinsight.com/ipad-tips-tricks/best-fixes-for-cannot-connect-to-itunes- store-errors/
Try this first - Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
This works for some users. Not sure why.
Go to Settings>General>Date and Time> Set Automatically>Off. Set the date ahead by about a year.Then see if you can connect to the store.
Cheers, Tom -
I am having trouble useing i tune, when i try to connect it says ubable to connect, and when i try to pay for something it says please contact i tunes, i have checked my wi fi, and i have money in my account, can you help, thank you
These are user-to-user forums, you can contact iTunes support via this page and ask them why the message is appearing : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page
-
I connect on my ipad to my wifi and it sows good signal strength but when i try using the internet it says it cannot because it is not connected to the internet.
Have you tried rebooting your router - unplug it for about 30 seconds and then plug it back in? Is this a new problem? Have you been able to connect to your home WiFi before?
This WiFi assistant set up article might help.
http://www.apple.com/support/ipad/assistant/wifi/
More troubleshooting help is available here.
http://support.apple.com/kb/ts1398 -
hi there. i just bought itunes gift card, then hit redeem in my account , the problem when i try to rent a movie it gave me "error occurred (-50) . my internet is working perfectly
Perhaps try the "Error -50," "-5000," "8003," "8008," or "-42023" section in the Specific Conditions and Alert Messages: (Mac OS X / Windows) section of the following document:
iTunes: Advanced iTunes Store troubleshooting -
my wifi is connected but when i try to connect to safari it says the internet is not connected, i tryed resetting network system but still no luck.
Your iPad sees the WiFi network signal but obviously it is not connected to the network. Try rebooting your router - unplug it for about 30 seconds and then plug it in again.
-
When I try to, the person on the other side can't hear me, and all I can hear are noises. But when I use apps like Viber or Facetime, I can make calls just fine! What may be the problem?
Did you fix the problem? I have the same problem and it has been pain in the neck.
-
I'm having trouble restoring my ipod. The software starts to download but it stops saying that there is a connection problem when there isn't. What can I do?
Disable the computer's security software during the download and update.
-
I have a Macbook Pro (2013) OS 10.8.1. Moved into a university house and need to use ethernet cable. Bought the Thunderbold connection but when I try to use the ethernet with it a webpage comes up saying Wireless Setup and Router Setup? I have previously used ethernets in similar situations and never had to input information like this?
I have tried to turn of the wi-fi but that doesn't work either. I think it could be a something to do with the internet provider because virginmedia comes up on the webpage. This is what comes up:
Wireless Setup
WGR614V9
V1.0.11_1.0.1VGUK
Wireless Setup
Name (SSID):
Security Passphrase (WPA-PSK):
(8-63 characters)
Channel:
01 06 11
Router Setup
Router Password:
(8-63 characters)
any ideas?!? -
I create a project w/iMovie and I have two problems: When I try to finalize the project iMovie crashes; when I share to DVD sometimes it crashes also; if I can successfully send it to DVD and then burn a DVD there are wavy lines on the screen. I'm uising photos in my project, not video. Help!
You can split a project in two by doing this.
1) Go to the Project Library View.
2) Select your project, and click FILE/DUPLICATE PROJECT. Give it a name like "your project name - part 1".
3) Do this again. This time name it "your project name - part 2"
4) Open Part 1 for editing. Delete everything in the second half.
5) Open Part 1 for editing. Delete everything in the first half of the project.
At the end you should have your original project, plus the same project in two parts. -
i just updated my ipod touch 4th generation to iOS 6 but there seems to be a problem when i go to the app store, it always crash, what could be the problem? thanks
Try quitting the app out of your multitasking bar, and then resetting (hold power an home buttons til device shuts off and comes back on).
-
Hi guys, a game I'm trying to play keeps unexpectedly closing every time I try to play. When I try reopening, the same thing keeps popping up so I don't really know how to fix that problem. Can you help?
Plus this showed up when I looked up the details of why it quit unexpectedly.
Process: launchd [458]
Path: /Users/USER/Library/Application Support/Steam/*/Starbound.app/Contents/MacOS/starbound
Identifier: com.chucklefish
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: launchd [154]
Date/Time: 2014-01-06 19:19:28.898 -0500
OS Version: Mac OS X 10.7.5 (11G63b)
Report Version: 9
Interval Since Last Report: 1786 sec
Crashes Since Last Report: 23
Per-App Crashes Since Last Report: 23
Anonymous UUID: 6F40DBC0-08A7-4A21-A80E-185F669D1C93
Crashed Thread: Unknown
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00007fff5fc01028
Backtrace not available
Unknown thread crashed with X86 Thread State (64-bit):
rax: 0x0000000000000055 rbx: 0x0000000000000000 rcx: 0x0000000000000000 rdx: 0x0000000000000000
rdi: 0x0000000000000000 rsi: 0x0000000000000000 rbp: 0x0000000000000000 rsp: 0x0000000000000000
r8: 0x0000000000000000 r9: 0x0000000000000000 r10: 0x0000000000000000 r11: 0x0000000000000000
r12: 0x0000000000000000 r13: 0x0000000000000000 r14: 0x0000000000000000 r15: 0x0000000000000000
rip: 0x00007fff5fc01028 rfl: 0x0000000000010203 cr2: 0x00007fff5fc01028
Logical CPU: 2
Binary images description not available
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 1
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 1095
thread_create: 0
thread_set_state: 0
Model: MacBookPro8,1, BootROM MBP81.0047.B27, 2 processors, Intel Core i5, 2.3 GHz, 4 GB, SMC 1.68f99
Graphics: Intel HD Graphics 3000, Intel HD Graphics 3000, Built-In, 384 MB
Memory Module: BANK 0/DIMM0, 2 GB, DDR3, 1333 MHz, 0x80AD, 0x484D54333235533642465238432D48392020
Memory Module: BANK 1/DIMM0, 2 GB, DDR3, 1333 MHz, 0x80AD, 0x484D54333235533642465238432D48392020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0xD6), Broadcom BCM43xx 1.0 (5.106.198.19.22)
Bluetooth: Version 4.0.8f17, 2 service, 18 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en1
Network Service: BlackBerry (en3), Ethernet, en3
Serial ATA Device: TOSHIBA MK3265GSXF, 320.07 GB
Serial ATA Device: MATSHITADVD-R UJ-8A8
USB Device: FaceTime HD Camera (Built-in), apple_vendor_id, 0x8509, 0xfa200000 / 3
USB Device: hub_device, 0x0424 (SMSC), 0x2513, 0xfa100000 / 2
USB Device: Apple Internal Keyboard / Trackpad, apple_vendor_id, 0x0252, 0xfa120000 / 5
USB Device: BRCM2070 Hub, 0x0a5c (Broadcom Corp.), 0x4500, 0xfa110000 / 4
USB Device: Bluetooth USB Host Controller, apple_vendor_id, 0x821a, 0xfa113000 / 7
USB Device: hub_device, 0x0424 (SMSC), 0x2513, 0xfd100000 / 2
USB Device: RIM Network Device, 0x0fca, 0x8013, 0xfd120000 / 4
USB Device: IR Receiver, apple_vendor_id, 0x8242, 0xfd110000 / 3
Maybe you are looking for
-
Hi just recently i think after a osx software update for my intel imac, everytime i start up logic it gives me a message saying "the previously selected audio interface is not available. The built in audio inputs and outputs of the computer will be u
-
This morning I wanted to restore my iPod Touch (1st Gen and Jailbroken) because I am planning on selling it. But iTunes told me I had to update my ipod in order to restore but I didn't want to cause my internet is REALLY slow. So i just restored it b
-
Help to eject or unmount disk upon shutdown
Hello all, Please take pity on a newbie and answer what I hope is a really simple script question. This is my first attempt at Apple Script. I have searched for a script that will eject (unmount) a disk upon shutdown, but haven't found anything on th
-
Status of bug #1754627?
I posted a bug back in April which brought to light na issue with transparent HTML/JS AIR apps when used in conjunction with BlazeDS. I apparently no longer have the ability to see that bug report. Can anyone tell me if this bug has been squashed in
-
IMac G5 is crashing during start
Hi boys & girls... i have a mac, iMac G5 with 1,8 GHz - PPC Updated with 1GB RAM and 400GB HDD. Bevor i have upgraded with this hardware, i have a kernel panic. so, i think... okay, lets upgrade - maybe its away. but, they is not away :/:( sometimes,