How to set Password protection in excel using java

Dear all,
I have no idea to write a java program that how to set password protection in excel. Please give me some solution using java tools. Thank a lot!
Regards,
kzyo

Dear Bamkin ,
I used your code and paste it in my program. The error is as the follow:
Code:
     stmnt = c.createStatement();
               String query = "select StudentNumber, Email, New_Email_Address from [Sheet1$] where Len(New_Email_Address) > 0";
               System.out.println(query);
               rs = stmnt.executeQuery(query);
               stmnt.executeUpdate("SET PASSWORD=PASSWORD('Test')");
Error:
(Remark: Invalid SQL statement)
java.sql.SQLException: [Microsoft][ODBC Excel Driver] �����I SQL ���q���G�a����'DELETE'�A'INSERT'�A'PROCEDURE'�A'SELECT' �� 'UPDATE' �B
     at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
     at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
     at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3111)
     at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
     at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:288)
     at hk.gov.edb.util.ExcelHandle.updateNewEmail(ExcelHandle.java:414)
     at hk.gov.edb.core.AppMain.doUpdate(AppMain.java:369)
     at hk.gov.edb.core.AppMain$7.construct(AppMain.java:584)
     at hk.gov.edb.util.SwingWorker$2.run(SwingWorker.java:127)
     at java.lang.Thread.run(Thread.java:595)

