MSSQL Integration [message #1862857] |
Wed, 03 January 2024 08:35 |
Ni ni Messages: 15 Registered: January 2024 |
Junior Member |
|
|
Hello, I am really new to Eclipse Scout.
I created a new Scout Application and everything works fine.
Now, I added the MSSQL classes - and the following error occurs.
Please, can someone help me out?
public class MicrosoftSqlStyle extends AbstractSqlStyle {
@Override
public String getConcatOp() {
return "+";
}
@Override
public String getLikeWildcard() {
return "%";
}
@Override
protected int getMaxListSize() {
return 1000;
}
@Override
public boolean isLargeString(String s) {
return (s.length() > 4000);
}
@Override
public boolean isBlobEnabled() {
return true;
}
@Override
public boolean isClobEnabled() {
return true;
}
@Override
public String createDateTimeIsNow(String attribute) {
return "TRUNC(" + attribute + ", 'MI')=TRUNC(SYSDATE, 'MI')";
}
@Override
public String createDateTimeIsNotNow(String attribute) {
return "TRUNC(" + attribute + ", 'MI')!=TRUNC(SYSDATE, 'MI')";
}
@Override
public void testConnection(Connection conn) throws SQLException {
Statement testStatement = null;
try {
testStatement = conn.createStatement();
testStatement.execute("SELECT count(1) FROM dbo.sysobjects");
} finally {
if (testStatement != null)
try {
testStatement.close();
} catch (Throwable t) {
}
}
}
}
public class MSSqlService extends AbstractSqlService {
@Override
protected Class<? extends ISqlStyle> getConfiguredSqlStyle() {
return MicrosoftSqlStyle.class;
}
@Override
protected String getConfiguredJdbcDriverName() {
return "com.microsoft.sqlserver.jdbc.SQLServerDriver";
}
@Override
protected String getConfiguredJdbcMappingName() {
return "jdbc:sqlserver://localhost:1433;database=testdb;encrypt=false;";
}
@Override
protected String getConfiguredUsername() {
return "ADMIN";
}
@Override
protected String getConfiguredPassword() {
return "12345";
}
}
Error:
2024-01-03 08:57:38,725 INFO [qtp1528923159-37] org.eclipse.scout.rt.ui.html.UiServlet.sendNotFound(UiServlet.java:282) - 404_NOT_FOUND: POST /process
2024-01-03 08:57:38,759 WARN [scout-thread-5 Tunneling service request [seq=2, submitter=ClientNotificationPoller]] org.eclipse.scout.rt.shared.http.ApacheMultiSessionCookieStore.addCookie(ApacheMultiSessionCookieStore.java:75) - adding cookie to default cookie store which could be used by other users too [cookie: [version: 0][name: JSESSIONID][value: node01clgxmgu9d8zu1oex2bc1c092t0.node0][domain: localhost][path: /][expiry: null]] - MDC[principal=notification-authenticator, jobName=Tunneling service request [seq=2, submitter=ClientNotificationPoller]]
2024-01-03 08:57:38,774 ERROR [scout-thread-4 ClientNotificationPoller] org.eclipse.scout.rt.client.clientnotification.ClientNotificationPoller.run(ClientNotificationPoller.java:156) - Error receiving client notifications [clientNodeId=8d82a793-bb8a-4d0f-ab1f-ab520ca56e5f] - MDC[principal=notification-authenticator, jobName=ClientNotificationPoller]
org.eclipse.scout.rt.shared.servicetunnel.http.HttpServiceTunnelException: Service tunnel request failed with status code 404 [user=notification-authenticator, remote-service.name=org.eclipse.scout.rt.shared.clientnotification.IClientNotificationService, remote-service.operation=getNotifications]
at org.eclipse.scout.rt.shared.servicetunnel.http.RemoteServiceInvocationCallable.call(RemoteServiceInvocationCallable.java:82)
at org.eclipse.scout.rt.shared.servicetunnel.http.RemoteServiceInvocationCallable.call(RemoteServiceInvocationCallable.java:1)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:226)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:226)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.runTxMandatory(TransactionProcessor.java:155)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.runTxRequired(TransactionProcessor.java:138)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.intercept(TransactionProcessor.java:77)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:221)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:169)
at org.eclipse.scout.rt.platform.context.RunContext.call(RunContext.java:157)
at org.eclipse.scout.rt.platform.context.RunContextRunner.intercept(RunContextRunner.java:37)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:221)
at org.eclipse.scout.rt.platform.job.internal.CallableChainExceptionHandler.intercept(CallableChainExceptionHandler.java:32)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:221)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:169)
at org.eclipse.scout.rt.platform.job.internal.JobFutureTask.lambda$0(JobFutureTask.java:105)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.eclipse.scout.rt.platform.job.internal.JobFutureTask.run(JobFutureTask.java:174)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
at org.eclipse.scout.rt.platform.job.internal.NamedThreadFactory$1.run(NamedThreadFactory.java:62)
at org.eclipse.scout.rt.shared.servicetunnel.AbstractServiceTunnel.invokeService(AbstractServiceTunnel.java:63)
at org.eclipse.scout.rt.shared.servicetunnel.AbstractServiceTunnel.invokeService(AbstractServiceTunnel.java:39)
at org.eclipse.scout.rt.shared.servicetunnel.http.HttpServiceTunnel.invokeService(HttpServiceTunnel.java:191)
at org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelProxyProducer.invoke(ServiceTunnelProxyProducer.java:50)
at org.eclipse.scout.rt.platform.interceptor.DecoratingProxy.invokeImpl(DecoratingProxy.java:136)
at org.eclipse.scout.rt.platform.interceptor.DecoratingProxy$P_InvocationHandler.invoke(DecoratingProxy.java:169)
at jdk.proxy2/jdk.proxy2.$Proxy22.getNotifications(Unknown Source)
at org.eclipse.scout.rt.client.clientnotification.ClientNotificationPoller$P_NotificationPoller.lambda$0(ClientNotificationPoller.java:144)
at org.eclipse.scout.rt.platform.util.concurrent.Callables.lambda$0(Callables.java:30)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:226)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.runTxMandatory(TransactionProcessor.java:155)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.runTxRequired(TransactionProcessor.java:138)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.intercept(TransactionProcessor.java:77)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:221)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:169)
at org.eclipse.scout.rt.platform.context.RunContext.call(RunContext.java:157)
at org.eclipse.scout.rt.platform.context.RunContext.call(RunContext.java:138)
at org.eclipse.scout.rt.platform.context.RunContext.run(RunContext.java:109)
at org.eclipse.scout.rt.client.clientnotification.ClientNotificationPoller$P_NotificationPoller.run(ClientNotificationPoller.java:141)
at org.eclipse.scout.rt.platform.util.concurrent.Callables.lambda$0(Callables.java:30)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:226)
at org.eclipse.scout.rt.platform.job.internal.ExceptionProcessor.intercept(ExceptionProcessor.java:40)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:221)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:226)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.runTxRequiresNew(TransactionProcessor.java:112)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.runTxRequired(TransactionProcessor.java:141)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.intercept(TransactionProcessor.java:77)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:221)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:169)
at org.eclipse.scout.rt.platform.context.RunContext.call(RunContext.java:157)
at org.eclipse.scout.rt.platform.context.RunContextRunner.intercept(RunContextRunner.java:37)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:221)
at org.eclipse.scout.rt.platform.job.internal.CallableChainExceptionHandler.intercept(CallableChainExceptionHandler.java:32)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:221)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:169)
at org.eclipse.scout.rt.platform.job.internal.JobFutureTask.lambda$0(JobFutureTask.java:105)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.eclipse.scout.rt.platform.job.internal.JobFutureTask.run(JobFutureTask.java:174)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
at org.eclipse.scout.rt.platform.job.internal.NamedThreadFactory$1.run(NamedThreadFactory.java:62)
This part works fine from within the project code:
public static void main(String[] args) {
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
String connectionUrl =
"jdbc:sqlserver://localhost:1433;"
+ "database=testdb;"
+ "user=ADMIN;"
+ "password=12345;"
+ "encrypt=false;";
try (Connection connection = DriverManager.getConnection(connectionUrl);) {
// Code here.
Statement statement = connection.createStatement();
ResultSet result = statement.executeQuery("SELECT * FROM MYTABLE");
while(result.next()) {
System.out.println(result.getString(1));
}
}
// Handle any errors that may have occurred.
catch (SQLException e) {
e.printStackTrace();
}
}
|
|
|
|
|
Re: MSSQL Integration [message #1862861 is a reply to message #1862860] |
Wed, 03 January 2024 08:47 |
Ni ni Messages: 15 Registered: January 2024 |
Junior Member |
|
|
Here is the server log:
2024-01-03 09:31:17,870 INFO [main] org.eclipse.scout.rt.platform.config.ConfigPropertyProvider.parse(ConfigPropertyProvider.java:115) - Reading properties from file:/C:/Users/.../target/classes/config.properties using org.eclipse.scout.rt.platform.config.DefaultConfigFileLoader
2024-01-03 09:31:17,905 INFO [scout-platform-starter] org.eclipse.scout.rt.platform.internal.PlatformImplementor.validateHeadless(PlatformImplementor.java:174) - Headless mode: scout.headless=true, java.awt.headless=true (automatically set by Scout), GraphicsEnvironment.isHeadless()=true
2024-01-03 09:31:17,913 INFO [scout-platform-starter] org.eclipse.scout.rt.platform.inventory.ClassInventory.<clinit>(ClassInventory.java:37) - Building jandex class inventory using rebuild strategy IF_MODIFIED...
2024-01-03 09:31:18,082 INFO [ForkJoinPool.commonPool-worker-7] org.eclipse.scout.rt.platform.inventory.internal.JandexInventoryBuilder.scanFolder(JandexInventoryBuilder.java:145) - Drop outdated index 'file:/C:/Users/.../target/classes/META-INF/jandex.idx'. Index timestamp 2024-01-03 09:06:19.392 is older than folder timestamp 2024-01-03 09:31:04.125.
2024-01-03 09:31:18,082 INFO [ForkJoinPool.commonPool-worker-7] org.eclipse.scout.rt.platform.inventory.internal.JandexInventoryBuilder.scanFolder(JandexInventoryBuilder.java:180) - Rebuild index 'file:/C:/Users/.../target/classes/META-INF/jandex.idx'. Scanning location...
2024-01-03 09:31:18,126 INFO [scout-platform-starter] org.eclipse.scout.rt.platform.inventory.ClassInventory.<clinit>(ClassInventory.java:43) - Finished building jandex class inventory in 215.864700 ms. Total class count: 1529
2024-01-03 09:31:18,278 INFO [scout-platform-starter] org.eclipse.scout.rt.platform.internal.PlatformImplementor.createBeanManager(PlatformImplementor.java:221) - Collected 364 beans in 150.979400 ms
2024-01-03 09:31:18,356 INFO [scout-platform-starter] org.eclipse.scout.rt.platform.internal.PlatformImplementor.createBeanManager(PlatformImplementor.java:226) - Registered 364 beans in 77.553900 ms
2024-01-03 09:31:18,364 INFO [scout-platform-starter] org.eclipse.scout.rt.platform.job.internal.DevelopmentThreadNameDecorator.stateChanged(DevelopmentThreadNameDecorator.java:87) - +++ Development thread name decoration
2024-01-03 09:31:18,373 INFO [scout-platform-starter] org.eclipse.scout.rt.platform.logger.LoggerInstallPlatformListener.registerLoggerSupportBean(LoggerInstallPlatformListener.java:98) - Registered logger support org.eclipse.scout.rt.platform.logger.LogbackLoggerSupport
2024-01-03 09:31:18,381 INFO [scout-platform-starter] org.eclipse.scout.rt.shared.services.common.code.CodeTypeRegistrator.stateChanged(CodeTypeRegistrator.java:41) - 0 code type classes registered.
2024-01-03 09:31:18,459 INFO [scout-platform-starter] org.eclipse.scout.rt.mom.api.AbstractMomTransport.initDelegate(AbstractMomTransport.java:98) - +++ Using 'NullMomImplementor' for transport 'ClusterMom'. No messages are published and received.
2024-01-03 09:31:18,674 INFO [main] org.eclipse.scout.dev.jetty.JettyServer.createContextHandler(JettyServer.java:214) - Starting Jetty with resourceBase=C:\Users\...\src\main\webapp
2024-01-03 09:31:18,722 INFO [main] org.eclipse.jetty.server.Server.doStart(Server.java:384) - jetty-10.0.17; built: 2023-10-09T18:22:21.150Z; git: af15f12297adf5c5083e1f2f8f4c5974438bca25; jvm 17.0.9+9
2024-01-03 09:31:18,940 INFO [main] org.eclipse.jetty.webapp.StandardDescriptorProcessor.visitServlet(StandardDescriptorProcessor.java:274) - NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2024-01-03 09:31:18,956 INFO [main] org.eclipse.jetty.server.session.DefaultSessionIdManager.doStart(DefaultSessionIdManager.java:332) - Session workerName=node0
2024-01-03 09:31:19,009 INFO [main] org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:906) - Started o.e.s.d.j.P_WebAppContext@38234a38{... Server,/,file:///C:/Users/.../src/main/webapp/,AVAILABLE}{C:\Users\...\src\main\webapp}
2024-01-03 09:31:19,051 INFO [main] org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:376) - Started ServerConnector@2205a05d{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2024-01-03 09:31:19,055 INFO [main] org.eclipse.jetty.server.Server.doStart(Server.java:439) - Started Server@2fba3fc4{STARTING}[10.0.17,sto=0] @2136ms
2024-01-03 09:31:19,060 INFO [main] org.eclipse.scout.dev.jetty.JettyServer.logServerReady(JettyServer.java:159) - Server ready. The application is available on the following addresses:
---------------------------------------------------------------------
http://localhost:8080/
http://desktop:8080/
http://192.168.178.54:8080/
---------------------------------------------------------------------
To shut the server down, type "shutdown" in the console.
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05255 seconds