get() public method

public get ( java arg0 ) : global::java.lang.Object
arg0 java
return global::java.lang.Object
Esempio n. 1
0
        private string getDatabase(string NETConnectionStr)
        {

            char[] sp = new char[] { ';' };

            string[] segment = NETConnectionStr.Split(sp);


            //
            ConcurrentHashMap<string, string> map = new ConcurrentHashMap<string, string>();

            foreach (string sg in segment)
            {

                char[] sgp = new char[] { '=' };

                string[] s = sg.Split(sgp);

                //无密码时参数就1个长度
                if (s.Length == 1)
                {


                    map.put(s[0].Trim(), "");

                }
                else
                {

                    map.put(s[0].Trim(), s[1]);

                }
            }

            //

            database = map.get("database").ToString();

            return database;
        
        
        }
Esempio n. 2
0
        /**
         * java 
         * "jdbc:mysql://localhost:3306/mysql?user=root&password=12345678"
         * 
         * .net 
         * server=127.0.0.1;Port=3306;
            user id=root; password=NVfaQnXAZJaQJhW7;
            database=ultrax; pooling=false;charset=utf8
         */
        private string convertPathToJDBC(string NETConnectionStr)
        {
            char[] sp = new char[]{ ';' };            

            string[] segment = NETConnectionStr.Split(sp);
        
            //
            string JDBCConnectionStr = "jdbc:" + sql + "://";
        
            //
            ConcurrentHashMap<string, string> map = new ConcurrentHashMap<string, string>();
               
            foreach (string sg in segment) {

                char[] sgp = new char[] { '=' };

                string[] s = sg.Split(sgp);
            
                //无密码时参数就1个长度
                if(s.Length == 1)
                {
  
                
                    map.put(s[0].Trim(), "");
                
                }else{
                
                    map.put(s[0].Trim(), s[1]);
                
                }
            }
        
            //
            JDBCConnectionStr += map.get("server");
            JDBCConnectionStr += ":" + map.get("Port") + "/";
        
            JDBCConnectionStr += map.get("database") + "?user="******"database").ToString();
        
            JDBCConnectionStr += map.get("user id") + "&password="******"password") + "&charset=";
            JDBCConnectionStr += map.get("charset");
    
            return JDBCConnectionStr;
        }