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

Method JdbcConnect

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

Source from the content-addressed store, hash-verified

74 } // end of CatalogIsSchema
75
76 public int JdbcConnect(String[] parms, int fsize, boolean scrollable) {
77 int rc = 0;
78
79 if (DEBUG)
80 System.out.println("In JdbcInterface: driver=" + parms[0]);
81
82 try {
83 if (DEBUG)
84 System.out.println("In try block");
85
86 if (parms[0] != null && !parms[0].isEmpty()) {
87 if (DEBUG)
88 System.out.println("Loading class" + parms[0]);
89
90 Class.forName(parms[0]); //loads the driver
91 } // endif driver
92
93 if (DEBUG)
94 System.out.println("URL=" + parms[1]);
95
96 CheckURL(parms[1], null);
97
98 // This is required for drivers using context class loaders
99 Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
100
101 if (parms[2] != null && !parms[2].isEmpty()) {
102 if (DEBUG)
103 System.out.println("user=" + parms[2] + " pwd=" + parms[3]);
104
105 conn = DriverManager.getConnection(parms[1], parms[2], parms[3]);
106 } else
107 conn = DriverManager.getConnection(parms[1]);
108
109 if (DEBUG)
110 System.out.println("Connection " + conn.toString() + " established");
111
112 // Get the data base meta data object
113 dbmd = conn.getMetaData();
114
115 // Get a statement from the connection
116 stmt = GetStmt(fsize, scrollable);
117 } catch(ClassNotFoundException e) {
118 SetErrmsg(e);
119 rc = -1;
120 } catch (SQLException se) {
121 SetErrmsg(se);
122 rc = -2;
123 } catch( Exception e ) {
124 SetErrmsg(e);
125 rc = -3;
126 } // end try/catch
127
128 return rc;
129 } // end of JdbcConnect
130
131 protected Statement GetStmt(int fsize, boolean scrollable) throws SQLException, Exception {
132 Statement stmt = null;

Callers 1

mainMethod · 0.45

Calls 3

CheckURLMethod · 0.95
GetStmtMethod · 0.95
SetErrmsgMethod · 0.95

Tested by

no test coverage detected