Myna Windows ODBC Connection

You can access any data that is ODBC compliant with Myna. Obviously, if you only have a Windows ODBC driver, you have to be running Myna on Windows.

Here are the basic steps:

  • Set up a data source in the Myna Administrator using "other" as the driver type.
  • For the driver copy and paste - sun.jdbc.odbc.JdbcOdbcDriver
  • For the URL use jdbc:odbc:yourDSNname

You must have a DSN setup in your Windows control panel.
No username or password should be required as that is setup with your DSN.

Here is some sample code for testing:

    <%
    var qry = new Myna.Query({
// This is the datasource name setup in the Myna Administrator.
        dataSource:"yourDataSource", 
        sql:"select * from yourTable",
        startRow:10,
        maxRows:30
    });
    %>
    <table border="1" >
        <caption> Records <%=qry.startRow%> - 
		<%=qry.maxRows%> of <%=qry.totalRows%></caption>
        <tr>
            <@loop array='qry.columns' element='column'>
                <th><%=column.name%></th>
            </@loop>
        </tr>
        <@loop array='qry.data' element='row'>
            <tr>
                <@loop array='qry.columns' element='column'>
                    <th><%=String(row[column.name.toLowerCase()])%></th>
                </@loop>
            </tr>
        </@loop>
    </table>