Re: non-JDBC/ODBC interface to MySQL 4.1?
- From: "Daud Lee Lambert" <dlamber45@xxxxxxxxxxx>
- Date: Mon, 17 Apr 2006 11:02:57 -0400
"Frank" <franklopez2000@xxxxxxxxx> wrote in message
news:1144941730.138876.226160@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Does anyone know if there is a free, high-quality, non-ODBC/JDBC
interface to connect to MySQL from Java?
JDBC/ODBC has too much of a performance hit in our environments, and so
I'm looking for something better.
An alternative would be to spawn the MySQL client using something like
Process proc = Runtime.exec("mysql -B -n "+dbname);
proc.getInputStream().println("select * from "+table+";");
proc.getInputStream.close();
LineNumberReader result = new LineNumberReader(new
InputStreamReader(proc.getOutputStream());
result.readLine();
String line;
while ((line=result.readLine())!=null) {
String[] row = line.split("\t");
// now do something with row[0], row[1], etc.
}
However, for most reasonable workloads on production systems this would
probably involve much more overhead than just using the JDBC driver (process
creation versus a few function-calls). You also lose a lot of the
type-safety, error-checking and SQL injection protection that you could
easily get by using JDBC properly.
.
- References:
- non-JDBC/ODBC interface to MySQL 4.1?
- From: Frank
- non-JDBC/ODBC interface to MySQL 4.1?
- Prev by Date: Re: Is "From" a legal col name.
- Next by Date: Re: Is "From" a legal col name.
- Previous by thread: Re: non-JDBC/ODBC interface to MySQL 4.1?
- Next by thread: but how to call java program from PL/SQL Trigger?
- Index(es):
Relevant Pages
|
|