JDBC connection URL for the data source

When you create a database element, you can use a JDBC URL to connect to the data source. This method is not as efficient as a connection pool, but is useful for testing, training, and demonstrating database applications.

ASA

To set up a JDBC connection to ASA, supply the JDBC URL and JDBC driver values in this format:

jdbc:sybase:Tds:localhost:4747?ServiceName=sampledb

com.sybase.jdbc3.jdbc.SybDriver

This method is demonstrated in the Mobile Application Development Tutorial.

SQL Server

To setup the SQL Server cache:

  1. Copy the msbase.jar, mssqlserver.jar, and msutils.jar to both:

    %SYBASE%\tomcat\common\lib

    %SYBASE%\tomcat\webapps\onepage\WEB-INF\lib

  2. Edit %SYBASE%\tomcat\conf\server.xml and add the following inside the <GlobalNamingResources> section:

    <Resource name="jdbc/sqlserver" auth="Container" type="javax.sql.DataSource" driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver" url="jdbc:microsoft:sqlserver://win2k3:1433" username="sa" password="" maxActive="20" maxIdle="10" maxWait="20000"/>

  3. Edit the SYBASE\tomcat\webapps\onepage\META-INF\context.xml file and add the following inside the <Context> section:

    <Resource name="jdbc/sqlserver" auth="Container" type="javax.sql.DataSource" driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver" url="jdbc:microsoft:sqlserver://win2k3:1433" username="sa" password="" maxActive="20" maxIdle="10" maxWait="20000" removeAbandoned="false" removeAbandonedTimeout="60" logAbandoned="false"/>

  4. Edit the SYBASE\tomcat\webapps\onepage\WEB-INF\web.xml file and add the following inside the <web-app> section:

    <resource-ref> <description>SQLServer Sample DB</description> <res-ref-name>jdbc/sqlserver</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>

That should show the sqlserver cache as a drop-down in the database capture wizard. You will need to modify the hostname, port, username, password in the above entries appropriately.

Oracle

To set up Oracle, follow the same steps, but substitute the Oracle JDBC URL and driver values in this format:

url="jdbc:oracle:thin:@<host>:1521:<OID>"

driverClassName="oracle.jdbc.driver.OracleDriver"

Oracle provides multiple JDBC drivers and above is the thin version. If you use other types your URL will change too. Also, contact the Oracle DBA for the hostname, OID, username, and password values to use.