JScript Sample: jscript/ado/webaccess/open.asp
   ASP Script
   Comments or Client-side Script
   HTML and Text

<%@ Language=JavaScript %>
<HTML>
<HEAD>
</HEAD>
<BODY>
<FORM method=post action=opencnn.asp name=form1>
    <TABLE width=100%  height=160>
       <TR><TD valign=top bgcolor="#a5bace" width=10%>
         <font size=+1><b>Database</b></font>
         <center><P>
           <A href="open.asp?Operator=NewDB">New</A><br>
            <A href="open.asp?Operator=OpenDB">Open</A></P></Center>
       </TD>
<%
operator = Request.QueryString("Operator") ;
if ( operator == "nothing" ) {%>
        <TD align=center bgcolor="#EEEEEE" width=90%> </TD>
<%} else if ( operator == "NewDB" ) {%>
       <TD align=center bgcolor="#EEEEEE" width=90%><b>
           <font size=+2>Presently, this function isn't supported.</font></b></TD>
<%} else if ( operator == "OpenDB" ) {
   path = Server.mappath("default.asp");
   pos = path.toLowerCase().indexOf("jscript");
   dbpath = path.substring(0,pos) + "database/CloudscapeDB";

    drvIdx = Request.QueryString("drvtxt");

    var DrvArry = new Array(14); //(17)
    DrvArry[0] = "--Please select a driver--";
    DrvArry[1] = "sun.jdbc.odbc.JdbcOdbcDriver (Access)";
    DrvArry[2] = "sun.jdbc.odbc.JdbcOdbcDriver (SQLServer)";
    DrvArry[3] = "oracle.jdbc.driver.OracleDriver (Oracle)";
    DrvArry[4] = "com.informix.jdbc.IfxDriver (Informix)";
    DrvArry[5] = "twz1.jdbc.mysql.jdbcMysqlDriver (MySQL)";
    DrvArry[6] = "org.gjt.mm.mysql.Driver (MySQL)";
    DrvArry[7] = "com.sybase.jdbc2.jdbc.SybDriver (Sybase)";
    DrvArry[8] = "COM.cloudscape.core.JDBCDriver (Cloudscape)";
    DrvArry[9] = "intersolv.jdbc.sequelink.SequeLinkDriver (Oracle)";
    DrvArry[10] = "intersolv.jdbc.sequelink.SequeLinkDriver (Informix)";
    DrvArry[11] = "intersolv.jdbc.sequelink.SequeLinkDriver (Sybase)";
    DrvArry[12] = "intersolv.jdbc.sequelink.SequeLinkDriver (SQLServer)";
    DrvArry[13] = "intersolv.jdbc.sequelink.SequeLinkDriver (Access)";
    DrvArry[14] = "openlink.jdbc2.Driver (SQLServer)";

%>
      <TD bgcolor="#EEEEEE" width=90%>

         <TABLE border=0 width=100% cellspacing=5 cellpadding=2>
            <TR><TD width=2%> </TD>
               <TD width=10%><B>Driver:</B></TD>
               <TD width=2%> </TD>
               <TD width=86%>
                  <TABLE border=0 cellspacing=0 cellpadding=0><TD><TD width=340>
                     <SELECT name=drvtxt width=340 style="WIDTH: 340px" onChange="drvtxt_onChange();">
<%                  for (i = 0; i < DrvArry.length; i++) {
                     if (i == drvIdx) { %>
                        <OPTION value=<%=i%> selected><%=DrvArry[i]%></OPTION>
<%                     } else {%>
                          <OPTION value=<%=i%>><%=DrvArry[i]%></OPTION>
<%                     }
                  }%>
                     </SELECT></TD>
                     <TD width=80 align=center><INPUT name=openCnn type=submit value=" Open "></TD>
                     <TD><INPUT name=reset1 type=reset value=" Reset"></TD></TR></TABLE>
               </TD></TR>
            <TR><TD width=2%> </TD>
               <TD width=10%><B>Url:</B></TD>
               <TD width=2%> </TD>
               <TD width=86%><INPUT type=textbox name=urltxt size=70 value=""></TD></TR>
            <TR><TD width=2%> </TD>
               <TD width=10%><STRONG>UID:</STRONG></TD>
               <TD width=2%> </TD>
               <TD width=86%><INPUT type=textbox name=uidtxt size=70 value=""></TD></TR>
            <TR><TD width=2%> </TD>
               <TD width=10%><STRONG>PWD:</STRONG></TD>
               <TD width=2%> </TD>
               <TD width=86%><INPUT name=pwdtxt type=password size=70 value=""></TD></TR>
         </TABLE></TD>
<%   }%>
      </TR></TABLE>

