MCPcopy Create free account
hub / github.com/MariaDB/server / JdbcConnect

Method JdbcConnect

storage/connect/ApacheInterface.java:18–59  ·  view source on GitHub ↗
(String[] parms, int fsize, boolean scrollable)

Source from the content-addressed store, hash-verified

16 } // end of constructor
17
18 @Override
19 public int JdbcConnect(String[] parms, int fsize, boolean scrollable) {
20 int rc = 0;
21 String url = parms[1];
22 BasicDataSource ds = null;
23
24 if (DEBUG)
25 System.out.println("Connecting to Apache data source");
26
27 try {
28 CheckURL(url, null);
29
30 if ((ds = pool.get(url)) == null) {
31 ds = new BasicDataSource();
32 ds.setDriverClassName(parms[0]);
33 ds.setUrl(url);
34 ds.setUsername(parms[2]);
35 ds.setPassword(parms[3]);
36 pool.put(url, ds);
37 } // endif ds
38
39 // if (parms.length > 4 && parms[4] != null)
40 // ds.setConnectionProperties(parms[4]);
41
42 // Get a connection from the data source
43 conn = ds.getConnection();
44
45 // Get the data base meta data object
46 dbmd = conn.getMetaData();
47
48 // Get a statement from the connection
49 stmt = GetStmt(fsize, scrollable);
50 } catch (SQLException se) {
51 SetErrmsg(se);
52 rc = -2;
53 } catch (Exception e) {
54 SetErrmsg(e);
55 rc = -3;
56 } // end try/catch
57
58 return rc;
59 } // end of JdbcConnect
60
61} // end of class ApacheInterface

Callers

nothing calls this directly

Calls 5

CheckURLMethod · 0.80
GetStmtMethod · 0.80
getMethod · 0.45
putMethod · 0.45
SetErrmsgMethod · 0.45

Tested by

no test coverage detected