Similar Messages

  • Reminder needed: how to set password protection  for all uses of  computer

    It's been a long time coming, but I feel that I need to limit the access to all materials on a Mac running OS 9.2.
    Is there a simple way that I can password protect the whole computer?
    Thanks for your time - and stay cool!

    Hi, Bruce -
    Try using Multiple Users to do that. One of its features is password access to use any account.
    This will provide a moderate level of security - however, a knowledgeable person will have little trouble defeating it.

  • Hi there, i have Q i have excel file it need to be block with password. Could you please explain how i make password protect to Excel document

    Hi there,
    i have Q i have excel file it need to be block with password. Could you please explain how i make password protect to Excel document
    Thanks

    On the File menu, click Save As.
    On the Tools menu, click General Options.
    Do either or both of the following:
    If you want users to enter a password before they can view the workbook, type a password in the Password to open box, and then click OK.
    If you want users to enter a password before they can save changes to the workbook, type a password in the Password to modify box.
    NOTE   Unlike passwords you specify in the Password to open box, passwords you specify in the Password to modify box are not encrypted. These passwords are only meant to give specific users permission to modify workbook data. For optimal password security, it's best to assign both passwords. An encrypted password to access the workbook, and one to provide specific users with permission to modify its content. IMPORTANT   Use strong passwords that combine uppercase and lowercase letters, numbers, and symbols. Weak passwords don't mix these elements. Strong password: Y6dh!et5. Weak password: House27. Use a strong password that you can remember so that you don't have to write it down.
    If you want to use a different encryption type, click Advanced, click the type you want in the Choose an encryption type list, and then click OK.
    If needed, specify the number of characters you want in the Choose a key length box.
    NOTE   Document property encryption is enabled by default for most encryption types and providers. It prevents unauthorized users from viewing summary and custom file properties (such as the author or any custom file information) in theProperties dialog box. When users right-click the password-protected file, and then click Properties, information won't be available on the Summary tab and Customtab. Authorized users, however, can open the file and view all file properties (Filemenu, Properties command). To disable document property encryption, clear theEncrypt document properties check box.
    Click OK.
    When prompted, retype your passwords to confirm them.
    Click Save.
    If prompted, click Yes to replace the existing workbook.
    NOTE   You can also secure a workbook with a password on the Security tab of the Options dialog box (Tools menu, Options command).

  • How to set Border in the Excel using UTL_FILE ?

    Hi all,
    Any one aware of
    How to set Border in the Excel using UTL_FILE ?
    Am doing excel creation from a stored procedure.
    Thanks
    Dora

    Hello Dora,
    if you need more than simple csv: at Re: How to save a query result and export it to, say excell? you can find links to different solutions. At least the package behind the second link supports defining your own formats (and has a tutorial how to do it).
    Regards
    Marcus

  • How to set password protection in iphone5 for yahoo mail app

    I have password protection for my iPhone5. Is it possible to set a seperate password protection for my Yahoo mail account?

    no. but if you protect your iPhone with a password, I don't think you need a separate one just for your email.

  • How to set the Date in excel through Java?

    now i am using
    cell.setCellValue(date);
    date is in format of "dd/MM/yyyy"
    But when it set on excel , it sets as number.
    I need the date as in same format as what i given.
    Assist me.

    Consult the docs of the API you're using. We can't say much about it because you didn't even mention the API used and it is also not recognizeable as part of any standard Sun Java API's. It might help to consult their own forum/mailinglist -if any- as well.

  • How to set schedule task in windows using java code

    Hi,
    i want to set the schedule task in windows os using the java code can any one help me on that
    can any one thinks i need to wright a dll file for that which set the schedule task for me which dll i can use in my java code.
    thanks in advance.

    Maybe this will help you?

  • How to set value of application item using Java script.

    I have created a textbox on page 0, on chnage of textbox i want to set the value of application item.
    How to write the code to set & get value of application item.
    Thanks,
    -Amit

    Hello Amit
    This would be a great place to start...
    JavaScript
    Alternatively, APEX 4.0 will make this sort of task declarative.
    Kind regards
    Simon Gadd

  • Set password to PDF file using ADS server

    How to set password to .PDF file using ADS(Adobe Development Service) server?
    Moderator Message: Not enough effort seen from OP. Thread Locked.
    Edited by: kishan P on Jul 14, 2011 11:51 AM

    Thanks for your prompt reply. Well forget about conversion but there should be a way to just password protect any PDF file, correct?
    We have a 3rd party tool which does that for our VB6 apps, I am surprised how come Acrobat SDK doesn't expose those Properties/Methods for VB6 model.
    Andy

  • I cannot figure out how to set my apple id to use: itunes (two of accounts), apps store and Itunes store. How do I make one password that will be recognixed by all these devices?

    I cannot figure out how to set my apple id to use: itunes (two of accounts), apps store and itunes store. How do I make one password that will be recognized by all these devices? My apple id is constantly not working.

    Hi Lrwill,
    If the apps that are on your son's iPad were purchased under his Dad's Apple ID, then signing your Apple ID onto the iPad will not help you with updating those apps.
    Also, if the iPad was sync'd with his Dad's iTunes library, then hooking it up to your computer/iTunes library, will require you to reset the iPad, and everything that was loaded under the other Library and Apple ID will be wiped out.
    Can you provide a little more info about what was set up under which Apple ID and what iTunes library the iPad was sync'd with?
    Cheers,
    GB

  • How to set password in obiee delivery content reports (pdf format)

    Hi
    Dear All
    i Need your help on the Obiee !
    i hvae one Requirement how to set password in obiee delivery content (pdf format) its possible. what are the things i to do
    Kindly Advice me
    Advance Thanks
    satya

    933154 wrote: My profile says PDF, config, report, settings says PDF and I get an Excel when I run screening reports. Very odd.You may want to make sure that the file where the system setting gets stored can be updated. In your <Intradoc_Dir>\urm\data\reportpublisher\config\config.hda file, there is a result set named "RPAdminConfigInfo". The third column of that result set should match the value being shown on the configuration settings page. I've changed the format value in the UI, and this file gets updated (and thus I'm getting my screening reports in the format specified in this config file.)
    933154 wrote: Also, I wasn't clear on the second part of the question. The Screening Reports appear to use the template INTERNALITEMDETAILRPTTEMPLATE. Is that configuration set somewhere? Is there any way to have the screening reports use a different template or is changing that template the only way to change the screening report layout?Templates are not configurable in that respect - the template name values being called for a service are hardwired in the code (you'd need to override in a component - just not worth the hassle). I'd either edit the existing rtf file, or just check in a new revision to the existing one if the differences are that profound. You'd still need to conform to the BI Publisher standards/methodology in either case.

  • How can I password protect pdf files that intend on email

    How can I password protect a pdf file that I intend on emailing?

    Hi kimberlyb5119003,
    To password protect a PDF file, you need to use Acrobat. For instructions, see Acrobat Help | Security
    Best,
    Sara

  • Hey guys, how can i password protect my files in external hard drive? I want to access those files both from mac and windows PC!

    Hey guys, how can i password protect my files in external hard drive? I want to access those files both from mac and windows PC!

    If you want a cross-platform solution that doesn't require the use of third-party software, use an external drive with hardware encryption. The device will have either a physical key or a numeric keypad. I don't have a specific recommendation.

  • How to set password for Local are connection?

    How to set password for Local are connection?

    do you mean the 802.1x authentication?
    check out links below:
    http://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst2950/software/release/12-1_9_ea1/configuration/guide/scg/Sw8021x.html
    http://technet.microsoft.com/en-us/network/bb545365.aspx
    Every second counts..make use of it. Disclaimer: This posting is provided AS IS with no warranties or guarantees and confers no rights.
    IT Stuff Quick Bytes

  • How to set password on email body in custom Email Template

    Hy,
    I have a Email Template customized in Email Definition>Design Console.
    I need send this 'Email Template' with the password user, but I don't know how to set the variable 'password' in the body of email.
    I searched in Varables>Targets>Variables, but I not found any think variable like password.
    Some has a idea about this? How to set password on email body?
    Regards,
    Piza

    You can use custom Java code. Refer the following:
    Email notification to users after they change their OIM password

Maybe you are looking for

  • Use of Tcode : GS01

    hi experts, I'm trying tcode : GS01, as far as i know it is used for hardcoding stuffs which is further used in programming. I want to know its steps to be used in my select queries. Thanks and regards, Gaurav

  • How to implement the schema validation with XSD in adapter module

    Dear All, I am trying to develop a EJB as the file adapter mudule. Please guide me how to implement the schema validation of the source message with XSD. Or provide me the relative resources about this task. Thanks & Regards, Red Edited by: Grace Chi

  • Managing memory

    Having just moved from PC to the Mac I cannot find a way to view and manage my memory as easily as I would have done with Windows Explorer. I am sure I must be missing something fundemental here but I'm not finding the world of the Apple as easy as t

  • Can't boot to any OS X Install Disk

    I have a strange problem and this is going to be long. I just added a 2007 MacPro to our Apple family and am having an issue that I can not get past. First, I bought it used and the gentleman that sold it to me described what he did to prep it for me

  • Query on Function Exit EXIT_SAPLIEL2_002

    Hi, When I try to instal an equipment at a Functional Location, internally the user exit IEQM0001 is executed. The function exit EXIT_SAPLIEL2_002 is one of the components available in the exit IEQM0001. I want to use this function module(EXIT_SAPLIE