<property name="openjpa.ConnectionDriverName" value="com.ibm.db2.jcc.DB2Driver" /> <property name="openjpa.ConnectionURL" value="jdbc:db2://SERVER_NAME:50000/DB_NAME" /> <property name="openjpa.ConnectionUserName" value="USER_NAME" /> <property name="openjpa.ConnectionPassword" value="USER_PASSWORD" /> </properties>
For Oracle, specify as following configuration:
<property name="openjpa.ConnectionDriverName" value="oracle.jdbc.driver.OracleDriver" /> <property name="openjpa.ConnectionURL" value="jdbc:oracle:thin:SERVER_NAME:1521:DB_NAME" /> <property name="openjpa.ConnectionUserName" value="USER_NAME" /> <property name="openjpa.ConnectionPassword" value="USER_PASSWORD" /> </properties>
For SQL Server, specify as following configuration:
<property name="openjpa.ConnectionDriverName" value=" com.microsoft.sqlserver.jdbc.SQLServerDriver " /> <property name="openjpa.ConnectionURL" value=" jdbc:sqlserver://SERVER_NAME:1433;DatabaseName=DB_NAME/> <property name="openjpa.ConnectionUserName" value="USER_NAME" /> <property name="openjpa.ConnectionPassword" value="USER_PASSWORD" /> </properties>
static SmartDataCollectionDAO smartDao=new SmartDataCollectionDAOJPAImpl();
SmartVisitLog visit=new SmartVisitLog();
visit.setUserId("lyl"); visit.setSmartChannel(channel); visit.setLogonTime(DateUtil.getTimeStamp()); visit.setIpAddress("127.0.0.1"); visit.setVisitId(smartDao.getVisitId(visit.getUserId(), visit.getLogonTime().toString(), channel.getChannelId())); visit.setBrowser("/aaa/bb");
try{ smartDao.addSmartVisit(visit);//add the record smartDao.updateSmartVisit(visit);//update the record smartDao.deleteSmartVisit(visit);//delete the record }catch(Exception e){ e.printStackTrace(); }