Results 1 to 2 of 2
  1. #1
    gabriel is offline Member
    Join Date
    Jul 2007
    Posts
    41
    Rep Power
    0

    Default Problems when I try to connect to data base

    I'm trying to do a connection but it gives to me an error
    this is my code:
    Java Code:
    String driverName = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; 
    String serverName = "MyServer";
    String portNumber = "1433";
    String dataBase ="SIEEC";
    String url = "jdbc:microsoft:sqlserver://" + serverName + ":" + portNumber + ";" 
    + dataBase; 
    String username = "sa";
    String password = "Admin";
    
    Class.forName(driverName);
    connection = DriverManager.getConnection(url, username, password);
    any ideas?

  2. #2
    tommy is offline Member
    Join Date
    Jul 2007
    Posts
    41
    Rep Power
    0

    Default

    try using "database=xyz", or something like this:
    Java Code:
    String url = "jdbc:sqlserver://172.31.255.255;database=AdventureWorks";

Similar Threads

  1. connect two applet
    By dg_iiita in forum Java Applets
    Replies: 0
    Last Post: 02-15-2008, 02:59 PM
  2. Problems with Jtable connected to data base
    By elizabeth in forum AWT / Swing
    Replies: 2
    Last Post: 08-07-2007, 05:24 PM
  3. problems with Instance Data
    By paty in forum New To Java
    Replies: 2
    Last Post: 08-02-2007, 06:45 PM
  4. 2 threads sharing a data base connection
    By Ed in forum Advanced Java
    Replies: 2
    Last Post: 07-04-2007, 05:41 AM
  5. Connection to data base
    By Daniel in forum JDBC
    Replies: 2
    Last Post: 06-07-2007, 05:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •