Slash in db username and log in from java

Hi,
I have a problem logging in using jdbc when db username has slash. Oracle 10g allows create users with slash in login but I cannot login to such account using JAVA and jdbc.
Any suggestion? Changing db username is not an option.
Edited by: Klacia on Jun 27, 2011 2:03 AM

just a simple test class:
public class JDBCTest {
     private static String userName = "test/01";
     private static String password = "test";
     public static void main(String[] args) {
          try {
               Connection conn = getConnection();
          } catch (SQLException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
          } catch (ClassNotFoundException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
     public static Connection getConnection() throws SQLException, ClassNotFoundException {
          DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
          Connection conn = null;
          Properties connectionProps = new Properties();
          connectionProps.put("user", userName);
          connectionProps.put("password", password);
          String url = "jdbc:oracle:thin:@//192.168.1.17:1521/xe";
          conn = DriverManager.getConnection(url, connectionProps);
          System.out.println("Connected to database");
          return conn;
I found that special characters can be escape: http://msdn.microsoft.com/en-us/library/ms378428(v=sql.90).aspx
but finally I found solution. It's wierd but it works. just put login in quots:
private static String userName = "\"test/01\"";

Similar Messages

  • Exception when connecting to Reporting and Analysis services from Java API

    Hello,
    I'm trying to connect to Hyperion Reporting and Analysis services from Java API using [Developer's guide|http://www.bidw.in/docs/hs_developer.pdf] .
    I get this error:
    com.sqribe.rm.ReportMartException: com/hyperion/css/CSSException
         at com.sqribe.rm.SessionImpl.convertError(Unknown Source)
         at com.sqribe.rm.AASessionImpl.open(Unknown Source)
         at com.sqribe.rm.AASessionImpl.internalInit(Unknown Source)
         at com.sqribe.rm.AASessionImpl.<init>(Unknown Source)
         at com.sqribe.rm.SessionFactory.getInstance(Unknown Source)
         ...My code:
    String user = "user";
    String pwd = "password";
    String host = "my.hyperion.server";
    int port = 6800;
    try {
         Session theSession = SessionFactory.getInstance(user, pwd, host, port);
         Repository theRepository = theSession.getRepository();
    } catch (UserValidationException e) {
         e.printStackTrace();
    } catch (UnknownReportMartException e) {
         e.printStackTrace();
    } catch (ReportMartException e) {
         e.printStackTrace();
    }I have tried to look at my services running, and it all looks OK. I've checked user/passowrd/port for GSM. What can be wrong?
    I also tried to run samples from \BIPlus\SDK\samples\java, e.g. Login.java:
    #> java Login user password my.hyperion.server 6800with this effect
    com.sqribe.rm.ReportMartException: SystemExceptionError
            at com.sqribe.rm.SessionImpl.convertError(Unknown Source)
            at com.sqribe.rm.AASessionImpl.open(Unknown Source)
            at com.sqribe.rm.AASessionImpl.internalInit(Unknown Source)
            at com.sqribe.rm.AASessionImpl.<init>(Unknown Source)
            at com.sqribe.rm.SessionFactory.getInstance(Unknown Source)
            at Login.<init>(Login.java:36)
            at Login.main(Login.java:69)I'm sure that I'm connecting to the server because when put wrong passowrd or user as input to Login class I get this:
    com.sqribe.rm.ReportMartException: AUTHEN_CSSLoginFailed
            at com.sqribe.rm.SessionImpl.convertError(Unknown Source)
            at com.sqribe.rm.AASessionImpl.open(Unknown Source)
            at com.sqribe.rm.AASessionImpl.internalInit(Unknown Source)
            at com.sqribe.rm.AASessionImpl.<init>(Unknown Source)
            at com.sqribe.rm.SessionFactory.getInstance(Unknown Source)
            at Login.<init>(Login.java:36)
            at Login.main(Login.java:69)so it is there but something is wrong later. Any idea what?
    Please help.
    regards,
    Pawel
    Edited by: Paoro on 2010-09-27 02:02

    HI,
    I am getting the same error while running the Login file, Did any one resolve this issue?
    Please share the solution.
    Thanks.

  • How can i clear the usernames and passwords history from all login websites?

    how can i clear the usernames and passwords in the log in history of the websites? example when i want to login to my facebook i always type first letter of my e-mail and it comes with the passwords because before i put remember my password, and in other websites so, i just need to delete all this login history and it's not working from the clear everything !!! :S any idea please !! thanks in advance :)

    See:
    http://kb.mozillazine.org/Deleting_autocomplete_entries
    http://kb.mozillazine.org/Password_Manager

  • Username and password getting from one context to another context

    Hi all,
    In sample.ear have single sign on.
    i have two war files first .war and second.war.
    But different database for every war.
    first.war ==> db1[database]
    second.war ==> db2[database]
    Now i logged in to the first.war .
    if i want to go second.war using same username and password.
    how can i get the same username and password from first.war to second.war.
    Now i am using to send the username and password thorough hidden box..

    Hi,
    Since u r saying single sign on, u can provide a login at the simple itself.Then at one point u can access first, second applications from simple and u can pass the username, password to the applications from that page easily.
    Hope this helps.
    Cheers,
    Mouli.

  • Accessing username and group name from an external app

    How can I access the user name and group name from an external app..? Where is that stored..?
    Thanks
    Fernando

    Post Author: pvierheilig
    CA Forum: Crystal Reports
    Each BOE document has a unique ID.  Knowing that will allow you to access it via a URL while passing required login credentials as well, if I recall correctly.  However, your very best bet is to review the SDK.

  • How to insert into mysql the creation time and modification time from java?

    first how?
    Second what is better from create the date from java or do it from mysql?
    thanks in advace
    Pedro

    One way is to use the GetDate function in mysql. This will set the date as you insert data. insert into table(date) values(getdate())
    Anytime you modifiy the table just call the function again and update its fields.
    Dont know which is beter to do. In java or on the database side.

  • Unix and dos commands from Java

    How can I issue a unix command from a java program eg: setenv
    help would be appreciated

    setenv is a C shell builtin command. And it wouldn't make any sense to execute setenv from Java anyway, because the environment variable changes would only apply to that shell and possibly (if the variable is exported) to subprocesses.
    But look at the java.lang.Runtime.exec() method and the Process class.
    (http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html)
    Be careful of input and output to the commands. If the command produces output and you don't read it from the getOutputStream(), your command will hang forever when the OS stdio buffer fills up. This can cause terrible random hangs. Search the forums for more on how to handle input and output. You'll probably need multiple threads to read/write the different streams. (stderr, stdout, stdin)

  • Copy usernames and file permissions from old workgroup to new Active Directory

    Hi,
    I have a Windows Server 2003 R2 with about 60 users, 100 shared folders and 5000 subfolders. Each folder has share and protection permissions. Each subfolder has protection permissions. No active directory.
    I need to install Windows Server 2012 R2 (as Primary Domain Controller) and re-create
    the same users (which can have different guid but with the same username as the old server)
    the same shared folders, with the same permission as the old server granted to the users
    the same subfolders, with the same permission as the old server granted to the users
     all under Active Directory.
    Is there a way to automate these steps?
    Thanks!

    Look in script repository for scripts that export local users and groups.
    You will have to learn how these two systems work and develop a script / method for translating between the two systems.  It is very dependent on what has been don on old system.  Using USMT and MDT would be the best. 
    Post in the deployment forum for instructions on how to use the MDT to migrate users in a batch.  You would start by adding the 2003 server to the 2012 domain and then the MDT can be customized to do the move.
    https://technet.microsoft.com/en-us/windows/dn475741.aspx?f=255&MSPPError=-2147217396
    https://social.technet.microsoft.com/Forums/en-US/home?forum=mdt
    ¯\_(ツ)_/¯

  • How to detect windows startup and appdata folder from java?

    To read the startup and appdata path I execute the following registry command and capture the foldername from the output:
    reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Startup
    The path contains the windows users name which may contain international character. The inputstream used to capture the path uses the
    default encoding of the platform but it seems to get it wrong - international characters looks wrong and any subsequent use of the path
    throws FileNotFoundException.
    What is the right way to detect theese folders or is there a fix to my current folder detection shown below?
         private static final String RESULT_TOKEN_REGSZ = "REG_SZ";
              String value = null;
              Process process = Runtime.getRuntime().exec(windowsCommand);
              BufferedReader in = new BufferedReader(new InputStreamReader(process
                        .getInputStream()));
              String line = null;
              StringBuilder sb = new StringBuilder(250);
              while ((line = in.readLine()) != null) {
                   sb.append(line);
              String capture = sb.toString();
              int pos = capture.indexOf(RESULT_TOKEN_REGSZ);
              if (pos != -1) {
                   value = capture.substring(pos + RESULT_TOKEN_REGSZ.length()).trim();
              }

    To answer my original post.
    I found what I believe is a robust (although somewhat complex if you havent touched C code i more than 10 years like me) method to read the windows registry keys.
    I call the following native windows unicode functions using the JNA api:
    advapi32.RegOpenKeyExW
    advapi32.RegQueryValueExW
    Notice the W at the end - those functions encode character strings using wide character encoding UTF-16LE (Little Endian). Now nothing is "lost in translation"...
    Wont post the kode here since it spans multiple srcfiles and is rather involved - but there are many good samples on the JNA site.

  • Writing non-latin Character to Log file from Java application

    Hi Everyone,
    I'm encountering a very strange localization issue.
    I'm executing the following code from a J2EE application (although the behavior is replicated exactly from a Java console application):
    File testFile = new File("D:\\Temp\\blah.txt");
    testFile.createNewFile();
    Writer output = null;
    try {
    output = new BufferedWriter( new FileWriter(testFile) );
    output.write( "אחד שתיים שלוש" ); // Non-Latin characters
    output.write("one two three");
    finally {
    if (output != null) output.close();
    I'm writing non-latin characters (Hebrew in my case) to the file, but these characters are written as question marks:
    ??? ????? ????one two three
    I'm running the project with the following java arguments:
    -Dfile.encoding=UTF8 -Duser.region=IL -Duser.language=he
    And the Project Properties -> Compiler -> Character Encoding = UTF8
    Also, the local Windows Regional Settings are set to Israel / Hebrew.
    Can someone please help with this issue?
    I've tried this with UTF-8 (instead of UTF8) and still no results.
    I suspect this is a Java / Environment issue as it reproduces on a J2EE app and on a console app.
    Any help will be greatly appreciated.
    Thanks,
    Tal.

    You should open/close it somehow at every write from different processes.
    But I personally prefer different file names to your forced merging, though.

  • Hi I want  to control hardware and buid GUI from java help me

    hi after learning Swing now i want to control hardwares through parallel and serial ports means control switches ON and OFF i.e bits ON and OFF and as well as read the frequency from outside and shows in the crossponding percentage according to given factor.also read the temperature signal from thermocouples.
    please help me completely and give the correct versions of java technology which can i used for above purpose and with examples
    specially read from the port and then write after check the status of bits.
    thanks and reagards

    Java programs run within a virtual machine (JVM). They have very little concept of the computer on which they are running; they only see the VM and what information it provides.
    The JVM does not provide any information about the lower-level hardware, such as parallel and serial ports. On most modern operating systems, you'd have to jump through a few hoops even to get the native programs to do this job.
    The only option I see for you to do this in Java is to find a JNI library that allows you to do this for your target OS(es).

  • Read, Write and create files from java applet.

    Dear All,
    I have created a two files. One is applet and one application file. I am creating a instance of application file in applet. Application file is used for reading, writing and creating files. When I invoke applet from broser it dipslays error wrt file access permission. From the forum search I know that we need to sign the applet / edit the java policy to run the code locally. Final delivery of my code should execute on different system. Its not web. I have created a html page on submitting the form it invokes applet to read the form values from param and needs to update the values in xml file located locally. Please help me on how I can proceed with this fix.
    Thanks in advance.

    Sorry if I have not stated the problem clearly. I need to update content to files hosted in local system using java applets.
    I belive there are two ways to achive that.One with jar signer and one with modifying the java policy file. But this application needs to be installed in different system locally as I have created a application with webpage as useinterface and need to update the content in local files on submission. Not sure on how to modify the java.policy files in each end user system and whats the value we need to update in java policy file. Please help me on the steps to be followed

  • Creating and running JARs from Java programs

    OK, I have been googling and searching, but this is something I cannot work out, so I raelly need some help.
    Basically, I am building a GUI app that would generate, compile and run java programs. And I also want to enable the users to create JARs they can later double-click if they want to run the program.
    I am using Runtime to compile programs and it works just fine. When I click on a button to create a JAR, my application creates one, but when I double-click on it, it can't find main and it exits. Now that is not so much unusual, but I am positive that my manifest file is OK, because when I run the same command from the command line, then I can click on the JAR file to run it.
    So what is the deal here? I mean, why would a JAR file created from the command line run and the one created through a GUI app using the very same command could not find main?
    Any help would be graetly appreciated.

    again, another unanswered question.
    BTW I'l keep bumping these until I get an answer that works. I have been up 3 hours now trying to get this sorted and it's something that netbeans is supposed to do on its own!?!?!?!?!
    Hello, SUN, is there anyone there???
    No, didn't think so.

  • Drag and Drop file FROM Java app TO native desktop

    I'm a litte new to Drag and Drop. After a few days of looking around I've been through enough examples to copy and paste some skeleton code and get it working in my own application.
    What I haven't gotten any answers to (after searching on google, newsgroups, and here) is if it's possible to drag something from a Java app to the desktop or file browser, and have java create a file there.
    I know you can drag text to native apps, so I was wondering if you could make a Transferable object that's different than StringSelection(), like a file stream or something.
    Thanks,
    Tristan

    Tristan,
    I am stuck in the same place. Perhaps we could work on this together.
    I am trying to drag a single item from a JList to a text editor, Word, etc. I have two problems:
    1) I can't seem to get just the item in the JList to drag. It wants to drag the entire JList component.
    2) How does one define the remote application as the drop target? Have not found any examples either.
    Is the drop target actually the system clipboard?
    Rp

  • Advice needed about JFrame and JDialog (moved from java programming)

    My main class in my application is a page where the user can choose to register or login. This class is a JFrame. If the user chooses to register, my register dialog is called up and the parent JFrame passed to the dialog:
    private void btnRegister_actionPerformed()
                    new Register(this);
              }Same happens for login. If the user chooses to login, my login dialog comes up and my main class JFrame is set as its parent. This is all fine because all the calling up is done in my main class, so i can just use 'this' to pass the JFrame.
    Now here is my problem. If the user successfully logs in, they should have access to control some events. Now i am not sure if it will be ok to make this new events class another JFrame, as it is practically the start of a new section in my application.
    Thats my first question. My second question is if i do make this events class a JDialog, is it bad coding not to give it a parent frame? Or would this be acceptable? My worries is passing the main class JFrame to a class which is only accessable by going through two other classes.
    Cheers for the advice

    It's Simple dude,
    Advice: Use JIternalFrame, for your purpose.
    And if u want to go with JDialog than u can do that in main method. Like when u call JDialog
    Register dialog = new Register(this);Check for login in Register class or what ever u want. Create new method like success
    private boolean isSuccess() {
    return success;
    } at Register Class. After Registeration change the variable boolean success value to true or false as per logic
    And add
    Register dialog = new Register(this);
    if(dialog.isSuccess()) {
    // Show loginDialg(this) or else
    }Regards,

Maybe you are looking for

  • Pages v4.0 (727) can't open or save .doc files

    Hello everyone, for a while now I haven't been able to open or save .doc files with Pages. When trying to open a .doc file I get the following message: "The document "example.doc" couldn't be opened." I have tried the following to solve the problem:

  • How to properly install External Hard Drive

    I'm trying to install my external eSATA hard drive on my 7216 HD DVR and it doesn't seem to be working. I get the notice to reboot the box and then I get the warning about it detecting the drive and that everything else on it will be deleted. I then

  • Base Value for Imports

    All SAP Gurus, While capturing / posting excise invoice for Imports, which value to be considered as base value? Is it the value of material only or some duties and other costs to be added over it to consider it as base value? In our case material va

  • [INS-20802] 11.2 Grid Infrastructure Configuration failed on Windows

    I had sucessfully installed the 11.2.0.1 grid infrastructure on two VM nodes with windows 2003R2. But when I was doing brand new installation of 11.2.0.1 grid infrastructure on the same OS on a two node clusters, it faile with the following errors: [

  • Mplayer fails to build

    Hello, I'm trying to get mplayer to build with arts, but I'm getting this error message: msmpeg4.c: In function `msmpeg4_encode_dc': msmpeg4.c:720: error: can't find a register in class `GENERAL_REGS' while reloading `asm' make[1]: *** [msmpeg4.o] Er