SAP Sybase SQL Anywhere数据库JDBC访问(需要native dll)

时间:2022-04-19 15:03:43

服务器环境:

  • Windows 2008 64bit
  • SQL Anywhere 16服务器


SQLA数据库服务器自带的例子数据库位置:C:\Users\Public\Documents\SQL Anywhere 16\Samples\demo.db"
用Sybase Central创建服务:

服务名称:DemoDBService
参数:-n DemoDB -x tcpip "C:\Users\Public\Documents\SQL Anywhere 16\Samples\demo.db"
生成的Server name: DemoDB

      Database name: demo

缺省监听端口2638



客户端环境:

  • JDK 1.6/1.7
  • eclipse Juno


装载 SQL Anywhere JDBC 4.0 驱动程序:

假设:SQLANY16=C:\Program Files\SQL Anywhere 16
JDBC驱动文件:%SQLANY16%\java\sajdbc4.jar
JDBC本地驱动文件:%SQLANY16%\Bin64\dbjdbc16.dll


在Java/eclipse数据库访问数据库:

Driver Class: sybase.jdbc4.sqlanywhere.IDriver
JDBC URL:    jdbc:sqlanywhere:uid=DBA;pwd=sql;eng= demodb;database= demo;links=tcpip(host=127.0.0.1)


参考:

参考:装载 SQL Anywhere JDBC 4.0 驱动程序 http://dcx.sybase.com/1200/zh/dbprogramming/pg-jdbc-4-0-load.html
参考:http://blog.chinaunix.net/uid-16765068-id-4093220.html

参考:例子Java/JDBC代码
http://dcx.sybase.com/1200/zh/dbprogramming/connecting-establishing-jdbc.html
http://www.quickprogrammingtips.com/java/connecting-to-sybase-sql-anywhere-database-in-java.html