mysqld-nt directory cannot be accessed at localhost...Please help!!!!
I have narrowed down the problem, the java application is unable to reach the directory using localhost. The directory definitely exists and the mysqld-nt.exe runs and creates its pid and other files, however, the application is unsuccessful in connecting to the files and the directory using localhost. I disabled all firewalls but still am unable to get through. Please help!!!
This is the output i get in the console window:
jdbc:mysql:mxj://localhost:3336/test?server.basedir=c:\mysql\test-mxj
[MysqldResource] launching mysqld (getOptions)
[c:\mysql\test-mxj\bin\mysqld-nt.exe][--no-defaults][--console][--port=3336][--socket=c:\mysql\test-mxj\mysql.sock][--basedir=c:\mysql\test-mxj][--datadir=c:\mysql\test-mxj\data][--pid-file=c:\mysql\test-mxj\MysqldResource.pid]
[MysqldResource] launching mysqld (driver_launched_mysqld_1)
[MysqldResource] mysqld running as process: 3004
070128 2:15:14 InnoDB: Started; log sequence number 0 43634
c:\mysql\test-mxj\bin\mysqld-nt.exe: ready for connections.
Version: '4.1.13-nt' socket: '' port: 3336 Official MySQL binary
------------------------
4.1.13-nt
------------------------
mysqld [c:\mysql\test-mxj] not found in [localhost:3336]
Below is the code I am using
import java.io.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import com.mysql.management.driverlaunched.ServerLauncherSocketFactory;
public class ConnectorMXJUrlTestExample {
public static String DRIVER = "com.mysql.jdbc.Driver";
public static String JAVA_IO_TMPDIR = "java.io.tmpdir";
public static void main(String[] args) throws Exception {
File ourAppDir = new File("c:\\mysql");
File databaseDir = new File(ourAppDir, "test-mxj");
int port = 3336;
String url = "jdbc:mysql:mxj://localhost:" + port + "/test" + "?"
+ "server.basedir=" + databaseDir;
System.out.println(url);
String userName = "root";
String password = "";
Class.forName(DRIVER);
Connection conn = null;
try
{
conn = DriverManager.getConnection(url, userName, password);
printQueryResults(conn, "SELECT VERSION()");
}
finally
{
try
{
if (conn != null)
{
conn.close();
}
}
catch (Exception e)
{
e.printStackTrace();
}
ServerLauncherSocketFactory.shutdown(databaseDir.toString(), System.out);
System.out.println("Server is shut down.");
}
}
public static void printQueryResults(Connection conn, String SQLquery)
throws Exception {
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(SQLquery);
int columns = rs.getMetaData().getColumnCount();
System.out.println("------------------------");
System.out.println();
while (rs.next()) {
for (int i = 1; i <= columns; i++) {
System.out.println(rs.getString(i));
}
System.out.println();
}
rs.close();
stmt.close();
System.out.println("------------------------");
System.out.flush();
Thread.sleep(100); // wait for System.out to finish flush
}
}
Subject
Written By
Posted
mysqld-nt directory cannot be accessed at localhost...Please help!!!!
February 26, 2007 10:12PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.