Quantum version 2.4.1
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / adapters / InformixAdapter.java
1 package com.quantum.adapters;
2
3 import java.net.InetAddress;
4 import java.net.UnknownHostException;
5 import java.util.HashMap;
6 import java.util.Map;
7
8 /**
9  * @author BC Holmes
10  */
11 public class InformixAdapter extends GenericAdapter {
12
13         /**
14          * @param type
15          */
16         protected InformixAdapter() {
17                 super(AdapterFactory.INFORMIX);
18         }
19
20         /**
21          * Get the default connection properties for Informix.  These defaults assume that 
22          * the database is located on the user's local machine.  Informix doesn't allow 
23          * for "localhost".
24          */
25         public Map getDefaultConnectionParameters() {
26                 Map map = new HashMap();
27                 map.put("hostname", getHostName());
28                 map.put("informixserver", "ol_" + getHostName());
29                 map.put("port", "1526");
30                 return map;
31         }
32
33         /**
34          * @return
35          */
36         private String getHostName() {
37                 try {
38                         return InetAddress.getLocalHost().getHostName();
39                 } catch (UnknownHostException e) {
40                         return "localhost";
41                 }
42         }
43 }