Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Eclipse + Tomcat + SQL server 2008 express
Eclipse + Tomcat + SQL server 2008 express [message #858623] Fri, 27 April 2012 08:14 Go to next message
Ayman Metwally is currently offline Ayman MetwallyFriend
Messages: 8
Registered: April 2012
Junior Member
Greetings everybody,

I'm very new to Java world and coming from .NET background .. so please don't shot me for any intuitive mistakes Razz

I have a project in hand that needs to be modified, I'm studying the source code and I'm trying to get the original source code to work before editing.

I'm trying to establish the connection with SQL server 2008 express and read tens of threads about that and tried every thing with no success ..

SQL Server Part:
I'm sure it's running as when I test it in DOS, it replies to me:
sqlcmd -E -S localhost\SQLEXPRESS2  (This is the name of the instance)
1>
2> select @@servername
3> go
------------------------------------------------------------------------------
AYMAN_METWALLY\SQLEXPRESS2


That's how I'm sure that SQL server is configured and communicating correctly.

Eclipse Part (I'm running from IDE):
url: jdbc:sqlserver://127.0.0.1\SQLEXPRESS2;databaseName=CCMSDB
user: sa
pass: *****

Is it a correct url ?!

Error message from eclipse IDE:
Error:com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host 127.0.0.1SQLEXPRESS2, port 1433 has failed. Error: "connect timed out. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port.".

Thanks in advance for your support ...

Ayman
Re: Eclipse + Tomcat + SQL server 2008 express [message #858640 is a reply to message #858623] Fri, 27 April 2012 08:23 Go to previous messageGo to next message
Ayman Metwally is currently offline Ayman MetwallyFriend
Messages: 8
Registered: April 2012
Junior Member
One of the trials and response:

url: jdbc:sqlserver://127.0.0.1;databaseName=CCMSDB;

Error message:

Quote:
Apr 27, 2012 10:22:47 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files (x86)\Java\jre6\bin;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Java\jre6\bin;C:\Program Files\Microsoft Network Monitor 3\;.
Apr 27, 2012 10:22:47 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:ccms' did not find a matching property.
Apr 27, 2012 10:22:47 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8081
Apr 27, 2012 10:22:47 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 570 ms
Apr 27, 2012 10:22:47 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Apr 27, 2012 10:22:47 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35
Apr 27, 2012 10:22:48 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class com.pg.ccms.scheduler.CCMSApplicationListener
java.lang.ClassNotFoundException: com.pg.ccms.scheduler.CCMSApplicationListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4149)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Apr 27, 2012 10:22:48 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Skipped installing application listeners due to previous error(s)
Apr 27, 2012 10:22:48 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Apr 27, 2012 10:22:48 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/ccms] startup failed due to previous errors
Apr 27, 2012 10:22:48 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8081
Apr 27, 2012 10:22:48 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8019
Apr 27, 2012 10:22:48 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/29 config=null
Apr 27, 2012 10:22:48 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 337 ms
Re: Eclipse + Tomcat + SQL server 2008 express [message #858650 is a reply to message #858640] Fri, 27 April 2012 08:28 Go to previous messageGo to next message
Ayman Metwally is currently offline Ayman MetwallyFriend
Messages: 8
Registered: April 2012
Junior Member
Please check the attached screen shot that shows some settings

index.php/fa/8117/0/
  • Attachment: settings.jpg
    (Size: 161.65KB, Downloaded 2819 times)

[Updated on: Fri, 27 April 2012 08:29]

Report message to a moderator

Re: Eclipse + Tomcat + SQL server 2008 express [message #859916 is a reply to message #858650] Fri, 27 April 2012 21:43 Go to previous messageGo to next message
Ayman Metwally is currently offline Ayman MetwallyFriend
Messages: 8
Registered: April 2012
Junior Member
RESOLVED !

I was configuration the wrong SQL server instance Confused

As usual, a simple thing did the trick Very Happy

index.php/fa/8128/0/
  • Attachment: settings2.jpg
    (Size: 91.48KB, Downloaded 2760 times)
Re: Eclipse + Tomcat + SQL server 2008 express [message #861468 is a reply to message #859916] Sat, 28 April 2012 15:32 Go to previous messageGo to next message
Elena Irkovskaya is currently offline Elena IrkovskayaFriend
Messages: 1
Registered: April 2012
Junior Member
I have a problem with connect to database on SQL Server 2008R2. I use Eclipse.
Help me, please.

import java.sql.*;
import com.microsoft.sqlserver.jdbc.*;


public class Start {

/**
* @param args
*/

public static Connection getConnection(String url, String user, String pass) {
//load driver for MS SQL
try {
Class.forName("com.microsoft.sqlserver.jdbc.DriverJDBCVersion");
} catch (ClassNotFoundException e) {
System.err.println("Driver not found: " + e + "\n" + e.getMessage());
return null;
}
//return null;
try {
//get connection
Connection conn = DriverManager.getConnection(url, user, pass);
return conn;
} catch (Exception e) {
System.err.println("Exception: " + e + "\n" + e.getMessage());
return null;
}
}

public static void main(String[] args) {
//vars for connection
String url = "jdbc:sqlserver://localhost:1433;databaseName=sale_telephone";
String user = "lena";
String pass = "123456";

Connection con = getConnection(url, user, pass);
}
}

When I run my file, I get
Exception: com.microsoft.sqlserver.jdbc.SQLServerException: Ошибка входа пользователя "lena". ClientConnectionId:8fbdcc0f-0766-4458-af42-512a1bdf6123
Ошибка входа пользователя "lena". ClientConnectionId:8fbdcc0f-0766-4458-af42-512a1bdf6123

Thank You
Re: Eclipse + Tomcat + SQL server 2008 express [message #867103 is a reply to message #861468] Tue, 01 May 2012 06:00 Go to previous messageGo to next message
Ayman Metwally is currently offline Ayman MetwallyFriend
Messages: 8
Registered: April 2012
Junior Member
I sure will try to help you ... I know what you're feeling now when no one is answering you Sad

I'm a newcomer .. but will try ... first, can you please translate the Russian words in the error message to English?

[Updated on: Tue, 01 May 2012 06:00]

Report message to a moderator

Re: Eclipse + Tomcat + SQL server 2008 express [message #867111 is a reply to message #867103] Tue, 01 May 2012 06:04 Go to previous messageGo to next message
Ayman Metwally is currently offline Ayman MetwallyFriend
Messages: 8
Registered: April 2012
Junior Member
I checked Google Translate and it shows that the error message is:
"Login failed for user" ... This means that you are already connected to the SQL server but something is wrong with authentication ...

1) Can You connect with "SQL Server Managment Studio" using the same username\password?
2) Are you connecting locally or remotely?
Re: Eclipse + Tomcat + SQL server 2008 express [message #869602 is a reply to message #867111] Thu, 03 May 2012 17:11 Go to previous message
Ayman Metwally is currently offline Ayman MetwallyFriend
Messages: 8
Registered: April 2012
Junior Member
I forgot to mention that the correct url that gets every thing working is:

jdbc:sqlserver://localhost:1433;databaseName=CCMSDB


Just mentioning this for everybody else who may face this problem Smile

[Updated on: Thu, 03 May 2012 17:12]

Report message to a moderator

Previous Topic:Custom Text Editor Formatting
Next Topic:Multiple Wsdls
Goto Forum:
  


Current Time: Mon Nov 24 06:56:32 GMT 2014

Powered by FUDForum. Page generated in 0.03948 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software