</FORM>

</BODY>
</HTML>

<SCRIPT language=JavaScript>
function openCnn_onclick(){
   if (document.form1.drvtxt.selectedIndex == 0){
      alert("Please select a database driver.");
      return;
   }
   document.form1.submit();
}

function drvtxt_onChange(){
   switch ( document.form1.drvtxt.selectedIndex ){
   case 0:
     document.form1.urltxt.value = "";
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
     break;
   case 1:
     document.form1.urltxt.value = "{jdbc:odbc:AccessDB}";
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
     break;
   case 2:
     document.form1.urltxt.value = "{jdbc:odbc:SQLServerDB}";
     document.form1.uidtxt.value = "sa";
     document.form1.pwdtxt.value = "";
     break;
   case 3:
     document.form1.urltxt.value = "{jdbc:oracle:thin:@<HostIP>:1521:<SID>}";
     document.form1.uidtxt.value = "HALCYON";
     document.form1.pwdtxt.value = "HALCYON";
     break;
    case 4:
     document.form1.urltxt.value = "{jdbc:informix-sqli://<HostIP>:1526/InformixDB:informixserver=kingdbsvr;user=informix;password=miss}";
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
     break;
    case 5:
     document.form1.urltxt.value = "{jdbc:z1MySQL://<HostIP>:3306/MySQLDB}";
     document.form1.uidtxt.value = "root";
     document.form1.pwdtxt.value = "";
     break;
    case 6:
     document.form1.urltxt.value = "{jdbc:mysql://<HostIP>:3306/MySQLDB}";
     document.form1.uidtxt.value = "root";
     document.form1.pwdtxt.value = "";
     break;
    case 7:
     document.form1.urltxt.value = "{jdbc:sybase:Tds:<HostIP>:5000/SybaseDB}";
     document.form1.uidtxt.value = "sa";
     document.form1.pwdtxt.value = "";
     break;
    case 8:
     document.form1.urltxt.value = "{jdbc:cloudscape:" + document.form1.pathInfo.value;
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
     break;
   case 9:
     document.form1.urltxt.value = "{jdbc:sequelink://<HostIP>:4003/[Oracle];OSUser=john;OSPassword=whatever}";
     document.form1.uidtxt.value = "HALCYON";
     document.form1.pwdtxt.value = "HALCYON";
     break;
   case 10:
     document.form1.urltxt.value = "{jdbc:sequelink://<HostIP>:4004/[Informix];Database=InformixDB;OSUser=john;OSPassword=whatever}";
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
     break;
   case 11:
     document.form1.urltxt.value = "{jdbc:sequelink://<HostIP>:4005/[Sybase];Database=SybaseDB;OSUser=john;OSPassword=whatever}";
     document.form1.uidtxt.value = "sa";
     document.form1.pwdtxt.value = "";
     break;
   case 12:
     document.form1.urltxt.value = "{jdbc:sequelink://<HostIP>:4006/[SQLServer];Database=SQLServerDB;OSUser=john;OSPassword=whatever}";
     document.form1.uidtxt.value = "sa";
     document.form1.pwdtxt.value = "";
     break;
   case 13:
     document.form1.urltxt.value = "{jdbc:sequelink://<HostIP>:4011/[ODBC MS Access];Database=c:\\database\\AccessDB.mdb;}";
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
     break;
   case 14:
     document.form1.urltxt.value = "{jdbc:openlink://<HostIP>/DSN=SQLServerDB/UID=sa/PWD=}";
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
     break;
              
   case 16:
     document.form1.urltxt.value = "{jdbc:msql://<HostIP>:1114/MiniSQLDB}";
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
     break;
   case 17:
     document.form1.urltxt.value = "{jdbc:solid://<HostIP>:<port>/<UID>/<PWD>}";
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
     break;
   case 18:
     document.form1.urltxt.value = "{jdbc:dbaw://< Host IP >:8889/MS_ACCESS/BIBLIO/BIBLIO}";
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
   }

}
</script>

Copyright © 1998-2002, Halcyon Software Inc. All rights reserved.