AYUDA CON MAXDB
Hola, bueno igual y es algo muy sencillo, pero lo que pasa es que quiero conectarme desde java a una base de datos , pero no puedome indica algo de error en el driver, este es el codigo con el que trato de conectarme :
import java.sql.*;
public class HelloSapDB {
public static void main (String [] args)
// throws ClassNotFoundException, SQLException
{
String dbm_user = "SYSDBA";
String password = "masterkey";
/*
* Register the JDBC driver
*/
Class.forName ("com.sap.dbtech.jdbc.DriverSapDB");
/*
* Define the connection URL
*/
String url = "192.168.1.6:" + "e:/db/maxdb/pru.mdf";
/*
* Call the java.sql.DriverManager.getConnection method
*/
Connection connection = DriverManager.getConnection (url, dbm_user, password);
/*
* Execute a database query; database queries are formulated in Structured Query Language (SQL).
*/
Statement stmt = connection.createStatement ();
ResultSet resultSet = stmt.executeQuery ("SELECT 'hello world' FROM dual");
resultSet.next ();
String hello = resultSet.getString (1);
System.out.println (hello);
/*
* Close all objects
*/
resultSet.close ();
stmt.close ();
connection.close ();
}
}
no se donde esta mi error me gustaria ver si alguien me puede ayudar. Bueno eso es todo y gracias de ante mano.
import java.sql.*;
public class HelloSapDB {
public static void main (String [] args)
// throws ClassNotFoundException, SQLException
{
String dbm_user = "SYSDBA";
String password = "masterkey";
/*
* Register the JDBC driver
*/
Class.forName ("com.sap.dbtech.jdbc.DriverSapDB");
/*
* Define the connection URL
*/
String url = "192.168.1.6:" + "e:/db/maxdb/pru.mdf";
/*
* Call the java.sql.DriverManager.getConnection method
*/
Connection connection = DriverManager.getConnection (url, dbm_user, password);
/*
* Execute a database query; database queries are formulated in Structured Query Language (SQL).
*/
Statement stmt = connection.createStatement ();
ResultSet resultSet = stmt.executeQuery ("SELECT 'hello world' FROM dual");
resultSet.next ();
String hello = resultSet.getString (1);
System.out.println (hello);
/*
* Close all objects
*/
resultSet.close ();
stmt.close ();
connection.close ();
}
}
no se donde esta mi error me gustaria ver si alguien me puede ayudar. Bueno eso es todo y gracias de ante mano.
