Permissions on a table to public

hi all,
i have one doubt on tables permissions please clear me.
1) if we consider gmail, user has to provide required data to get gmail account. so obviously all this table is going to store in a particular table.
so with out having any user account in database how user's can access that table.
2) how a table can be accessed by multiple users.
thank a lot in advance.

GMail in particular probably isn't using a relational database on the back end. They're probably using a a custom data storage engine.
If we imagine that someone developed a webmail application similar to GMail that used an Oracle database on the back end, the standard architectural approach would be to have one schema that owned all the objects (i.e. WEBMAIL_OWNER). There would be a second schema that the middle tier application servers would use to connect to the database (i.e. WEBMAIL_APP). WEBMAIL_APP would be granted access to whatever objects in WEBMAIL_OWNER that the application needed. Ideally, that would be SELECT access on some tables and views and EXECUTE access on some stored procedures. When an end user logs in to the application via their browser, the middle tier application would either restrict what data that user would see or, preferrably, the database would be using VPD (virtual private database) to restrict what data the user can see and the middle tier would set the context appropriately so that the database knew what end user had logged in.
Justin

Similar Messages

  • Group Permissions using External Table

    I have a problem with using an external table for user group permissions.
    I am using OBI authentication but need to use an external table to manage the user’s group permissions. I created two RPD groups, GROUP1 and GROUP2. GROUP1 has access to TABLE1. GROUP2 has access to TABLE2. I created the initialization block with the following SQL:
    Select ‘GROUP’, groupname from groups_tab where username = ‘:USER’
    I also turned on row-wise initialization.
    I created a user, USER1, with access to both RPD groups. I also created corresponding Catalog Group (Settings  Administration  Manage Presentation Catalog Groups and Users  Create a new Catalog Group). I have two dashboard pages PAGE1 and PAGE2. GROUP1 has access to PAGE1 and GROUP2 has access to PAGE2. When I log in as USER1, I have a quick test on the My Dashboard page that displays the GROUP session variable (@{biServer.variables[‘NQ_SESSION.GROUP’]}). The variable displays that USER1 belongs to GROUP1; GROUP2. I still cannot see the dashboard pages PAGE1 and PAGE2. When I go to Answers I cannot see TABLE1 or TABLE2.
    Obviously, I must be missing a step somewhere. Any ideas?
    I have tried the Rittman Mead post (http://www.rittmanmead.com/2007/05/21/using-initialization-blocks-with-ldap-and-database-queries-to-control-authentication-and-authorization/) and I am still not getting the right results.
    Edited by: Canz on Feb 25, 2009 4:39 PM

    It's likely to be a permissioning setup issue rather than your Init Block setup which seems to be working. Start by granting your test user full permissions on the object you want and then start removing them gradually to see where you don't see the dashboard any more. I think you might be missing a Traverse privilege in your dashboard shared folders but I can't check all the possible conditions with seeing your web catalog. Also check the case of your Web Catalog groups and the ones you populate on the Init block.

  • Permissions disappearing from tables and views in SQL Management Studio

    As a CRM person, I sometimes have to update the database to cope with custom reports that I have written. Usually, I will
    Go into SQL Server Management Studio 2008
    Open the database
    Locate either the table or the view
    Right click on permissions
    Add in the role or user that's needed
    Grant them Select permissions
    This allows the report in CRM to access the database and this works.
    The problem I have is that after a certain amount of time, the user or role will disappear from the permissions meaning that the report will not run. Sometimes, this can be as soon as a couple of days or it can be months. It happens on views more than tables
    and, whilst it's not too difficult to put the permissions back, it is annoying for the users.
    I don't use SQL Server Management Studio very regularly, only to write a few queries and set up these permissions so I'm not sure if there's anything else in there that might be doing this. All suggestions would be very welcome.
    Thanks.

    Sounds like some process is removing/resetting permissions periodically
    if you are using enterprise edition you could try to catch this using auditing
    http://technet.microsoft.com/en-us/library/dd392015%28v=sql.100%29.aspx
    otherwise you would need some other custom tracing mechanism (SQL Trace, Extended Events, catching statements.. not fun)
    Andreas Wolter (Blog |
    Twitter)
    MCM - Microsoft Certified Master SQL Server 2008
    MCSM - Microsoft Certified Solutions Master Data Platform, SQL Server 2012
    www.andreas-wolter.com |
    www.SarpedonQualityLab.com

  • Changing permissions on a top level public folder WITHOUT affecting the folders underneath it in Exchange 2007

    Hello everyone,
    We have a pubilc folder we woudl like to lockdown to just the IT techs, but we want eveything below to function as it normally has been.  We have several folders underneath this folder with various permissions for our end users that we dont want changed. 
    How would you change the permissions on a top level folder without affecting (propagating) the folders underneath it?  Also, If I go into the "Administration" tab of the properties of the top level Public Folder I see an option to
    make this folder available to: "All users with access permission" or "Owners only". Would it be as simple to select "Owners only" here or will that restrict the down level folders as well to just the owners?
    Thanks,
    John

    Hi,
    You use PFDAVAdmin to customize your permission level for mailbox and public folder. This is good tool which helped me a lot in most of the permission issue for PF and Mailbox. Follow the below article for more detail of PFDAVAdmin Tool
    http://www.nigelboulton.co.uk/2010/12/delegating-and-propagating-exchange-folder-permissions-using-pfdavadmin/
    Exchange Queries

  • Deny Alter permissions to a table

    Hello,
    I want to deny alter permissions and permissions to insert, update and delete to a specific table to the users in our team. All the users should have only the select permission. I am using the statement for denying the delete permissions as
    DENY DELETE ON OBJECT::dbo.Table_To_Deny TO ABCD\UserName;
    This is throwing an error as Incorrect syntax near '\'. I also tried just by putting username but no luck. I have no option to put the table in seperate readonly database.
    Please help.
    Thanks

    Why DENY?  Users don't have permissions until you grant them.  Just don't grant these users permissions to do things they shouldn't do.
    Your syntax is invalid because of the '\', exactly as the error states.  The deny would look something like
    deny delete on [SchemaName].[TableName] to [userName]
    David
    David http://blogs.msdn.com/b/dbrowne/

  • Created a user with permissions to one table, but unable to access the table

    I've tried to create a Login that will have access to a single table from a few different databases.
    When I try and query the table, using the created Login I get the following error:
    "The server principal "log_Reader" is not able to access the database "MyDB" under the current security context."
    Here's the SQL I used to create the Login/User:
    USE MASTER
    GO
    CREATE LOGIN log_Reader
    WITH PASSWORD = '<password>'
    GO
    USE DB1
    GO
    CREATE USER log_Reader FOR LOGIN log_Reader
    GRANT SELECT ON dbo.logtable TO log_Reader
    USE DB2
    GO
    CREATE USER log_Reader FOR LOGIN log_Reader
    GRANT SELECT ON dbo.logtable TO log_Reader
    USE DB3
    GO
    CREATE USER log_Reader FOR LOGIN log_Reader
    GRANT SELECT ON dbo.logtable TO log_Reader
    USE DB4
    GO
    CREATE USER log_Reader FOR LOGIN log_Reader
    GRANT SELECT ON dbo.logtable TO log_Reader
    Does anyone have any ideas what I've missed ?
    Thanks, Jason
    MCITP BI Developer - MCTS SQL Server (http://bichopsuey.wordpress.com/)

    I cannot reproduce the error, can you run my script?
    USE [master]
    GO
    CREATE LOGIN [test1] WITH PASSWORD=N'test',
     DEFAULT_DATABASE=[master], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
    GO
    USE [B]
    GO
    CREATE TABLE [dbo].[t1](
    [c] [int] NULL,
    [c2] [char](1) NULL
    ) ON [PRIMARY]
    CREATE USER [test1] FOR LOGIN [test1] WITH DEFAULT_SCHEMA=[dbo]
    GO
    GRANT SELECT ON [t1] TO [test1]
    EXECUTE AS USER = 'test1';
    --Use B database
    SELECT * FROM [t1] ---works
    REVERT
    USE master
    GO
    EXECUTE AS USER = 'test1';
    SELECT * FROM B.dbo.[t1] ---works
    REVERT
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to make a table of the user to non public privilege?

    Hi all,
    im working with an RAD program and using oracle as the database. currently im on db 10g. I am able to connect to the db but the problem is it shows other users table. It is not only showing the tables of the user i connected to.
    this is a problem since it will load other users' table which i dont need in my project.
    now i've post around the forum of the RAD program regarding this and a particular user mentioned that he had the similar problem and it's probably because the all those tables showing up is public.
    im getting tables from sys,sytem,syman and other preinstalled db user which i dont need to list out for my project.
    is there really a condition where these tables are public? if so, how can i change it to private? any appropriate query would help.
    i dont want it to show up on my RAD program all those unnecessary tables when i connect to one user for example user1.
    anyone can help me out?
    Thnx.

    T101_cyberdyne wrote:
    Balazs Papp wrote:
    in Oracle, there is a special role, called PUBLIC
    anything granted to this role will be applied to every user (obviously, its PUBLIC)
    for example SYSTEM.HELP is a "public" table, every user can read it without any permissions granted
    you can check this with a query like this:
    select * from dba_tab_privs where grantee='PUBLIC' and table_name='HELP';
    revoking such permissions from the PUBLIC role is not recommended at all, as they are required for basic operation
    disabling the PUBLIC role for a specific user is not possible as per the following note: Is it possible to exclude a user from PUBLIC scope? [ID 156303.1]So are you saying i'm stuck and there's nothing i could do to prevent these public table from showing?
    well,this is dissapointing.I guess you need to step back and ask why this is a "problem". So far you've only indicated that you consider to BE a problem, but not WHY. Perhaps you are starting from a flawed assumption.

  • How to find permissions of a particular user on a table

    Hi
    every body i have requirement to check the permissions of a particular user on a table ,
    requirement is i am building a query builder ,wherein i have to load all the tables from database ,before loading the tables i need to check whether the user looged in as select permissions on that table ,
    how can this be achieved

    Here is an article with a list of privilege related dictionary views
    How do I find out which users have the rights, or privileges, to access a given object ? http://www.jlcomp.demon.co.uk/faq/privileges.html
    HTH -- Mark D Powell --

  • Grant table permissions

    Hi
    I have created a function that loops through the tables in a given schema and returns a table with the number of instances a given string appears in each column.
    (s_entry IN varchar2, s_ow in varchar2)
    return ind_field_value_table pipelined
    IS
    found_count number(10);
    t_return ind_field_value := ind_field_value(null, null, null, null);
    l_query varchar2(200);
    l_query_debug varchar(200);
    begin
    l_query := 'select count(column_name) from owner.table_name where column_name like ''%entry%'' ';
    dbms_output.put_line(l_query);
    for cur in (select owner, table_name, column_name
    from all_tab_columns
    where owner = s_ow and
    (Data_type = 'CHAR' OR Data_type = 'NCHAR' OR Data_type = 'NVARCHAR2' OR Data_type = 'VARCHAR2')
    Order by owner, table_name, column_name)
    loop
           begin
           l_query_debug := replace(replace(replace(replace(l_query, 'column_name', cur.column_name), 'owner', cur.owner), 'entry', s_entry), 'table_name', cur.table_name);
           dbms_output.put_line(l_query_debug);      
           execute immediate l_query_debug into found_count;
           exception when others then dbms_output.put_line(sqlerrm||' '||l_query_debug);
           end;
           found_count := nvl(found_count, 0);
              t_return.S_OWNER := cur.owner;
              t_return.s_table := cur.table_name;
              t_return.s_field := cur.column_name;
              t_return.s_count := found_count;
              pipe row(t_return);
    end loop;
    return;
    end;I can run the function like this
    select * from table(att_con.fn_find_field_entries('TUK-183442', 'APPS'))the problem i am having is the function only looks at a fraction of the tables in the schema
    so schema apps has lots of tables yet the function only looks at 4 of them and then stops.
    will this be bacause i havent granted read permissions to the tables? if so how will i do that?
    thanks in advance

    Hi;
    Please use select grant for 4 tables and retest issue
    Regard
    Helios

  • I don't have the option to create a new table in my database

    Hi, I have SQL 2014, for some reason, a few weeks ago I was able to create a new table for my databases, now, I don't have the option to do so, all I get when I right click on tables is "Tables..." instead of "New Table", when I select
    "Tables..." it allows me to write my codes but it doesn't save except in a text files witch doesn't want to open when I want to resume my work.
    Is there any option in SQL to activate the "New Table" by right clicking on Tables? I have all the rights and permissions available to my use as it's my computer and my own server. 
    To fix the issue I tried
    -Re-installing SQL
    -Changed for 4 different versions
    -Allowing more than necessary permissions 
    -Making it public to use (it's only to test it, anyway, I'm in the learning phase)
    Any kind of help or advice will be welcome and much appreciated.
    Thank you!

    I don't know the reason why you are experiencing this, so what I am describing below are just some steps that you can take to diagnose the problem if it is related to a permissions issue.
    1. If you are not already on the computer where SQL Server is installed, login on that box and launch SQL Server Management Studio and run it as Administrator.
    2. Connect to the Server and open up the object explorer and expand the Security node that is directly under the Sever tab.
    3. Under logins, find your login, right-click properties and see what kind of server level permissions you have, and which databases you are mapped to and what kind of permissions you have on those.
    It may just be that this is not related to permissions at all, but I can't think of what that would be. To test whether it is a SSMS GUI problem or not, open up a query window and select a database on which you think you have permissions to create tables.
    Then create a test table using T-SQL, for example:
    create table dbo.MyTestTable( col1 int);

  • Executing spatial queries on someone else's tables

    I am trying to execute a spatial
    query using a table owned by
    someone else.
    The SQL is...
    select a.plancoupe, a.coupecrop, a.ha
    from dba1.coupes a, dba1.coupes b
    where b.plancoupe = 'CM004H' and
    mdsys.sdo_within_distance(a.geom,b.geom,
    'distance=1000 querytype=WINDOW')
    = 'TRUE'
    The query works fine when I am connected
    as dba1, but when I connect as someone
    else I get...
    ERROR at line 1:
    ORA-29902: error in executing ODCIIndexStart() routine
    ORA-13211: failed to tessellate the window object
    ORA-13209: internal error while reading SDO_INDEX_METADATA table
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD", line 73
    ORA-06512: at line 1
    I have granted SELECT permissions on the
    table in question to PUBLIC and also to
    dba1.sdo_geom_metadata and the spatial
    index table generated by the spatial
    indexing creation routines...
    Any ideas?
    regards
    SImon

    Hi Simon,
    From your e-mail below, I assume you are
    running Oracle 8.1.5.
    Here is what you need to do for 8.1.5.
    Hope this helps.
    Please let me know if you have any questions. Thanks.
    Dan
    ======
    In Oracle 8.1.6, your query will work
    if you do the following:
    1) Grant select on dba1.coupes
    2) Grant select on the spatial index
    table created on dba1.coupes
    In Oracle 8.1.5 ONLY, do steps 3 and 4:
    3) In addition to step 1 and 2 above,
    grant select on sdo_geom_metadata
    4) As the Oracle MDSYS user, you must run
    the following:
    connect mdsys/mdsys
    drop view sdo_index_metadata;
    create view sdo_index_metadata as
    select SDO_INDEX_OWNER, SDO_INDEX_NAME, SDO_INDEX_TABLE, SDO_INDEX_PRIMARY,
    SDO_TSNAME, SDO_COLUMN_NAME,
    SDO_LEVEL, SDO_NUMTILES,
    SDO_MAXLEVEL, SDO_COMMIT_INTERVAL,
    SDO_FIXED_META,
    SDO_TABLESPACE,
    SDO_INITIAL_EXTENT,
    SDO_NEXT_EXTENT,
    SDO_PCTINCREASE,
    SDO_MIN_EXTENTS,
    SDO_MAX_EXTENTS
    from SDO_INDEX_METADATA_TABLE
    where
    (exists
    (select table_name from all_tables
    where table_name=sdo_index_table and owner=sdo_index_owner)
    or
    exists
    (select view_name from all_views
    where view_name=sdo_index_table and owner=sdo_index_owner)
    or
    exists
    (select table_name from all_object_tables
    where table_name=sdo_index_table and owner=sdo_index_owner)
    grant select on sdo_index_metadata to public;
    null

  • Security Role Won't Grant Table Access

    When I log into the my production server there only two tables (dbperties & Trans) showing under tables when the  Dbase is selected.  I checked the server roles and I only have “Public” access. I can see the views that have been
    created. I have been added to the Group membership and added to one of our vendor groups but  I still can't see the additional tables. 
    However, when I log into the Development site it’s showing all the iMIS tables and I have both “Public” & “SysAdmin” roles.
    Should I be added to the
    “SysAdmin” role as well?
    Thanks in advance.
    DJ

    Hi,
    According to your description, as Erland’s post, if you are a member of Active Directory groups with administrative privileges , it means that you have full permissions on the Windows-level objects, such as the rights to read/write folders, but it does not
    mean that your account is administrator in SQL Server except for creating a login name with this account and granting to sysadmin role.
    Usually, the members of sysadmin role have administrative privileges on all server databases and resources, and can perform any activity in SQL Server. Generally, DBA is granted the sysadmin permission. If you need to perform any activity in SQL Server,
    your account should be added to the sysadmin role. You can right-click sysadmin in Object Explorer/Security/Server Roles in SQL Server Management Studio (SSMS) ,then add your account. Please note that only a sysadmin member has  rights to grant users
    different permissions in SQL Server.
    Public role is a special database role that exists in every user database, and by default, every database user is automatically assigned to this built-in role. If you just need to access and modify all the objects of a database , it’s not necessary to being
    a sysadmin member in SQL Server , you can add your account to the db_owner database role.
    For more information, please review the following this article: Server and Database Roles in SQL Server.
    Thanks
    Lydia Zhang

  • Use ComboBox TableCellEditor  - values are not saved to the table model

    Hi,
    I got a combobox cell editor that uses to edit one of the columns.
    And i got an ok button that uses to collect the data from the table and save it to the db.
    In case i started editing of a cell and the editor is still displayed- if i will click on the button the data that will be colected from the table model will not contained the updated value in the cell editor.
    In this case the user think his changes were saved but the last updated field is not updated.
    Is this a bug i got in the cell editor or this is the normal behaviour?
    Can it be fixed? (So that if the cell is in the middle of editing the value that will be saved is the last value that was selected).
    public class PriorityCellEditor extends StandardComboBox implements TableCellEditor {
        private boolean isEditMode=false;
         * A list of eventlisteners to call when an event is fired
        private EventListenerList listenerList = new EventListenerList();
         * the table model
        public StbAreaClusterPriorityCellEditor(boolean isEditMode) {
            super(StbAreaMapper.clustersPriorities);
            setEditMode(isEditMode);
            setEditable(false);
            this.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
            setAlignmentX(Component.LEFT_ALIGNMENT);
        public boolean isEditMode() {
            return isEditMode;
        public void setEditMode(boolean editMode) {
            isEditMode = editMode;
            setEnabled(editMode);
        public Component getTableCellEditorComponent(JTable table, Object value,boolean isSelecte, int row, int column) {
            int selectedIndex;
            if (isSelecte) {
                setForeground(table.getSelectionForeground());
                setBackground(table.getSelectionBackground());
            } else {
                setForeground(table.getForeground());
                setBackground(table.getBackground());
            if(value instanceof String){
                selectedIndex=StbAreaMapper.mapGuiPriorityDescToGuiCode((String)value);
                setSelectedIndex(selectedIndex);
            return this;
        public void cancelCellEditing() {
            fireEditingCanceled();
        public Object getCellEditorValue() {
            return getSelectedItem();
        public boolean isCellEditable(EventObject anEvent) {
            return isEditMode;
        public boolean shouldSelectCell(EventObject anEvent) {
            return false;
        public boolean stopCellEditing() {
            fireEditingStopped();
            return true;
         * Adds a new cellEditorListener to this cellEditor
        public void addCellEditorListener(CellEditorListener l) {
            listenerList.add(CellEditorListener.class, l);
         * Removes a cellEditorListener from this cellEditor
        public void removeCellEditorListener(CellEditorListener l) {
            listenerList.remove(CellEditorListener.class, l);
         * Notify all listeners that have registered interest for notification on
         * this event type.
         * @see javax.swing.event.EventListenerList
        protected void fireEditingStopped() {
            // Guaranteed to return a non-null array
            Object[] listeners = listenerList.getListenerList();
            // Process the listeners last to first, notifying
            // those that are interested in this event
            for (int i = listeners.length - 2; i >= 0; i -= 2) {
                if (listeners[i] == CellEditorListener.class) {
                    ((CellEditorListener) listeners[i + 1]).editingStopped(
                            new ChangeEvent(this));
         * Notify all listeners that have registered interest for notification on
         * this event type.
         * @see javax.swing.event.EventListenerList
        protected void fireEditingCanceled() {
            // Guaranteed to return a non-null array
            Object[] listeners = listenerList.getListenerList();
            // Process the listeners last to first, notifying those that are interested in this event
            for (int i = listeners.length - 2; i >= 0; i -= 2) {
                if (listeners[i] == CellEditorListener.class) {
                    ((CellEditorListener) listeners[i + 1]).editingCanceled(new ChangeEvent(this));
    }

    Try this
    yourTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);

  • Why table getWidth and setWidth is not working when resize column the table

    hi all,
    i want to know why the setWidth is not working in the following code,
    try to uncomment the code in columnMarginChanged method and run it wont resize the table.
    i cont set width(using setWidth) of the other table column using getWidth of the main table column.
    and i want to resize the right side columns only (you can check when you resize the any column the left and right side columns also resizing)
    any suggestions could be helpful.
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.Box;
    import javax.swing.BoxLayout;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTable;
    import javax.swing.SwingUtilities;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ListSelectionEvent;
    import javax.swing.event.TableColumnModelEvent;
    import javax.swing.event.TableColumnModelListener;
    import javax.swing.table.TableColumnModel;
    public class SynTableResize extends JFrame implements TableColumnModelListener, ActionListener
        JTable  table1       = new JTable(5, 5);
        JTable  table2       = new JTable(5, 5);
        JTable  table3       = new JTable(5, 5);
        JButton btn          = new JButton("refresh");
        JPanel  pnlcontainer = new JPanel();
        public SynTableResize()
            setLayout(new BorderLayout());
            pnlcontainer.setLayout(new BoxLayout(pnlcontainer, BoxLayout.Y_AXIS));
            pnlcontainer.add(table1.getTableHeader());
            pnlcontainer.add(Box.createVerticalStrut(5));
            pnlcontainer.add(table2);
            pnlcontainer.add(Box.createVerticalStrut(5));
            pnlcontainer.add(table3);
            table2.setTableHeader(null);
            table3.setTableHeader(null);
            table1.getColumnModel().addColumnModelListener(this);
            table3.setColumnModel(table1.getColumnModel());
            table2.setColumnModel(table1.getColumnModel());
            table2.getColumnModel().addColumnModelListener(table1);
            table3.getColumnModel().addColumnModelListener(table1);
            btn.addActionListener(this);
            getContentPane().add(pnlcontainer, BorderLayout.CENTER);
            getContentPane().add(btn, BorderLayout.SOUTH);
            setSize(new Dimension(400, 400));
            setVisible(true);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
        public static void main(String[] args)
            new SynTableResize();
        public void columnAdded(TableColumnModelEvent e)
        public void columnMarginChanged(ChangeEvent e)
            TableColumnModel tcm = table1.getColumnModel();
            int columns = tcm.getColumnCount();
            for (int i = 0; i < columns; i++)
                table2.getColumnModel().getColumn(i).setPreferredWidth(tcm.getColumn(i).getWidth());
                table3.getColumnModel().getColumn(i).setPreferredWidth(tcm.getColumn(i).getWidth());
                // the following commented code wont work.
    //            table2.getColumnModel().getColumn(i).setPreferredWidth(tcm.getColumn(i).getPreferredWidth());
    //            table3.getColumnModel().getColumn(i).setPreferredWidth(tcm.getColumn(i).getPreferredWidth());
    //            table2.getColumnModel().getColumn(i).setWidth(tcm.getColumn(i).getWidth());
    //            table3.getColumnModel().getColumn(i).setWidth(tcm.getColumn(i).getWidth());
            SwingUtilities.invokeLater(new Runnable()
                public void run()
                    table2.revalidate();
                    table3.revalidate();
        public void columnMoved(TableColumnModelEvent e)
        public void columnRemoved(TableColumnModelEvent e)
        public void columnSelectionChanged(ListSelectionEvent e)
        public void actionPerformed(ActionEvent e)
            JTable table = new JTable(5, 5);
            table.setColumnModel(table1.getColumnModel());
            table.getColumnModel().addColumnModelListener(table1);
            pnlcontainer.add(Box.createVerticalStrut(5));
            pnlcontainer.add(table);
            pnlcontainer.validate();
            pnlcontainer.repaint();
    }thanks
    dayananda b v

    hi,
    thanks for your replay,
    yes i know that, you can check the following code it works fine.
    actually what i want is, when i resize table column it shold not automaticaly reszie when table resized and i dont want horizontal scroll bar, meaning that all table columns should resize with in the table size(say width 300)
    if i make table autoresize off than horizontal scroll bar will appear and the other columns moved and i want scroll to view other columns.
    please suggest me some way doing it, i tried with doLayout() no help,
    doLayout() method only can be used when table resizes. first off all i want to restrict table resizing with in the limited size
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import javax.swing.Box;
    import javax.swing.BoxLayout;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.event.ChangeEvent;
    import javax.swing.table.TableColumnModel;
    public class TempSycnTable extends JFrame
        JTable  table1       = new JTable(5, 5);
        MyTable table2       = new MyTable(5, 5);
        MyTable table3       = new MyTable(5, 5);
        JPanel  pnlcontainer = new JPanel();
        public TempSycnTable()
            JScrollPane src2 = new JScrollPane(table2);
            JScrollPane src3 = new JScrollPane(table3);
    //        table1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    //        table2.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    //        table3.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    //        src2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    //        src3.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
            table2.setTableHeader(null);
            table3.setTableHeader(null);
            table3.setColumnModel(table1.getColumnModel());
            table2.setColumnModel(table1.getColumnModel());
            table2.getColumnModel().addColumnModelListener(table1);
            table3.getColumnModel().addColumnModelListener(table1);
            table2.setTableHeader(null);
            table3.setTableHeader(null);
            setLayout(new BorderLayout());
            pnlcontainer.setLayout(new BoxLayout(pnlcontainer, BoxLayout.Y_AXIS));
            pnlcontainer.add(table1.getTableHeader());
            pnlcontainer.add(Box.createVerticalStrut(5));
            pnlcontainer.add(src2);
            pnlcontainer.add(Box.createVerticalStrut(5));
            pnlcontainer.add(src3);
            getContentPane().add(pnlcontainer, BorderLayout.CENTER);
            setSize(new Dimension(300, 300));
            setVisible(true);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
        public static void main(String[] args)
            new TempSycnTable();
        class MyTable extends JTable
            public MyTable()
                super();
            public MyTable(int numRows, int numColumns)
                super(numRows, numColumns);
            public void columnMarginChanged(ChangeEvent event)
                final TableColumnModel eventModel = table1.getColumnModel();
                final TableColumnModel thisModel = getColumnModel();
                final int columnCount = eventModel.getColumnCount();
                for (int i = 0; i < columnCount; i++)
                    thisModel.getColumn(i).setWidth(eventModel.getColumn(i).getWidth());
                repaint();
    }thanks
    daya

  • Store value in data model without showing it in table

    Hi,
    How can I store something in my table model without showing it in my table? I have an arraylist which contains a list of my own data objects. I have my own table model like
    public class MyTableModel extends AbstractTableModel {
                  public Object getValueAt(int row, int col) {
                   TableDataObject tdo  = (TableDataObject) data.get(row);
                   switch(col) {
                        case 0:
                             return tdo.getFoo();
                                     default:
                                             break;
    }my "hidden" value is stored in the data list...but I have to get the hidden value from my table model, not from my arraylist.

    Nothing to it, but to do it:
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class ColumnModelExample {
        public static void main(String[] args) {
            Object[] columnNames = {"hidden", "column 1", "column 2"};
            Object[][] rowData = {
                {"hidden 0","row 0, col 1","row 0, col 2"},
                {"hidden 1","row 1, col 1","row 1, col 2"},
            TableModel model = new DefaultTableModel(rowData, columnNames);
            JTable table = new JTable(model);
            TableColumnModel columnModel = table.getColumnModel();
            columnModel.removeColumn(columnModel.getColumn(0));
            JFrame f = new JFrame("ColumnModelExample");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(new JScrollPane(table));
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }One typical use of this is for displaying the records of a database table, where you don't want to
    show the user a sequence column which would only confuse the user...

Maybe you are looking for